Skip to content

Commit

Permalink
Explicitly cast NppStatus enum to int when logging
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory R. Lee <[email protected]>
  • Loading branch information
grlee77 committed Sep 27, 2024
1 parent 40184bb commit c29fe5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion operators/npp_filter/npp_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ void NppFilterOp::compute(InputContext& op_input, OutputContext& op_output,
throw std::runtime_error(fmt::format("Unknown filter {}.", filter_.get()));
}
if (status != NPP_SUCCESS) {
throw std::runtime_error(fmt::format("Filter {} failed with error {}", filter_.get(), status));
throw std::runtime_error(
fmt::format("Filter {} failed with error {}", filter_.get(), static_cast<int>(status)));
}

// pass the CUDA stream to the output message
Expand Down
16 changes: 10 additions & 6 deletions operators/orsi/orsi_format_converter/format_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou
scale_max_,
npp_stream_ctx_);
} else {
throw std::runtime_error(
fmt::format("Failed to convert channel order (NPP error code: {})", status));
throw std::runtime_error(fmt::format("Failed to convert channel order (NPP error code: {})",
static_cast<int>(status)));
}
break;
}
Expand All @@ -737,7 +737,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou
status = nppiRGBToYUV420_8u_C3P3R(in_tensor_ptr, src_step, out_yuv_ptrs, out_yuv_steps, roi);
if (status != NPP_SUCCESS) {
throw std::runtime_error(
fmt::format("rgb888 to yuv420 conversion failed (NPP error code: {})", status));
fmt::format("rgb888 to yuv420 conversion failed (NPP error code: {})",
static_cast<int>(status)));
}
break;
}
Expand All @@ -759,7 +760,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou
status = nppiYUV420ToRGB_8u_P3AC4R(in_yuv_ptrs, in_yuv_steps, out_tensor_ptr, dst_step, roi);
if (status != NPP_SUCCESS) {
throw std::runtime_error(
fmt::format("yuv420 to rgba8888 conversion failed (NPP error code: {})", status));
fmt::format("yuv420 to rgba8888 conversion failed (NPP error code: {})",
static_cast<int>(status)));
}
break;
}
Expand All @@ -781,7 +783,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou
status = nppiYUV420ToRGB_8u_P3C3R(in_yuv_ptrs, in_yuv_steps, out_tensor_ptr, dst_step, roi);
if (status != NPP_SUCCESS) {
throw std::runtime_error(
fmt::format("yuv420 to rgb888 conversion failed (NPP error code: {})", status));
fmt::format("yuv420 to rgb888 conversion failed (NPP error code: {})",
static_cast<int>(status)));
}
break;
}
Expand All @@ -800,7 +803,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou
nppiNV12ToRGB_709HDTV_8u_P2C3R(in_y_uv_ptrs, in_y_uv_step, out_tensor_ptr, dst_step, roi);
if (status != NPP_SUCCESS) {
throw std::runtime_error(
fmt::format("NV12 to rgb888 conversion failed (NPP error code: {})", status));
fmt::format("NV12 to rgb888 conversion failed (NPP error code: {})",
static_cast<int>(status)));
}
break;
}
Expand Down

0 comments on commit c29fe5c

Please sign in to comment.