Skip to content

acl/compression/compression_settings.h

#include "acl/compression/compression_settings.h"

The compression settings and the functions that return the default settings.

compression_database_settings

struct compression_database_settings

Encapsulates all the compression settings related to database usage.

compression_database_settings::medium_importance_tier_proportion

float medium_importance_tier_proportion = 0.0F;

What proportions we should use when distributing our frames based on their importance to the overall error contribution. If a sample doesn't go into the medium or low importance tiers, it will end up in the high importance tier stored within each compressed track instance. Proportion values must be between 0.0 and 1.0 and their sum as well. If the sum is less than 1.0, remaining frames are considered to have high importance. A low importance proportion of 30% means that the least important 30% of frames will end up in that corresponding database tier. Note that only movable frames can end up in the database as some frames must remain within the compressed track instance. A frame is movable if it isn't the first or last frame of its segment.

Defaults to 0.0 (the medium importance tier is empty)

compression_database_settings::low_importance_tier_proportion

float low_importance_tier_proportion = 0.5F;

See medium_importance_tier_proportion for details.

Defaults to 0.5 (the least important 50% of frames are moved to the database)

compression_database_settings::max_chunk_size

uint32_t max_chunk_size = 1 * 1024 * 1024;

How large should each chunk be, in bytes. This value must be at least 4 KB and ideally it should be a multiple of the virtual memory page size used on the platform that will decompress from the database.

Defaults to 1 MB.

compression_database_settings::get_hash

uint32_t get_hash() const

Calculates a hash from the internal state to uniquely identify a configuration.

compression_database_settings::is_valid

error_result is_valid() const

Checks if everything is valid and if it isn't, returns an error string. Returns nullptr if the settings are valid.

compression_metadata_settings

struct compression_metadata_settings

Encapsulates all the optional metadata compression settings.

compression_metadata_settings::include_track_list_name

bool include_track_list_name = false;

Whether to include the optional metadata for the track list name

Defaults to false

compression_metadata_settings::include_track_names

bool include_track_names = false;

Whether to include the optional metadata for track names

Defaults to false

compression_metadata_settings::include_parent_track_indices

bool include_parent_track_indices = false;

Whether to include the optional metadata for parent track indices Transform tracks only

Defaults to false

compression_metadata_settings::include_track_descriptions

bool include_track_descriptions = false;

Whether to include the optional metadata for track descriptions For transforms, also enables the parent track indices metadata

Defaults to false

compression_metadata_settings::include_contributing_error

bool include_contributing_error = false;

Whether to include the optional metadata for the contributing error of each frame. These are sorted from lowest to largest error. This is required when the compressed tracks will later be merged into a database. Transform tracks only

Defaults to false

compression_metadata_settings::get_hash

uint32_t get_hash() const

Calculates a hash from the internal state to uniquely identify a configuration.

compression_metadata_settings::is_valid

error_result is_valid() const

Checks if everything is valid and if it isn't, returns an error string. Returns nullptr if the settings are valid.

compression_keyframe_stripping_settings

struct compression_keyframe_stripping_settings

Encapsulates all frame stripping compression settings. A keyframe represents all samples at a particular point in time. Keyframe stripping is a destructive process and visual fidelity can degrade considerably. If a keyframe is identified as a stripping candidate, it is entirely removed and reconstructed through linear interpolation of its remaining neighbors. This is destructive unless the keyframe can be reconstructed below the desired precision threshold, in which case it is a trivial keyframe.

Removing whole keyframes ensures that decompression remains very fast. However, enabling keyframe stripping does add a fixed amount of overhead during decompression. This overhead should be below 200 instructions and be on the order of nanoseconds depending on the processor and its clock speed.

Note that stripping is not always appropriate and it may yield unacceptable results. Here are known problematic scenarios:

  • high velocity animations can lose a lot of momentum, yielding a swimming- like motion
  • synchronized animations can become out of sync if keyframes are unevenly removed leading to missed contacts
  • contacts and motion apex can be missed if key keyframes are removed

Transform tracks only.

compression_keyframe_stripping_settings::is_enabled

bool is_enabled() const

Returns whether or not keyframe stripping is enabled. Keyframe stripping is enabled when either proportion or threshold or both are enabled. See [compression_keyframe_stripping_settings] for details.

Defaults to false

compression_keyframe_stripping_settings::proportion

float proportion = 0.0F;

The minimum proportion of keyframes that should be stripped. Proportion value must be between 0.0 and 1.0.

Defaults to 0.0 (no stripping)

compression_keyframe_stripping_settings::threshold

float threshold = 0.0F;

The threshold error below which to strip keyframes. Keyframes that yield an error below or equal to this threshold will be removed. Keyframes that contribute more error than the threshold are retained. The threshold is in playback units, as the precision: see track_array::get_playback_scale.

Defaults to 0.0 centimeters (no stripping)

compression_keyframe_stripping_settings::strip_trivial

bool strip_trivial = false;

Whether or not to strip trivial keyframes. If the error introduced by removing a keyframe is below the precision threshold for every transform, it is trivial. It means that if we reconstruct the stripped keyframe, the error introduced is below our precision threshold.

Note that if you intend to use per-track rounding during decompression, you should keep this feature disabled. See sample_rounding_policy::per_track for details.

