Skip to content

Commit

Permalink
fix: use as_scalar where possible to avoid deprecated usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrechette committed Feb 6, 2024
1 parent c87aac0 commit d73d4b1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions includes/acl/compression/impl/rigid_shell_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ namespace acl
const rtm::vector4f raw_vtx1 = rtm::qvv_mul_point3(vtx1, raw_transform);
const rtm::vector4f raw_vtx2 = rtm::qvv_mul_point3(vtx2, raw_transform);

const rtm::scalarf vtx0_distance = rtm::vector_length3(raw_vtx0);
const rtm::scalarf vtx1_distance = rtm::vector_length3(raw_vtx1);
const rtm::scalarf vtx2_distance = rtm::vector_length3(raw_vtx2);
const rtm::scalarf vtx0_distance = rtm::vector_length3_as_scalar(raw_vtx0);
const rtm::scalarf vtx1_distance = rtm::vector_length3_as_scalar(raw_vtx1);
const rtm::scalarf vtx2_distance = rtm::vector_length3_as_scalar(raw_vtx2);

const rtm::scalarf transform_length = rtm::scalar_max(rtm::scalar_max(vtx0_distance, vtx1_distance), vtx2_distance);
parent_shell_distance = rtm::scalar_max(parent_shell_distance, transform_length);
Expand Down Expand Up @@ -245,9 +245,9 @@ namespace acl
const rtm::vector4f raw_vtx1 = rtm::qvv_mul_point3(vtx1, raw_transform);
const rtm::vector4f raw_vtx2 = rtm::qvv_mul_point3(vtx2, raw_transform);

const rtm::scalarf vtx0_distance = rtm::vector_length3(raw_vtx0);
const rtm::scalarf vtx1_distance = rtm::vector_length3(raw_vtx1);
const rtm::scalarf vtx2_distance = rtm::vector_length3(raw_vtx2);
const rtm::scalarf vtx0_distance = rtm::vector_length3_as_scalar(raw_vtx0);
const rtm::scalarf vtx1_distance = rtm::vector_length3_as_scalar(raw_vtx1);
const rtm::scalarf vtx2_distance = rtm::vector_length3_as_scalar(raw_vtx2);

const rtm::scalarf transform_length = rtm::scalar_max(rtm::scalar_max(vtx0_distance, vtx1_distance), vtx2_distance);
parent_shell_distance = rtm::scalar_max(parent_shell_distance, transform_length);
Expand Down
8 changes: 4 additions & 4 deletions includes/acl/compression/impl/track_array.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ namespace acl
ACL_ASSERT(rounding_policy_ != sample_rounding_policy::per_track, "track_writer::get_rounding_policy() cannot return per_track");
const float alpha = interpolation_alpha_per_policy[static_cast<int>(rounding_policy_)];

