Skip to content

Calculate transform matrices at compile-time #24

@FreezyLemon

Description

@FreezyLemon

src/yuv_rgb/color.rs has quite a bit of code that can logically be const-evaluated.

Basically, get_rgb_to_yuv_matrix and get_yuv_to_rgb_matrix (which is the first function plus 1 step) can be simplified into lookups of 3x3 matrices based only on the MatrixCoefficients and ColorPrimaries.

This could either be done by moving the calculation code into a build script (similar to this PR in ssimulacra2), or by using soft floats (e.g. const_soft_float and/or constgebra).

This could also allow removing the nalgebra dependency, since the only nalgebra code that really needs to run at runtime is the pix_vector * transform_matrix multiplication, which can be ported to a trivial helper function (because the dimensions are always the same).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions