[libcamera-devel] [RFC PATCH 1/6] libcamera: Add fraction.h

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Mar 17 12:48:40 CET 2021


On 17/03/2021 11:33, Kieran Bingham wrote:
> Hi Marian,
> 
> On 16/03/2021 15:52, Marian Cichy wrote:
>> Add a new class that represents a fraction. A structure like this is
>> also often used in linux camera drivers, e.g. v4l2_fract to represent a
>> frame interval or in applications like Gstreamer to represent frame
>> rates.
>>
>> Adding this class helps to interface frame intervals and frame
>> rates in video streams.

Also, and only for reference really, because it's fun*, and I've always
been intrigued by the concept of Flicks in this area:

	https://github.com/facebookarchive/Flicks
	https://en.wikipedia.org/wiki/Flick_(time)

where a flick is:
> using flicks = std::chrono::duration<std::chrono::nanoseconds::rep, std::ratio<1, 705600000>>;

> A flick (frame-tick) is a very small unit of time. It is 1/705600000 of a second, exactly.
> 
>      1 flick = 1/705600000 second
> 
> This unit of time is the smallest time unit which is LARGER than a
> nanosecond, and can in integer quantities exactly represent a single
> frame duration for 24 Hz, 25 Hz, 30 Hz, 48 Hz, 50 Hz, 60 Hz, 90 Hz,
> 100 Hz, 120 Hz, and also 1/1000 divisions of each, as well as a
> single sample duration for 8 kHz, 16 kHz, 22.05 kHz, 24 kHz, 32 kHz,
> 44.1 kHz, 48 kHz, 88.2 kHz, 96 kHz, and 192kHz, as well as the NTSC
> frame durations for 24 * (1000/1001) Hz, 30 * (1000/1001) Hz, 60 *
> (1000/1001) Hz, and 120 * (1000/1001) Hz.

*fun might not be well-defined in this use case.


-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list