diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc index 41949f220a3..c29589c5db7 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc @@ -719,7 +719,7 @@ Status NormalizePad(const std::shared_ptr &input, std::shared_ptrGetItemAt(&mean_c, {i})); RETURN_IF_NOT_OK(std->GetItemAt(&std_c, {i})); diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc index d614edcf229..ca46fd66413 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc @@ -44,8 +44,8 @@ static double GetDet3(double *src) { return a1 - a2 + a3; } -static uint8_t IntToUChar(const int &v) { - return static_cast(static_cast(v) <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); +static uint8_t UIntToUChar(const uint32_t &v) { + return static_cast(v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } static int16_t IntCastShort(const int &value) { @@ -121,7 +121,7 @@ static const void *InitWBlock() { return (const void *)iWBlock; } -static uint8_t CastToFixed(int v) { return IntToUChar(((v + (1 << (BITS1 - 1))) >> BITS1)); } +static uint8_t CastToFixed(int v) { return UIntToUChar((static_cast(v + (1 << (BITS1 - 1))) >> BITS1)); } static int BorderPolate(int value, int length, PaddBorderType borderType) { if (static_cast(value) < static_cast(length)) {