Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
lib::time Namespace Reference

Namespaces

namespace  anonymous_namespace{common-services.cpp}
 
namespace  anonymous_namespace{quantiser.cpp}
 
namespace  anonymous_namespace{quantiser.hpp}
 
namespace  anonymous_namespace{time.cpp}
 
namespace  anonymous_namespace{timecode.cpp}
 
namespace  anonymous_namespace{timevalue.hpp}
 
namespace  digxel
 
namespace  format
 
namespace  mutation
 
namespace  test
 

Typedefs

using SexaDigit = Digxel< int, digxel::SexaFormatter >
 for displaying time components (sexagesimal)
 
using HexaDigit = Digxel< uint, digxel::HexaFormatter >
 for displaying a hex byte
 
using HourDigit = Digxel< int, digxel::HourFormatter >
 for displaying hours in H:M:S
 
using FrameCnt = int64_t
 relative framecount or frame number.
 
using CountVal = Digxel< FrameCnt, digxel::CountFormatter >
 for displaying a counter
 
using QuantR = Quantiser const &
 
using PQuant = std::shared_ptr< const Quantiser >
 
using PGrid = std::shared_ptr< const Grid >
 
typedef lib::polyvalue::CloneValueSupport< MutationClonableMutation
 
typedef lib::PolymorphicValue< Mutation, MUTATION_IMPL_SIZE, ClonableMutationEncapsulatedMutation
 
using raw_time_64 = int64_t
 Raw µ-tick time representation used in Lumiera.
 
using FSecs = boost::rational< int64_t >
 rational representation of fractional seconds
 

Enumerations

enum  { MUTATION_IMPL_SIZE = sizeof(TimeValue) }
 

Classes

class  Control
 Frontend/Interface: controller-element to retrieve and change running time values. More...
 
class  Digxel
 A number element for building structured numeric displays. More...
 
class  Duration
 Duration is the internal Lumiera time metric. More...
 
class  FixedFrameQuantiser
 Simple stand-alone Quantiser implementation based on a constant sized gird. More...
 
class  FrameNr
 A frame counting timecode value. More...
 
class  FrameRate
 Framerate specified as frames per second. More...
 
class  Grid
 Abstraction of a value alignment grid. More...
 
class  HmsTC
 
class  ImposeOffsetMutation
 concrete time value mutation: adjust the given time entity by an offset amount. More...
 
class  MaterialiseIntoTarget
 concrete time value mutation: make the grid aligned time value explicit, and impose the resulting value to the given time points (or start points). More...
 
class  Mutation
 Interface: an opaque change imposed onto some time value. More...
 
class  NaturalNudgeMutation
 concrete time value mutation: nudge based on a implicit grid, which is either a quantised target value's own grid, or a natural grid. More...
 
class  NudgeMutation
 concrete time value mutation: nudge target value by the given number of 'steps', relative to the given grid. More...
 
class  Offset
 Offset measures a distance in time. More...
 
class  Quantiser
 Facility to create grid-aligned time values. More...
 
class  QuTime
 grid aligned time specification, referring to a specific scale. More...
 
class  Secs
 
class  SetNewDuration
 concrete time value mutation: set a new overall duration for an extended timespan. More...
 
class  SetNewStartTimeMutation
 concrete time value mutation: impose fixed new start time. More...
 
class  Signum
 special Digxel to show a sign. More...
 
class  SmpteTC
 Classical Timecode value reminiscent to SMPTE format. More...
 
class  TCode
 Interface: fixed format timecode specification. More...
 
class  Time
 Lumiera's internal time value datatype. More...
 
class  TimeSpan
 A time interval anchored at a specific point in time. More...
 
class  TimeValue
 basic constant internal time value. More...
 
class  TimeVar
 a mutable time value, behaving like a plain number, allowing copy and re-accessing More...
 

Functions

int64_t calculate_ntsc_drop_frame_number (raw_time_64 time)
 Compute the consecutive frame number from a given time, which is interpreted at the NTSC drop frame timecode grid.
 
raw_time_64 build_time_from_ntsc_drop_frame (uint frames, uint secs, uint mins, uint hours)
 Build effective time from a NTSC drop frame timecode.
 
 LUMIERA_ERROR_DEFINE (INVALID_MUTATION, "Changing a time value in this way was not designated")
 
 LUMIERA_ERROR_DECLARE (INVALID_MUTATION)
 Changing a time value in this way was not designated.
 
PQuant getDefaultGridFallback ()
 
 LUMIERA_ERROR_DEFINE (UNKNOWN_GRID, "referring to an undefined grid or scale in value quantisation")
 
 LUMIERA_ERROR_DECLARE (UNKNOWN_GRID)
 referring to an undefined grid or scale in value quantisation
 
boost::rational< uint__framerate_approximation (double fps)
 
boost::rational< uint__framerate_approximation (size_t cnt, Duration timeReference)
 
Offset operator+ (Offset const &start, Offset const &toChain)
 
