phoboslab / qoi

The “Quite OK Image Format” for fast, lossless image compression
MIT License
6.92k stars 330 forks source link

Typo in the specification about color differences? #161

Closed mhermier closed 2 years ago

mhermier commented 2 years ago

Hi, I was toying with the spec to implement an encoder and it says: https://github.com/phoboslab/qoi/blob/a27f8ed4593ffad272b70030bf1ef3010d0803e1/qoi.h#L169-L177

Unless I'm mistaken, the dr_dg and db_dg indicates that the difference of colors is made using last_px (which should maybe be renamed as prev_px for clarity) minus cur_px, but in the reference implementation we can see that it seems to be the other way around: https://github.com/phoboslab/qoi/blob/a27f8ed4593ffad272b70030bf1ef3010d0803e1/qoi.h#L460-L465

phoboslab commented 2 years ago

That is rather unfortunate. At least the wording was correct ("difference from the previous pixel"). I hope nobody followed that example verbatim...

Thanks for the notice!