46 REQUIRE (framerate_divisor);
48 const uint64_t MAXRANGE = std::numeric_limits<raw_time_64>::max();
49 const int64_t limit_num = MAXRANGE / framerate;
50 const int64_t limit_den = MAXRANGE / framerate_divisor;
54 if (abs(
time) < limit_num and microScale < limit_den)
57 return util::floordiv (
time*int64_t(framerate), microScale*int64_t(framerate_divisor));
64 const uint64_t LIM{MAXRANGE/microScale};
65 if (framerate > LIM or framerate_divisor > LIM)
68 framerate_divisor = LIM;
97 return globalDefaultGrid;
122 , quantiser_(quantisation_to_use)
132 : origin_(referencePoint)
133 , raster_(__ensure_nonzero(frames_per_second.duration()))
137 : origin_(referencePoint)
138 , raster_(__ensure_nonzero(frame_duration))
259 int64_t frameNr = calculate_quantisation (
time, 30000, 1001);
262 lldiv_t tenMinFrames = lldiv (frameNr, FRAMES_PER_10min);
267 int64_t remainingMinutes = (tenMinFrames.rem - DISCREPANCY) / FRAMES_PER_1min;
269 int64_t dropIncidents = (10-1) * tenMinFrames.quot + remainingMinutes;
270 return frameNr + 2*dropIncidents;
284 int64_t total_mins = 60 * hours + mins;
285 int64_t total_frames = 30*60*60 * hours
289 - 2 * (total_mins - total_mins / 10);
Duration is the internal Lumiera time metric.
Simple stand-alone Quantiser implementation based on a constant sized gird.
FrameCnt gridPoint(TimeValue const &) const override
grid quantisation (alignment).
Offset gridLocal(TimeValue const &) const override
transform into the local time scale grid aligned.
FixedFrameQuantiser(FrameRate const &frames_per_second, TimeValue referencePoint=TimeValue(0))
Create a quantiser based on a fixed constant spaced grid, rooted at the reference point as origin of ...
TimeValue timeOf(FrameCnt gridPoint) const override
calculate time value of a grid interval (frame) start point
static int64_t grid_aligned(TimeValue const &, TimeValue const &)
Quantise the given time into a fixed grid, relative to the origin.
Framerate specified as frames per second.
static const FrameRate NTSC
virtual ~Grid()
this is an Interface
Offset measures a distance in time.
QuTime(TimeValue raw, Symbol gridID)
build a quantised time value, referring the time grid by-name.
TimeValue materialise(TimeValue const &raw) const
convenience shortcut: materialise a raw time value based on this grid or time axis,...
virtual TimeValue timeOf(FrameCnt gridPoint) const =0
virtual FrameCnt gridPoint(TimeValue const &raw) const =0
basic constant internal time value.
static const raw_time_64 SCALE
Number of micro ticks (µs) per second as basic time scale.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
const uint FRAMES_PER_10min
int64_t calculate_quantisation(raw_time_64 time, uint64_t framerate, uint64_t framerate_divisor=1)
Grid-align the raw time to a frame grid, which can be fractional.
const uint FRAMES_PER_1min
int64_t FrameCnt
relative framecount or frame number.
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.
PQuant getDefaultGridFallback()
std::shared_ptr< const Quantiser > PQuant
int64_t raw_time_64
Raw µ-tick time representation used in Lumiera.
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 t...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Implementation namespace for support and library code.
I floordiv(I num, I den)
floor function for integer arithmetics.
int64_t reQuant(int64_t num, int64_t den, int64_t u)
Re-Quantise a number into a new grid, truncating to the next lower grid point.
Library functions to support the formation of grid-aligned time values.
Rational number support, based on boost::rational.
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
a family of time value like entities and their relationships.
Utilities for quantisation (grid alignment) and comparisons.