Offset operator- (Offset const &start, Offset const &toSubtract)
 
template<typename FAC >
Offset operator* (Offset const &distance, FAC factor)
 
template<typename INT >
Offset operator* (INT factor, Offset const &o)
 
template<typename INTX >
Offset operator* (boost::rational< INTX > factor, Offset const &offset)
 
Offset operator* (double factor, Offset const &offset)
 
Duration operator+ (Duration const &base, Duration const &toAdd)
 
Duration operator- (Duration const &base, Duration const &toRemove)
 
template<typename NUM >
Offset operator* (NUM factor, Duration const &dur)
 
template<typename NUM >
Offset operator* (Duration const &dur, NUM factor)
 
FSecs operator/ (int n, FrameRate rate)
 convenient conversion to duration in fractional seconds
 
HashVal hash_value (TimeValue const &time)
 derive a hash from the µ-tick value
 

Variables

const uint RATE_LIMIT {std::numeric_limits<uint>::max() / 1024}
 a rather arbitrary safety limit imposed on internal numbers used to represent a frame rate.
 

Typedef Documentation

◆ SexaDigit

for displaying time components (sexagesimal)

Definition at line 306 of file digxel.hpp.

◆ HexaDigit

for displaying a hex byte

Definition at line 307 of file digxel.hpp.

◆ HourDigit

for displaying hours in H:M:S

Definition at line 308 of file digxel.hpp.

◆ FrameCnt

typedef int64_t FrameCnt

relative framecount or frame number.

Used within the engine at places where the underlying grid and origin is obvious from the call context.

Warning
do not mix up raw_time_64 and FrameCnt.
use 64bit consistently. beware: long is 32bit on i386
Note
any conversion to frame numbers should go through time quantisation followed by conversion to FrameNr

Definition at line 310 of file digxel.hpp.

◆ CountVal

for displaying a counter

Definition at line 311 of file digxel.hpp.

◆ QuantR

using QuantR = Quantiser const&

Definition at line 57 of file formats.hpp.

◆ PQuant

typedef std::shared_ptr< const Quantiser > PQuant

Definition at line 58 of file formats.hpp.

◆ PGrid

using PGrid = std::shared_ptr<const Grid>

Definition at line 70 of file grid.hpp.

◆ ClonableMutation

◆ EncapsulatedMutation

◆ raw_time_64

using raw_time_64 = int64_t

Raw µ-tick time representation used in Lumiera.

Remarks
this representation was inspired by Lib-GAVL.
Todo:
2025 a mere type alias is up to debate – very likely we'll use a wrapper soon /////////////////TICKET #1258
Warning
application logic should avoid handling any raw time value directly and rather treat time data as an opaque entity.

Definition at line 127 of file timevalue.hpp.

◆ FSecs

using FSecs = boost::rational<int64_t>

rational representation of fractional seconds

Warning
do not mix up raw_time_64 and FSecs

Definition at line 227 of file timevalue.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MUTATION_IMPL_SIZE 

Definition at line 79 of file mutation.hpp.

Function Documentation

◆ calculate_ntsc_drop_frame_number()

int64_t calculate_ntsc_drop_frame_number ( raw_time_64  time)

Compute the consecutive frame number from a given time, which is interpreted at the NTSC drop frame timecode grid.

Remarks
This function reverses building the drop-frame timecode, and thus maps a time into consecutive frame numbers at NTSC framerate (i.e. without gaps)
Parameters
timerepresented as time value in µ-ticks
Returns
the absolute frame number as addressed by NTSC drop-frame
Todo:
2011 I doubt this works correct for negative times!!

Definition at line 257 of file quantiser.cpp.

Referenced by lib::time::test::anonymous_namespace{time-dropframe-test.cpp}::dropframe_frames(), lib::time::test::anonymous_namespace{time-dropframe-test.cpp}::dropframe_hours(), lib::time::test::anonymous_namespace{time-dropframe-test.cpp}::dropframe_minutes(), and lib::time::test::anonymous_namespace{time-dropframe-test.cpp}::dropframe_seconds().

+ Here is the caller graph for this function:

◆ build_time_from_ntsc_drop_frame()

raw_time_64 build_time_from_ntsc_drop_frame ( uint  frames,
uint  secs,
uint  mins,
uint  hours 
)

Build effective time from a NTSC drop frame timecode.

Warning
take care not to specify time codes that are illegal NTSC drop-frame times.
Remarks
This is the mapping function to translate NTSC drop frame timecode specification into an actual time, with the necessary skip events every 1.-9. minute, thereby allocating 108 frames less per hour, than would be required for full 30 fps.
Returns
raw time value on a µ-tick scale

Definition at line 282 of file quantiser.cpp.

References FrameRate::NTSC.

Referenced by TimeDropframe_test::verify_completeMapping(), and TimeDropframe_test::verify_DropFrame_conv().

+ Here is the caller graph for this function:

◆ LUMIERA_ERROR_DEFINE() [1/2]

