Fix XTC grayscale mapping for dark/light gray pixels
Swap the grayscale values for pixel values 1 and 2 to match the cover's kXthToBmp mapping. Previously 1 mapped to 170 (light gray) and 2 to 85 (dark gray), now corrected to 1->85 (dark gray) and 2->170 (light gray). Use lookup table for clarity.
This commit is contained in:
+4
-3
@@ -432,9 +432,10 @@ bool Xtc::generateThumbBmp(int height) const {
|
|||||||
const uint8_t bit1 = (plane1[byteOffset] >> bitInByte) & 1;
|
const uint8_t bit1 = (plane1[byteOffset] >> bitInByte) & 1;
|
||||||
const uint8_t bit2 = (plane2[byteOffset] >> bitInByte) & 1;
|
const uint8_t bit2 = (plane2[byteOffset] >> bitInByte) & 1;
|
||||||
const uint8_t pixelValue = (bit1 << 1) | bit2;
|
const uint8_t pixelValue = (bit1 << 1) | bit2;
|
||||||
// Convert 2-bit (0-3) to grayscale: 0=black, 3=white
|
// pixelValue: 0=white, 1=dark gray, 2=light gray, 3=black —
|
||||||
// pixelValue: 0=white, 1=light gray, 2=dark gray, 3=black (XTC polarity)
|
// same semantics as the cover's kXthToBmp mapping above
|
||||||
grayValue = (3 - pixelValue) * 85; // 0->255, 1->170, 2->85, 3->0
|
static constexpr uint8_t kXthToGray[4] = {255, 85, 170, 0};
|
||||||
|
grayValue = kXthToGray[pixelValue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user