For some RGB chroma, the component layout comes from the mask. If the mask doesn't match they are not actually the same chroma.
This functions checks that it's actually the same layout, as expected in many places where the chroma equality is checked.
Some bits extracted from !4103 (closed).
VideoLAN code repository instance