Fix incorrect 16-to-8 monochrome YUV conversion
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10bc485..2b79ef9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
# Changed
* Only ever create one iref box, filled with multiple cdsc boxes (#247)
+* Fix incorrect 16-to-8 monochrome YUV conversion
## [0.8.0] - 2020-07-14
diff --git a/src/reformat.c b/src/reformat.c
index e4696b4..b8a25e9 100644
--- a/src/reformat.c
+++ b/src/reformat.c
@@ -706,9 +706,9 @@
const float Gc = AVIF_CLAMP(G, 0.0f, 1.0f);
const float Bc = AVIF_CLAMP(B, 0.0f, 1.0f);
- *((uint16_t *)ptrR) = (uint16_t)(0.5f + (Rc * rgbMaxChannel));
- *((uint16_t *)ptrG) = (uint16_t)(0.5f + (Gc * rgbMaxChannel));
- *((uint16_t *)ptrB) = (uint16_t)(0.5f + (Bc * rgbMaxChannel));
+ *ptrR = (uint8_t)(0.5f + (Rc * rgbMaxChannel));
+ *ptrG = (uint8_t)(0.5f + (Gc * rgbMaxChannel));
+ *ptrB = (uint8_t)(0.5f + (Bc * rgbMaxChannel));
ptrR += rgbPixelBytes;
ptrG += rgbPixelBytes;