LUMIERA_ERROR_DEFINE ( INVALID_MUTATION  ,
"Changing a time value in this way was not designated"   
)

◆ LUMIERA_ERROR_DECLARE() [1/2]

LUMIERA_ERROR_DECLARE ( INVALID_MUTATION  )

Changing a time value in this way was not designated.

◆ getDefaultGridFallback()

PQuant getDefaultGridFallback ( )
Todo:
placeholder for accessing a current or default session grid. To be implemented later.

Definition at line 94 of file quantiser.cpp.

◆ LUMIERA_ERROR_DEFINE() [2/2]

LUMIERA_ERROR_DEFINE ( UNKNOWN_GRID  ,
"referring to an undefined grid or scale in value quantisation"   
)

◆ LUMIERA_ERROR_DECLARE() [2/2]

LUMIERA_ERROR_DECLARE ( UNKNOWN_GRID  )

referring to an undefined grid or scale in value quantisation

◆ __framerate_approximation() [1/2]

boost::rational< uint > __framerate_approximation ( double  fps)

helper to work around the limitations of uint.

Returns
a fractional number approximating the floating-point spec.
Todo:
imposing a quite coarse limitation. If this turns out to be a problem: we can do better, use lib::reQuant (rational.hpp)

Definition at line 309 of file time.cpp.

References util::ilog2(), util::max(), RATE_LIMIT, and util::reQuant().

Referenced by __framerate_approximation(), and FrameRate::approx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __framerate_approximation() [2/2]

boost::rational< uint > __framerate_approximation ( size_t  cnt,
Duration  timeReference 
)

helper calculate the count per time span approximately, to the precision possible to represent as fractional uint.

Definition at line 340 of file time.cpp.

References __framerate_approximation(), RATE_LIMIT, and TimeValue::SCALE.

+ Here is the call graph for this function:

◆ operator+() [1/2]

Offset operator+ ( Offset const &  start,
Offset const &  toChain 
)
inline

Definition at line 414 of file timevalue.hpp.

◆ operator-() [1/2]

Offset operator- ( Offset const &  start,
Offset const &  toSubtract 
)
inline

Definition at line 422 of file timevalue.hpp.

◆ operator*() [1/6]

template<typename FAC >
Offset operator* ( Offset const &  distance,
FAC  factor 
)
inline

Definition at line 431 of file timevalue.hpp.

◆ operator*() [2/6]

template<typename INT >
Offset operator* ( INT  factor,
Offset const &  o 
)
inline

Definition at line 438 of file timevalue.hpp.

◆ operator*() [3/6]

template<typename INTX >
Offset operator* ( boost::rational< INTX >  factor,
Offset const &  offset 
)
inline

Definition at line 447 of file timevalue.hpp.

References Offset::stretchedByRationalFactor().

+ Here is the call graph for this function:

◆ operator*() [4/6]

Offset operator* ( double  factor,
Offset const &  offset 
)
inline

Definition at line 453 of file timevalue.hpp.

References Offset::stretchedByFloatFactor().

+ Here is the call graph for this function:

◆ operator+() [2/2]

Duration operator+ ( Duration const &  base,
Duration const &  toAdd 
)
inline

Definition at line 532 of file timevalue.hpp.

◆ operator-() [2/2]

Duration operator- ( Duration const &  base,
Duration const &  toRemove 
)
inline

Definition at line 538 of file timevalue.hpp.

References Duration::NIL.

◆ operator*() [5/6]

template<typename NUM >
Offset operator* ( NUM  factor,
Duration const &  dur 
)
inline

Definition at line 546 of file timevalue.hpp.

◆ operator*() [6/6]

template<typename NUM >
Offset operator* ( Duration const &  dur,
NUM  factor 
)
inline

Definition at line 553 of file timevalue.hpp.

◆ operator/()

FSecs operator/ ( int  n,
FrameRate  rate 
)
inline

convenient conversion to duration in fractional seconds

Definition at line 701 of file timevalue.hpp.

References rate.

◆ hash_value()

HashVal hash_value ( TimeValue const &  time)
inline

derive a hash from the µ-tick value

Returns
rotation of the raw value to produce a suitable spacing for consecutive time
Remarks
picked up by Boost-hash, or std. hashtables with the help of hash-standard.h
See also
https://stackoverflow.com/questions/31387778/near-constant-time-rotate-that-does-not-violate-the-standards/31488147#31488147

Definition at line 741 of file timevalue.hpp.

Variable Documentation

◆ RATE_LIMIT

const uint RATE_LIMIT {std::numeric_limits<uint>::max() / 1024}

a rather arbitrary safety limit imposed on internal numbers used to represent a frame rate.

Remarks
rational numbers bear the danger to overflow for quite ordinary computations; we stay away from the absolute maximum by an additional safety margin of 1/1000.

Definition at line 300 of file time.cpp.

Referenced by __framerate_approximation(), and __framerate_approximation().