const rtm::scalarf value0 = rtm::scalar_load(&track__[key_frame0]);
const rtm::scalarf value1 = rtm::scalar_load(&track__[key_frame1]);
const rtm::scalarf value0 = rtm::scalar_load_as_scalar(&track__[key_frame0]);
const rtm::scalarf value1 = rtm::scalar_load_as_scalar(&track__[key_frame1]);
const rtm::scalarf value = rtm::scalar_lerp(value0, value1, rtm::scalar_set(alpha));
writer.write_float1(track_index, value);
}
Expand Down Expand Up @@ -371,8 +371,8 @@ namespace acl
{
const track_float1f& track__ = track_cast<track_float1f>(track_);

const rtm::scalarf value0 = rtm::scalar_load(&track__[key_frame0]);
const rtm::scalarf value1 = rtm::scalar_load(&track__[key_frame1]);
const rtm::scalarf value0 = rtm::scalar_load_as_scalar(&track__[key_frame0]);
const rtm::scalarf value1 = rtm::scalar_load_as_scalar(&track__[key_frame1]);
const rtm::scalarf value = rtm::scalar_lerp(value0, value1, rtm::scalar_set(interpolation_alpha));
writer.write_float1(track_index, value);
break;
Expand Down
2 changes: 1 addition & 1 deletion includes/acl/compression/impl/track_list_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace acl
for (uint32_t sample_index = 0; sample_index < num_samples; ++sample_index)
{
const vector4f sample = vector_load1(&typed_ref_track[sample_index]);
are_samples_valid &= scalar_is_finite(scalarf(vector_get_x(sample)));
are_samples_valid &= scalar_is_finite(vector_get_x_as_scalar(sample));
track[sample_index] = sample;
}
out_track = std::move(track);
Expand Down
16 changes: 8 additions & 8 deletions includes/acl/compression/transform_error_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ namespace acl
const rtm::vector4f lossy_vtx1 = rtm::qvv_mul_point3(vtx1, lossy_transform_);
const rtm::vector4f lossy_vtx2 = rtm::qvv_mul_point3(vtx2, lossy_transform_);

const rtm::scalarf vtx0_error = rtm::vector_distance3(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3(raw_vtx1, lossy_vtx1);
const rtm::scalarf vtx2_error = rtm::vector_distance3(raw_vtx2, lossy_vtx2);
const rtm::scalarf vtx0_error = rtm::vector_distance3_as_scalar(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3_as_scalar(raw_vtx1, lossy_vtx1);
const rtm::scalarf vtx2_error = rtm::vector_distance3_as_scalar(raw_vtx2, lossy_vtx2);

return rtm::scalar_max(rtm::scalar_max(vtx0_error, vtx1_error), vtx2_error);
}
Expand All @@ -371,8 +371,8 @@ namespace acl
const rtm::vector4f lossy_vtx0 = rtm::qvv_mul_point3_no_scale(vtx0, lossy_transform_);
const rtm::vector4f lossy_vtx1 = rtm::qvv_mul_point3_no_scale(vtx1, lossy_transform_);

const rtm::scalarf vtx0_error = rtm::vector_distance3(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3(raw_vtx1, lossy_vtx1);
const rtm::scalarf vtx0_error = rtm::vector_distance3_as_scalar(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3_as_scalar(raw_vtx1, lossy_vtx1);

return rtm::scalar_max(vtx0_error, vtx1_error);
}
Expand Down Expand Up @@ -453,9 +453,9 @@ namespace acl
const rtm::vector4f lossy_vtx1 = rtm::matrix_mul_point3(vtx1, lossy_transform_);
const rtm::vector4f lossy_vtx2 = rtm::matrix_mul_point3(vtx2, lossy_transform_);

const rtm::scalarf vtx0_error = rtm::vector_distance3(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3(raw_vtx1, lossy_vtx1);
const rtm::scalarf vtx2_error = rtm::vector_distance3(raw_vtx2, lossy_vtx2);
const rtm::scalarf vtx0_error = rtm::vector_distance3_as_scalar(raw_vtx0, lossy_vtx0);
const rtm::scalarf vtx1_error = rtm::vector_distance3_as_scalar(raw_vtx1, lossy_vtx1);
const rtm::scalarf vtx2_error = rtm::vector_distance3_as_scalar(raw_vtx2, lossy_vtx2);

return rtm::scalar_max(rtm::scalar_max(vtx0_error, vtx1_error), vtx2_error);
}
Expand Down
12 changes: 6 additions & 6 deletions includes/acl/decompression/impl/decompression.scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ namespace acl
rtm::scalarf value;
if (num_bits_per_component == 0) // Constant bit rate
{
value = rtm::scalar_load(constant_values);
value = rtm::scalar_load_as_scalar(constant_values);
constant_values += 1;
}
else
Expand All @@ -301,8 +301,8 @@ namespace acl
value0 = unpack_scalarf_uXX_unsafe(num_bits_per_component, animated_values, track_bit_offset0);
value1 = unpack_scalarf_uXX_unsafe(num_bits_per_component, animated_values, track_bit_offset1);

const rtm::scalarf range_min = rtm::scalar_load(range_values);
const rtm::scalarf range_extent = rtm::scalar_load(range_values + 1);
const rtm::scalarf range_min = rtm::scalar_load_as_scalar(range_values);
const rtm::scalarf range_extent = rtm::scalar_load_as_scalar(range_values + 1);
value0 = rtm::scalar_mul_add(value0, range_extent, range_min);
value1 = rtm::scalar_mul_add(value1, range_extent, range_min);
range_values += 2;
Expand Down Expand Up @@ -548,7 +548,7 @@ namespace acl
{
rtm::scalarf value;
if (num_bits_per_component == 0) // Constant bit rate
value = rtm::scalar_load(constant_values);
value = rtm::scalar_load_as_scalar(constant_values);
else
{
rtm::scalarf value0;
Expand All @@ -563,8 +563,8 @@ namespace acl
value0 = unpack_scalarf_uXX_unsafe(num_bits_per_component, animated_values, context.key_frame_bit_offsets[0] + track_bit_offset);
value1 = unpack_scalarf_uXX_unsafe(num_bits_per_component, animated_values, context.key_frame_bit_offsets[1] + track_bit_offset);

const rtm::scalarf range_min = rtm::scalar_load(range_values);
const rtm::scalarf range_extent = rtm::scalar_load(range_values + num_element_components);
const rtm::scalarf range_min = rtm::scalar_load_as_scalar(range_values);
const rtm::scalarf range_extent = rtm::scalar_load_as_scalar(range_values + num_element_components);
value0 = rtm::scalar_mul_add(value0, range_extent, range_min);
value1 = rtm::scalar_mul_add(value1, range_extent, range_min);
}
Expand Down

0 comments on commit d73d4b1

Please sign in to comment.