diff --git a/modules/core/src/image/vpImageConvert_yuv.cpp b/modules/core/src/image/vpImageConvert_yuv.cpp index cea2ebd02a..dd78882f11 100644 --- a/modules/core/src/image/vpImageConvert_yuv.cpp +++ b/modules/core/src/image/vpImageConvert_yuv.cpp @@ -44,14 +44,13 @@ namespace { void vpSAT(int &c) { - if (c & (~255)) { - if (c < 0) { - c = 0; - } - else { - const unsigned int val_255 = 255; - c = val_255; - } + const unsigned int val_255 = 255; + if (c < 0) { + c = 0; + } + else if (c > val_255) { + + c = val_255; } } };