diff --git a/src/apps/others/ojph_img_io.cpp b/src/apps/others/ojph_img_io.cpp index 7dcdd4b..d3211d7 100644 --- a/src/apps/others/ojph_img_io.cpp +++ b/src/apps/others/ojph_img_io.cpp @@ -660,7 +660,7 @@ namespace ojph { if (shift) for (ui32 i = width; i > 0; --i, sp += num_comps) { - ui32 v = *(ui32*)sp; + si32 v = *(si32*)sp; v >>= shift; *dp++ = *(float*)&v; } @@ -675,8 +675,9 @@ namespace ojph { if (shift) for (ui32 i = width; i > 0; --i, sp += num_comps) { ui32 v = be2le(*(ui32*)sp); - v >>= shift; - *dp++ = *(float*)&v; + si32 u = *(si32*)&v; + u >>= shift; + *dp++ = *(float*)&u; } else for (ui32 i = width; i > 0; --i, sp += num_comps) { diff --git a/src/core/transform/ojph_colour.cpp b/src/core/transform/ojph_colour.cpp index 34161d4..ca96d2d 100644 --- a/src/core/transform/ojph_colour.cpp +++ b/src/core/transform/ojph_colour.cpp @@ -214,7 +214,7 @@ namespace ojph { { for (ui32 i = width; i > 0; --i) { const si32 v = *sp++; - *dp++ = v > 0 ? v : (- v - shift); + *dp++ = v >= 0 ? v : (- v - shift); } }