diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-19 20:02:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-03 09:41:16 +0200 |
| commit | 7f35c43bafa0ce654b4cfb9c7ea5b6ea0c1ddd37 (patch) | |
| tree | bfb13f90192169e07c286dbd0535fc627dc02631 /hacks | |
| parent | 13d5b07d47401ac2ac3dfa58fe3baca7cf9fd64f (diff) | |
Add and use Time::proportion_of().
Diffstat (limited to 'hacks')
| -rw-r--r-- | hacks/hz.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/hacks/hz.py b/hacks/hz.py new file mode 100644 index 000000000..78951d101 --- /dev/null +++ b/hacks/hz.py @@ -0,0 +1,23 @@ +import math + +MAX_FPS = 30 + +X = MAX_FPS +for i in range(MAX_FPS - 1, 1, -1): + if (X % i) != 0: + X *= i + +for i in (36, 48, 60): + if (X % i) != 0: + X *= i + +print(f"Timebase: {X}") +print(f"Bits: {math.log2(X)}") + +# 5 hours +HOURS = 5 +print(f"{HOURS} hour film requires: {math.log2(X * HOURS * 60 * 60)} bits") + +for i in range(2, MAX_FPS + 1): + assert (X % i) == 0 + |
