summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-04-08 21:51:32 +0200
committerCarl Hetherington <cth@carlh.net>2026-04-08 21:51:32 +0200
commit5b0c02f8d5e0a2f9d2dc8fc0fc9d752605542340 (patch)
treef48b4061582604955135aa93f7db252e9961205a /src/lib
parenta4785278f658c1cef3a3e36a5c7b6234c9876208 (diff)
Support skipping of multiple frames (so e.g. we can handle 120fps sources).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/frame_rate_change.cc8
-rw-r--r--src/lib/frame_rate_change.h12
2 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc
index d4e51d669..6057f9ca3 100644
--- a/src/lib/frame_rate_change.cc
+++ b/src/lib/frame_rate_change.cc
@@ -46,7 +46,7 @@ FrameRateChange::FrameRateChange(double source, int dcp)
/* The difference between source and DCP frame rate will be lower
(i.e. better) if we skip.
*/
- _skip = true;
+ _skip = round(source / dcp) - 1;
} else if (fabs(_source * 2 - _dcp) < fabs(_source - _dcp)) {
/* The difference between source and DCP frame rate would be better
if we repeated each frame once; it may be better still if we
@@ -84,11 +84,13 @@ FrameRateChange::description() const
{
string description;
- if (!_skip && _repeat == 1 && !_change_speed) {
+ if (_skip == 0 && _repeat == 1 && !_change_speed) {
description = _("Content and DCP have the same rate.\n");
} else {
- if (_skip) {
+ if (_skip == 1) {
description = _("DCP will use every other frame of the content.\n");
+ } else if (_skip >= 2) {
+ description = fmt::format(_("DCP will contain 1 out of every {} frames of the content.\n"), _skip + 1);
} else if (_repeat == 2) {
description = _("Each content frame will be doubled in the DCP.\n");
} else if (_repeat > 2) {
diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h
index 478cadeee..b58e499d8 100644
--- a/src/lib/frame_rate_change.h
+++ b/src/lib/frame_rate_change.h
@@ -43,8 +43,8 @@ public:
to get the effective rate after any skip or repeat has happened.
*/
double factor() const {
- if (_skip) {
- return 0.5;
+ if (_skip > 0) {
+ return 1.0 / (_skip + 1);
}
return _repeat;
@@ -52,7 +52,7 @@ public:
std::string description() const;
- bool skip() const {
+ int skip() const {
return _skip;
}
@@ -80,8 +80,10 @@ private:
double _source = 24;
int _dcp = 24;
- /** true to skip every other frame */
- bool _skip = false;
+ /** Frames to skip between each one to use, e.g.
+ * 0 to skip no frames, 1 to skip every other one, 2 to skip 2 out of 3, etc.
+ */
+ int _skip = 0;
/** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */
int _repeat = 1;
/** true if this DCP will run its video faster or slower than the source