Fix range in Image* classes (#3429)

This commit is contained in:
Flössie
2016-09-17 17:32:46 +02:00
parent cb034284be
commit 309b823f93
3 changed files with 32 additions and 32 deletions

View File

@@ -333,11 +333,11 @@ Imagefloat::to8()
#pragma omp parallel for schedule(static)
#endif
for ( int h = 0; h < height; ++h ) {
for ( int w = 0; w < width; ++w ) {
img8->r(h, w) = (unsigned char)( (unsigned short)(r(h, w)) >> 8);
img8->g(h, w) = (unsigned char)( (unsigned short)(g(h, w)) >> 8);
img8->b(h, w) = (unsigned char)( (unsigned short)(b(h, w)) >> 8);
for (int h = 0; h < height; ++h) {
for (int w = 0; w < width; ++w) {
img8->r(h, w) = static_cast<unsigned short>(r(h, w)) / 257;
img8->g(h, w) = static_cast<unsigned short>(g(h, w)) / 257;
img8->b(h, w) = static_cast<unsigned short>(b(h, w)) / 257;
}
}
@@ -352,11 +352,11 @@ Imagefloat::to16()
#pragma omp parallel for schedule(static)
#endif
for ( int h = 0; h < height; ++h ) {
for ( int w = 0; w < width; ++w ) {
img16->r( h, w) = (unsigned short)(r(h, w));
img16->g( h, w) = (unsigned short)(g(h, w));
img16->b( h, w) = (unsigned short)(b(h, w));
for (int h = 0; h < height; ++h) {
for (int w = 0; w < width; ++w) {
img16->r(h, w) = r(h, w);
img16->g(h, w) = g(h, w);
img16->b(h, w) = b(h, w);
}
}