Bug 1683574 - Remove some unconditional conditionals. r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D100214
This commit is contained in:
Jeff Muizelaar 2020-12-20 23:00:11 +00:00
Родитель b009d543ab
Коммит 7ec698fd1c
2 изменённых файлов: 60 добавлений и 71 удалений

Просмотреть файл

@ -726,54 +726,44 @@ fn modular_transform_create_lut(mut lut: &lutType) -> Option<Box<qcms_modular_tr
// Prepare input curves
transform = modular_transform_alloc();
if !transform.is_none() {
if true {
transform.as_mut().unwrap().input_clut_table_r = Some(
(*lut).input_table[0..(*lut).num_input_table_entries as usize].to_vec(),
);
transform.as_mut().unwrap().input_clut_table_g = Some(
(*lut).input_table[(*lut).num_input_table_entries as usize
..(*lut).num_input_table_entries as usize * 2]
.to_vec(),
);
transform.as_mut().unwrap().input_clut_table_b = Some(
(*lut).input_table[(*lut).num_input_table_entries as usize * 2
..(*lut).num_input_table_entries as usize * 3]
.to_vec(),
);
transform.as_mut().unwrap().input_clut_table_length =
(*lut).num_input_table_entries;
// Prepare table
clut_length = ((*lut).num_clut_grid_points as usize).pow(3) * 3;
if true {
assert_eq!(clut_length, lut.clut_table.len());
transform.as_mut().unwrap().clut = Some((*lut).clut_table.clone());
transform.as_mut().unwrap().input_clut_table_r =
Some((*lut).input_table[0..(*lut).num_input_table_entries as usize].to_vec());
transform.as_mut().unwrap().input_clut_table_g = Some(
(*lut).input_table[(*lut).num_input_table_entries as usize
..(*lut).num_input_table_entries as usize * 2]
.to_vec(),
);
transform.as_mut().unwrap().input_clut_table_b = Some(
(*lut).input_table[(*lut).num_input_table_entries as usize * 2
..(*lut).num_input_table_entries as usize * 3]
.to_vec(),
);
transform.as_mut().unwrap().input_clut_table_length =
(*lut).num_input_table_entries;
// Prepare table
clut_length = ((*lut).num_clut_grid_points as usize).pow(3) * 3;
assert_eq!(clut_length, lut.clut_table.len());
transform.as_mut().unwrap().clut = Some((*lut).clut_table.clone());
transform.as_mut().unwrap().grid_size = (*lut).num_clut_grid_points as u16;
// Prepare output curves
if true {
transform.as_mut().unwrap().output_clut_table_r = Some(
(*lut).output_table[0..(*lut).num_output_table_entries as usize]
.to_vec(),
);
transform.as_mut().unwrap().output_clut_table_g = Some(
(*lut).output_table[(*lut).num_output_table_entries as usize
..(*lut).num_output_table_entries as usize * 2]
.to_vec(),
);
transform.as_mut().unwrap().output_clut_table_b = Some(
(*lut).output_table[(*lut).num_output_table_entries as usize * 2
..(*lut).num_output_table_entries as usize * 3]
.to_vec(),
);
transform.as_mut().unwrap().output_clut_table_length =
(*lut).num_output_table_entries;
transform.as_mut().unwrap().transform_module_fn =
Some(transform_module_clut);
append_transform(transform, next_transform);
return first_transform;
}
}
}
transform.as_mut().unwrap().grid_size = (*lut).num_clut_grid_points as u16;
// Prepare output curves
transform.as_mut().unwrap().output_clut_table_r =
Some((*lut).output_table[0..(*lut).num_output_table_entries as usize].to_vec());
transform.as_mut().unwrap().output_clut_table_g = Some(
(*lut).output_table[(*lut).num_output_table_entries as usize
..(*lut).num_output_table_entries as usize * 2]
.to_vec(),
);
transform.as_mut().unwrap().output_clut_table_b = Some(
(*lut).output_table[(*lut).num_output_table_entries as usize * 2
..(*lut).num_output_table_entries as usize * 3]
.to_vec(),
);
transform.as_mut().unwrap().output_clut_table_length =
(*lut).num_output_table_entries;
transform.as_mut().unwrap().transform_module_fn = Some(transform_module_clut);
append_transform(transform, next_transform);
return first_transform;
}
}
}

Просмотреть файл

@ -1120,33 +1120,32 @@ fn transform_precacheLUT_float(
let mut src = Vec::with_capacity(lutSize as usize);
let mut dest = vec![0.; lutSize as usize];
if true && true {
/* Prepare a list of points we want to sample */
for x in 0..samples {
for y in 0..samples {
for z in 0..samples {
src.push(x as i32 as f32 / (samples - 1) as f32);
src.push(y as i32 as f32 / (samples - 1) as f32);
src.push(z as i32 as f32 / (samples - 1) as f32);
}
/* Prepare a list of points we want to sample */
for x in 0..samples {
for y in 0..samples {
for z in 0..samples {
src.push(x as i32 as f32 / (samples - 1) as f32);
src.push(y as i32 as f32 / (samples - 1) as f32);
src.push(z as i32 as f32 / (samples - 1) as f32);
}
}
let lut = chain_transform(in_0, out, src, dest, lutSize as usize);
if let Some(lut) = lut {
(*transform).clut = Some(lut);
(*transform).grid_size = samples as u16;
if in_type == DATA_RGBA_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_rgba)
} else if in_type == DATA_BGRA_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_bgra)
} else if in_type == DATA_RGB_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_rgb)
}
debug_assert!((*transform).transform_fn.is_some());
} else {
return None;
}
}
let lut = chain_transform(in_0, out, src, dest, lutSize as usize);
if let Some(lut) = lut {
(*transform).clut = Some(lut);
(*transform).grid_size = samples as u16;
if in_type == DATA_RGBA_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_rgba)
} else if in_type == DATA_BGRA_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_bgra)
} else if in_type == DATA_RGB_8 {
(*transform).transform_fn = Some(qcms_transform_data_tetra_clut_rgb)
}
debug_assert!((*transform).transform_fn.is_some());
} else {
return None;
}
return Some(transform);
}