Closed curioustorvald closed 3 years ago
Regarding the operator >=
: if a>b
and b-a
is smaller than 2/256 in RGB, then a==b
.
To put it simply, break the recursion when the difference is tiny.
Another idea: convert RGBA into YOU-A, where the conversion matrix is:
[ 3 4 1] [R] [Y]
.125 * [-2 -2 4] [G] = [O]
[ 4 -3 -1] [B] [U]
and subsample O and U in the ratio of 4:2:0. You can also subsample Y in the ratio of 4:2:2 and offset to X position by 1. For the A-channel, it can use either of the methods.
When calculating, subsampled O and U channels will have smaller number of tiles to update. However, custom codes need to be written to handle subsampled channels.
The conversion matrix: use YCoCg-R instead. Wikipedia has optimized implementation that cuts number of computations from 9 to 4.
The new light simulator has been deployed (see branch 'NEWLIGHT2'), closing the issue.