Optimize luminance calculation for rotation animation
- Apply sampling for the border to reduce the amonut of pixel
for calculating luminance.
- Use getInt to get color rather than get a byte 4 times.
- Use a simpler formula to approximate luminance.
- Replace median with mode to represent the luminance. It is more
efficient (no need sort) and the visual result may be better if
the distribution is U-shaped.
- Extract common code to policy package to reduce duplicated
code in system server and shell.
The calculation is 10 times faster for the first execution,
and 5 times faster on average.
Bug: 253610885
Test: atest RotationAnimationUtilsTest
Change-Id: Ieca9968e843b68d733e178edd725b628c542e872
6 files changed