Skip to content

acl/compression/track_error.h

#include "acl/compression/track_error.h"

The functions that measure the error between raw tracks and compressed tracks.

track_error

struct track_error

A struct that contains the track index that has the worst error, its error, and the sample time at which it happens.

track_error::index

uint32_t index = k_invalid_track_index;

The track index with the worst error.

track_error::error

float error = 0.0F;

The worst error for the track index. With transform tracks, it is in playback units, see track_array::get_playback_scale.

track_error::sample_time

float sample_time = 0.0F;

The sample time that has the worst error.

track_error::keyframe_index

uint32_t keyframe_index = 0;

The keyframe index that has the worst error.

calculate_compression_error

template<class decompression_context_type, acl_impl::is_decompression_context<decompression_context_type> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks,
    decompression_context_type& context)

Calculates the worst compression error between a raw track array and its compressed tracks. Supports scalar tracks only.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

template<class decompression_context_type, acl_impl::is_decompression_context<decompression_context_type> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks,
    decompression_context_type& context,
    const itransform_error_metric& error_metric)

Calculates the worst compression error between a raw track array and its compressed tracks. Supports scalar tracks, and transform tracks in local space only. Returns an invalid error when the transform tracks are not in local space.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

Deprecated

Use the overload with the compression settings instead, to be removed in v2.3

template<class decompression_context_type, acl_impl::is_decompression_context<decompression_context_type> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks,
    decompression_context_type& context,
    const itransform_error_metric& error_metric,
    const track_array& additive_base_tracks)

Calculates the worst compression error between a raw track array and its compressed tracks. Supports transform tracks (vqvf, vqf, or vqsf) in local space with an additive base. The additive base can have a different transform type than the raw tracks. Returns an invalid error when the transform tracks are not in local space.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

Deprecated

Use the overload with the compression settings instead, to be removed in v2.3

template<class decompression_context_type, acl_impl::is_decompression_context<decompression_context_type> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks,
    decompression_context_type& context,
    const compression_settings& settings)

Calculates the worst compression error between a raw track array and its compressed tracks. Supports scalar and transform tracks. With transform tracks, it measures the error as compression does with these settings and without a base, in the transform space of the raw tracks (see track_array::get_transform_space): with the legacy error metric when it is set, otherwise with the runtime transform type and the transform metric.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

template<class decompression_context_type, acl_impl::is_decompression_context<decompression_context_type> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks,
    decompression_context_type& context,
    const compression_settings& settings,
    const transform_base_desc_t& transform_base)

Calculates the worst compression error between a raw track array and its compressed tracks. Supports transform tracks (vqvf, vqf, or vqsf) with a base, see transform_base_desc_t. The base, if any, can have a different transform type than the raw tracks. It uses the transform space of the raw tracks, see track_array::get_transform_space. In mesh space, it measures the error of each transform without its parent transform, as compression does. It measures the error as compression does with these settings and this base: with the legacy error metric when it is set, otherwise with the runtime transform type and the transform metric. Returns an invalid error when the base is not valid.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

template<class decompression_context_type0, class decompression_context_type1, acl_impl::is_decompression_context<decompression_context_type0> = nullptr, acl_impl::is_decompression_context<decompression_context_type1> = nullptr>
track_error calculate_compression_error(
    iallocator& allocator,
    decompression_context_type0& context0,
    decompression_context_type1& context1)

Calculates the worst compression error between two compressed tracks instances. Supports scalar tracks only.

Note: This function uses SFINAE to prevent it from matching when it shouldn't.

track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks0,
    const track_array& raw_tracks1)

Calculates the worst compression error between two raw track arrays. Supports scalar tracks only.

track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks0,
    const track_array& raw_tracks1,
    const itransform_error_metric& error_metric)

Calculates the worst compression error between two raw track arrays. Supports scalar tracks, and transform tracks in local space only. Returns an invalid error when the transform tracks are not in local space.

Deprecated

Use the overload with the compression settings instead, to be removed in v2.3

track_error calculate_compression_error(
    iallocator& allocator,
    const track_array& raw_tracks0,
    const track_array& raw_tracks1,
    const compression_settings& settings)

Calculates the worst compression error between two raw track arrays. Supports scalar and transform tracks. With transform tracks, it measures the error as compression does with these settings and without a base, in the transform space of the track arrays. Both track arrays must have the same transform space. It uses the legacy error metric when it is set, otherwise with the runtime transform type and the transform metric.