Skip to main content

Module frame_rate

Module frame_rate 

Source
Expand description

A frame rate as the fraction encoder parameters and bitstream timing take. A frame rate as the fraction of whole numbers that encoder parameters and bitstream timing take, read from the f64 a capture carries.

A caller names a rate by its fraction, carried as the f64 of that fraction: the NTSC rates are N * 1000 / 1001 (59.94 is 60000/1001), which no whole number or decimal names. The fraction nearest the f64 with a denominator up to MAX_DENOMINATOR is that fraction exactly, since any other in reach lies at least a millionth of a frame per second away, far past an f64โ€™s error. A rate written with up to three decimals reads as its own decimal fraction, and any other rate as the nearest fraction in reach, within a thousandth of a frame per second.

Structsยง

FrameRate
A frame rate of num / den frames per second, in lowest terms.

Constantsยง

MAX_DENOMINATOR ๐Ÿ”’
The largest denominator a rate is read with: 1001 holds every NTSC rate and every rate written with up to three decimals.
MAX_FPS ๐Ÿ”’
MIN_FPS ๐Ÿ”’
The span of rates a capture runs at, in frames per second.

Functionsยง

gcd ๐Ÿ”’
limit_denominator ๐Ÿ”’
The fraction nearest num / den whose denominator is at most max_den, in lowest terms: the last continued-fraction convergent within the bound, or the semiconvergent past it where that lies nearer.