mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 03:08:05 +02:00
color-lcms: accept matrices with offset
Now that color mapping matrix in GL-renderer supports an offset, allow merging and translating matrix stages with offsets. color-icc-output test is already hitting these new paths with the sRGB->sRGB CLUT fixture (number 6), hence new tests are not needed. Previously, after optimization the pipeline still contained 3 consecutive matrix stages. Now, those three are combined into one. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
b15dcfe790
commit
5ca78cdf05
1 changed files with 8 additions and 20 deletions
|
|
@ -208,24 +208,11 @@ stage_matrix_get_mat4(const _cmsStageMatrixData *smd)
|
|||
}
|
||||
|
||||
static bool
|
||||
is_matrix_stage_with_zero_offset(const cmsStage *stage)
|
||||
is_matrix_stage(const cmsStage *stage)
|
||||
{
|
||||
const _cmsStageMatrixData *data;
|
||||
int rows;
|
||||
int r;
|
||||
|
||||
if (!stage || cmsStageType(stage) != cmsSigMatrixElemType)
|
||||
return false;
|
||||
|
||||
data = cmsStageData(stage);
|
||||
if (!data->Offset)
|
||||
return true;
|
||||
|
||||
rows = cmsStageOutputChannels(stage);
|
||||
for (r = 0; r < rows; r++)
|
||||
if (data->Offset[r] != 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +222,7 @@ is_identity_matrix_stage(const cmsStage *stage)
|
|||
const _cmsStageMatrixData *data;
|
||||
struct weston_mat4f M;
|
||||
|
||||
if (!is_matrix_stage_with_zero_offset(stage))
|
||||
if (!is_matrix_stage(stage))
|
||||
return false;
|
||||
|
||||
data = cmsStageData(stage);
|
||||
|
|
@ -287,8 +274,7 @@ merge_matrices(cmsPipeline **lut, cmsContext context_id)
|
|||
|
||||
elem = cmsPipelineGetPtrToFirstStage(*lut);
|
||||
do {
|
||||
if (is_matrix_stage_with_zero_offset(prev) &&
|
||||
is_matrix_stage_with_zero_offset(elem)) {
|
||||
if (is_matrix_stage(prev) && is_matrix_stage(elem)) {
|
||||
/* replace the two matrices with a merged one */
|
||||
prev = multiply_matrix_stages(context_id, elem, prev);
|
||||
if (freeme)
|
||||
|
|
@ -973,9 +959,6 @@ translate_matrix_element(struct weston_color_mapping *map, cmsStage *elem)
|
|||
_cmsStageMatrixData *data = cmsStageData(elem);
|
||||
int c, r;
|
||||
|
||||
if (!is_matrix_stage_with_zero_offset(elem))
|
||||
return false;
|
||||
|
||||
if (cmsStageInputChannels(elem) != 3 ||
|
||||
cmsStageOutputChannels(elem) != 3)
|
||||
return false;
|
||||
|
|
@ -990,6 +973,11 @@ translate_matrix_element(struct weston_color_mapping *map, cmsStage *elem)
|
|||
for (r = 0; r < 3; r++)
|
||||
map->u.mat.matrix.col[c].el[r] = data->Double[r * 3 + c];
|
||||
|
||||
if (data->Offset) {
|
||||
for (r = 0; r < 3; r++)
|
||||
map->u.mat.offset.el[r] = data->Offset[r];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue