Skip to content
Snippets Groups Projects
Commit a5505968 authored by Romain Vimont's avatar Romain Vimont
Browse files

opengl: simplify TexCoordsMaps in sampler

The input picture may contain padding, for two reasons:
 1. the rectangle defined by the picture_t offset and visible width and
    height may not cover the whole picture size;
 2. if the OpenGL API does not support NPOT textures, textures are
    created with power-of-two dimensions.

As a consequence, for sampling, the coordinates (between 0 and 1 in both
dimensions) must be transformed to take the padding into account.

These transformations were computed and performed per-plane. Therefore,
there were _n_ "TexCoordsMaps" matrices for a picture with _n_ planes.

However, these transformations are necessarily the same for all planes:
 1. the picture_t offset/sizes are defined for the whole picture (then
    scaled appropriately for each plane);
 2. since the ratio between different planes of the same pictures is
    always a power of two (e.g. in YUV 4:2:0, the size of U and V planes
    are half the size of the Y plane in both dimensions), this property
    holds even if we align the dimensions of each plane texture to the
    next power-of-two.

Therefore, use a single transformation matrix.
parent 304faab7
Branches master
No related tags found
No related merge requests found
Pipeline #137907 passed with stage
in 17 minutes and 43 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment