acl/decompression/decompress.h¶
#include "acl/decompression/decompress.h"
The decompression context that seeks in compressed tracks and decompresses them.
decompression_context¶
template<class decompression_settings_type>
class decompression_context
Decompression context for the uniformly sampled algorithm. The context allows various decompression actions to be performed on a compressed track list.
Both the constructor and destructor are public because it is safe to place instances of this context on the stack or as member variables.
This compression algorithm is the simplest by far and as such it offers the fastest compression and decompression. Every sample is retained and every track has the same number of samples playing back at the same sample rate. This means that when we sample at a particular time within the track list, we can trivially calculate the offsets required to read the desired data. All the data is sorted in order to ensure all reads are as contiguous as possible for optimal cache locality during decompression.
decompression_context::settings_type¶
using settings_type = decompression_settings_type;
An alias to the decompression settings type.
decompression_context::db_settings_type¶
using db_settings_type = typename decompression_settings_type::database_settings_type;
An alias to the database settings type.
decompression_context::decompression_context¶
decompression_context()
Constructs a context instance.
decompression_context::~decompression_context¶
~decompression_context()
Destructs a context instance.
decompression_context::get_compressed_tracks¶
const compressed_tracks* get_compressed_tracks() const
Returns the compressed tracks bound to this context instance.
decompression_context::initialize¶
bool initialize(const compressed_tracks& tracks)
Initializes the context instance to a particular compressed tracks instance. Returns whether initialization was successful or not.
bool initialize(
const compressed_tracks& tracks,
const database_context<db_settings_type>& database)
Initializes the context instance to a particular compressed tracks instance and its database instance. Returns whether initialization was successful or not.
decompression_context::is_initialized¶
bool is_initialized() const
Returns true if this context instance is bound to a compressed tracks instance, false otherwise.
decompression_context::reset¶
void reset()
Resets the context instance to its default constructed state. If the context was currently bound to a compressed tracks instance (and database), it will no longer be bound to anything.
decompression_context::relocated¶
bool relocated(const compressed_tracks& tracks)
If the bound compressed tracks instance has relocated elsewhere in memory, this function rebinds the context to it, avoiding the need to re-initialize it entirely. Returns whether rebinding was successful or not.
bool relocated(
const compressed_tracks& tracks,
const database_context<db_settings_type>& database)
If the bound compressed tracks and database instances have relocated elsewhere in memory, this function rebinds the context to them, avoiding the need to re-initialize it entirely. Returns whether rebinding was successful or not.
decompression_context::is_dirty¶
bool is_dirty(const compressed_tracks& tracks) const
Returns true if this context instance is bound to the specified compressed tracks instance, false otherwise.
Deprecated
Renamed to is_bound_to, to be removed in v3.0
decompression_context::is_bound_to¶
bool is_bound_to(const compressed_tracks& tracks) const
Returns true if this context instance is bound to the specified compressed tracks instance, false otherwise.
bool is_bound_to(const compressed_database& database) const
Returns true if this context instance is bound to the specified database instance, false otherwise.
decompression_context::set_looping_policy¶
void set_looping_policy(sample_looping_policy policy)
Sets the looping policy. Should only be used when the host runtime requires overriding the default behavior. By default, sample_looping_policy::as_compressed is used which uses clamp if loops were not optimized.
decompression_context::get_looping_policy¶
sample_looping_policy get_looping_policy() const
Gets the current looping policy. If wrapping is not disabled, this is the policy from the compressed data by default.
decompression_context::seek¶
void seek(float sample_time, sample_rounding_policy rounding_policy)
Seeks within the compressed tracks to a particular point in time with the desired rounding policy. The sample_time value must be within [0, clip duration] inclusive otherwise it will be clamped.
decompression_context::decompress_tracks¶
template<class track_writer_type>
void decompress_tracks(track_writer_type& writer)
Decompress every track at the current sample time. The track_writer_type allows complete control over how the tracks are written out.
decompression_context::decompress_track¶
template<class track_writer_type>
void decompress_track(uint32_t track_index, track_writer_type& writer)
Decompress a single track at the current sample time. The track_writer_type allows complete control over how the track is written out.
make_decompression_context¶
template<class decompression_settings_type>
decompression_context<decompression_settings_type>* make_decompression_context(
iallocator& allocator)
Allocates and constructs an instance of the decompression context.