* Refactor caching for matrix transformations to reuse it for rgb matrices. PiperOrigin-RevId: 473042194 (cherry picked from commit 593370bb)