Fix example in QOI_OP_LUMA documentation; close #161

This commit is contained in:
Dominic Szablewski 2022-01-05 16:51:38 +01:00
parent a27f8ed459
commit 6804a745e4

4
qoi.h
View File

@ -173,8 +173,8 @@ The alpha value remains unchanged from the previous pixel.
The green channel is used to indicate the general direction of change and is The green channel is used to indicate the general direction of change and is
encoded in 6 bits. The red and blue channels (dr and db) base their diffs off encoded in 6 bits. The red and blue channels (dr and db) base their diffs off
of the green channel difference and are encoded in 4 bits. I.e.: of the green channel difference and are encoded in 4 bits. I.e.:
dr_dg = (last_px.r - cur_px.r) - (last_px.g - cur_px.g) dr_dg = (cur_px.r - prev_px.r) - (cur_px.g - prev_px.g)
db_dg = (last_px.b - cur_px.b) - (last_px.g - cur_px.g) db_dg = (cur_px.b - prev_px.b) - (cur_px.g - prev_px.g)
The difference to the current channel values are using a wraparound operation, The difference to the current channel values are using a wraparound operation,
so "10 - 13" will result in 253, while "250 + 7" will result in 1. so "10 - 13" will result in 253, while "250 + 7" will result in 1.