Defaults to false (no stripping)

compression_keyframe_stripping_settings::get_hash

uint32_t get_hash() const

Calculates a hash from the internal state to uniquely identify a configuration.

compression_keyframe_stripping_settings::is_valid

error_result is_valid() const

Checks if everything is valid and if it isn't, returns an error string. Returns nullptr if the settings are valid.

compression_settings

struct compression_settings

Encapsulates all the compression settings.

Level and formats

compression_settings::level
compression_level8 level = compression_level8::low;

The compression level determines how aggressively we attempt to reduce the memory footprint. Higher levels will try more permutations and bit rates. The higher the level, the slower the compression but the smaller the memory footprint. Transform tracks only.

compression_settings::rotation_format
rotation_format8 rotation_format = rotation_format8::quatf_full;

The rotation, translation, and scale formats to use. See functions get_rotation_format(..) and get_vector_format(..)

Defaults to raw: quatf_full and vector3f_full Transform tracks only.

compression_settings::translation_format
vector_format8 translation_format = vector_format8::vector3f_full;

The rotation, translation, and scale formats to use. See functions get_rotation_format(..) and get_vector_format(..)

Defaults to raw: quatf_full and vector3f_full Transform tracks only.

compression_settings::scale_format
vector_format8 scale_format = vector_format8::vector3f_full;

The rotation, translation, and scale formats to use. See functions get_rotation_format(..) and get_vector_format(..)

Defaults to raw: quatf_full and vector3f_full Transform tracks only.

compression_settings::scalar_format
scalar_format8 scalar_format = scalar_format8::scalarf_full;

The format of the scalar track samples. See functions get_scalar_format(..) With scalarf_full, each animated track keeps its samples with full precision. With scalarf_variable, each animated track uses the lowest bit rate that keeps its precision.

Defaults to raw: scalarf_full Scalar tracks only.

Error measurement

compression_settings::transform_runtime_type
transform_runtime_type_t transform_runtime_type = transform_runtime_type_t::automatic;

The runtime transform type: the type that compression uses to compose transforms into object space and to measure the error. Select the type that your runtime uses to compose transforms. See transform_runtime_type_t.

When a clip has no scale, compression uses vqf in place of a built-in type: without scale, each built-in runtime transform type gives the same transforms. Compression always uses a custom transform adapter, also without scale.

With automatic, compression selects the type from the raw tracks:

  • vqsf for vqsf raw tracks, when the additive base (if any) has a uniform scale
  • vqmf otherwise: it keeps the shear and gives exact object space transforms With custom, compression uses custom_transform_adapter. You can select vqsf only with vqsf raw tracks.

Defaults to automatic. Transform tracks only.

compression_settings::custom_transform_adapter
itransform_adapter* custom_transform_adapter = nullptr;

The transform adapter of your own runtime transform type. Set it only with the custom runtime transform type.

Defaults to null. Transform tracks only.

compression_settings::transform_metric
itransform_metric* transform_metric = nullptr;

The transform metric: it measures the error between the raw and lossy transforms. When null, compression uses the default metric of the runtime transform type:

  • precise_transform_metric with vqf and vqsf: it gives the exact error
  • shell_transform_metric with the other types: it measures points on the rigid shell The metric must support the runtime transform type of the clip, see itransform_metric::is_supported.

Defaults to null. Transform tracks only.

compression_settings::error_metric
itransform_error_metric* error_metric = nullptr;

DEPRECATED: use transform_runtime_type, custom_transform_adapter, and transform_metric instead. This value will be removed in v2.3.

The legacy error metric to use. It combines the runtime transform type and the error measurement. When it is not null, compression uses it and you cannot set transform_runtime_type, custom_transform_adapter, or transform_metric.

Defaults to null. Transform tracks only.

Deprecated

Use transform_runtime_type, custom_transform_adapter, and transform_metric instead, to be removed in v2.3

Optional features

compression_settings::enable_database_support
bool enable_database_support = false;

Whether or not to enable database support on the output compressed clip. This enables the required metadata which will later be stripped once the database is built. Transform tracks only.

compression_settings::optimize_loops
bool optimize_loops = false;

Detects if the last sample matches the first for every sub-track. If it is the case, it is removed and the wrap looping policy is used otherwise we use the clamp policy and every sample is retained. See sample_looping_policy for details.

compression_settings::keyframe_stripping
compression_keyframe_stripping_settings keyframe_stripping;

Keyframe stripping related settings. See [compression_keyframe_stripping_settings]. Transform tracks only.

compression_settings::metadata
compression_metadata_settings metadata;

These are optional metadata that can be added to compressed clips.

Hash and validation

compression_settings::get_hash
uint32_t get_hash() const

Calculates a hash from the internal state to uniquely identify a configuration.

compression_settings::is_valid
error_result is_valid() const

Checks if everything is valid and if it isn't, returns an error string.

get_raw_compression_settings

compression_settings get_raw_compression_settings()

Returns raw compression settings. No compression is performed and samples are all retained with full precision.

get_default_compression_settings

compression_settings get_default_compression_settings()

Returns the recommended and default compression settings. These have been tested in a wide range of scenarios and perform best overall.