Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45235 )
Change subject: libpayload: cbgfx: Fix 'equals' counter for Lanczos resampling ......................................................................
Patch Set 4: Code-Review+2
(2 comments)
https://review.coreboot.org/c/coreboot/+/45235/3/payloads/libpayload/drivers... File payloads/libpayload/drivers/video/graphics.c:
https://review.coreboot.org/c/coreboot/+/45235/3/payloads/libpayload/drivers... PS3, Line 882: sample[sx][sy] = *last_sample;
- The sample array for 0 <= sx < S0 needs to be initialized first, since the case 'sx - S0 >= dim_org->width' will need these values (another bug in the original implementation).
I wrote this under the assumption that images are always at least one pixel wide and high (otherwise parse_bitmap_header_v3() exits earlier), so for sx == S0 the check for sx - S0 >= dim_org->width can never be true. So I don't think that was another bug... it can't reach over the end of the image on the left while trying to fill values beyond the end of the image on the right, there's at least one pixel actual image in between that it would use instead.
The way you wrote it now is the way I would've expected you to write it, so yeah, let's just stick with that.
https://review.coreboot.org/c/coreboot/+/45235/4/payloads/libpayload/drivers... File payloads/libpayload/drivers/video/graphics.c:
https://review.coreboot.org/c/coreboot/+/45235/4/payloads/libpayload/drivers... PS4, Line 883: equals > 0 nit: This extra check is unnecessary since i can never equal -1 (which actually ends up being 0xff because the type is unsigned). You could've also just left last_equal to get initialized to ypix[0][0] as it was before, since that's the right value for the first pixel (and then we'd just equals++ here).
But no big difference either way.