diff --git a/src/lib/test/test-helper.hpp b/src/lib/test/test-helper.hpp index 7bba668f2..ef22c94be 100644 --- a/src/lib/test/test-helper.hpp +++ b/src/lib/test/test-helper.hpp @@ -260,7 +260,7 @@ namespace test{ - /** create a random but not insane Time value */ + /** create a random but not insane Time value between 1s ... 10min + 500ms */ inline lib::time::Time randTime () { diff --git a/src/lib/time/quantiser.cpp b/src/lib/time/quantiser.cpp index 6ee841200..4e8cff95c 100644 --- a/src/lib/time/quantiser.cpp +++ b/src/lib/time/quantiser.cpp @@ -102,9 +102,9 @@ namespace time { * @warning this operation incurs information loss. Values may be rounded * and / or clipped, according to the grid used. And, contrary to * a QuTime value, the information about the actual grid is - * discarded. Please don't use this operation if you just - * "want a number" but feel to too lazy to understand - * properly what quantisation means! + * discarded. Please resist the temptation to abuse this + * operation to "just get a simple number", without + * understanding what quantisation means! */ TimeValue Quantiser::materialise (TimeValue const& raw) const diff --git a/src/steam/engine/dispatcher.cpp b/src/steam/engine/dispatcher.cpp index d79466621..c2406af67 100644 --- a/src/steam/engine/dispatcher.cpp +++ b/src/steam/engine/dispatcher.cpp @@ -56,7 +56,7 @@ namespace engine { FrameCoord frame; frame.absoluteNominalTime = refPoint; frame.absoluteFrameNumber = refPoint.getStartFrame(); - frame.absoluteRealDeadline = refPoint.establishDeadlineFor (frameOffset); + frame.realTimeDeadline = refPoint.establishDeadlineFor (frameOffset); frame.modelPort = this->modelPort_; frame.channelNr = this->channel_; diff --git a/src/steam/engine/frame-coord.hpp b/src/steam/engine/frame-coord.hpp index 7bb878ee8..36db830fd 100644 --- a/src/steam/engine/frame-coord.hpp +++ b/src/steam/engine/frame-coord.hpp @@ -69,7 +69,7 @@ namespace engine { TimeVar absoluteNominalTime; FrameCnt absoluteFrameNumber; - TimeVar absoluteRealDeadline; + TimeVar realTimeDeadline; ModelPort modelPort; uint channelNr; ///////////////////////////////////////////////////////////////////////////TICKET #1297 : retract differentiation into channels here (instead use ModelPorts in the Segment) @@ -79,7 +79,7 @@ namespace engine { FrameCoord() : absoluteNominalTime(Time::NEVER) , absoluteFrameNumber(std::numeric_limits::max()) - , absoluteRealDeadline(Time::NEVER) + , realTimeDeadline(Time::NEVER) , modelPort() // unconnected , channelNr(0) { } @@ -91,7 +91,7 @@ namespace engine { bool isDefined() const { - return absoluteRealDeadline != Time::NEVER; + return realTimeDeadline != Time::NEVER; } }; diff --git a/src/steam/engine/time-anchor.hpp b/src/steam/engine/time-anchor.hpp index b5b32d43c..59d9f8a01 100644 --- a/src/steam/engine/time-anchor.hpp +++ b/src/steam/engine/time-anchor.hpp @@ -30,6 +30,8 @@ ** @todo this is part of an implementation draft from 2013, ** to create a complete outline of player and render job generation. ** @todo as of 2016 this effort is stalled, but remains valid + ** + ** @deprecated 5/23 during rework of Playback / Rendering the concept TimeAnchor lost its substance */ @@ -89,6 +91,9 @@ namespace engine { * adjustments to the engine latency will be reflected in the planned job's * deadlines. Actually, the embedded Timings record is responsible for this * timing calculation and for fetching the current EngineConfig. + * + * @deprecated 5/23 during rework of Playback / Rendering it turns out that TimeAnchor + * is completely redundant and void of substantial meaning * * @see Dispatcher * @see DispatcherInterface_test @@ -100,6 +105,8 @@ namespace engine { FrameCnt anchorPoint_; Time relatedRealTime_; +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1301 + ////////////////////////////////////////////////////////////////////////////////////////////////OOO sensible calculation, but pointless in TimeAnchor static Time expectedTimeofArival (play::Timings const& timings, FrameCnt startFrame, Offset startDelay) { @@ -120,6 +127,14 @@ namespace engine { } return deadline; } +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1301 + static Time + expectedTimeofArival (play::Timings const& timings, FrameCnt startFrame, Offset startDelay) + { + TimeVar deadline = timings.isTimebound()? timings.getTimeDue(startFrame) + : RealClock::now(); + return deadline + startDelay; + } public: diff --git a/src/steam/play/timings.cpp b/src/steam/play/timings.cpp index 12c280ed4..fa0831e34 100644 --- a/src/steam/play/timings.cpp +++ b/src/steam/play/timings.cpp @@ -128,14 +128,23 @@ namespace play { { return Offset (grid_->timeOf(refFrameNr), grid_->timeOf(refFrameNr + 1)); } - + + + FrameCnt + Timings::getBreakPointAfter (TimeValue refPoint) const + { + FrameCnt frameNr = grid_->gridPoint (refPoint); + return grid_->timeOf(frameNr) == refPoint? frameNr + : frameNr+1; + } + /** @remarks the purpose of this function is to support scheduling * and frame handling even in case the frame rate isn't constant. * To indicate the case the frame rate is changing right now, * this function might return Duration::NIL - * @todo implement real support for variable frame rates + * @todo implement real support for variable frame rates */ ////////////////////////////////////////////////////////TICKET #236 Duration Timings::constantFrameTimingsInterval (TimeValue) const diff --git a/src/steam/play/timings.hpp b/src/steam/play/timings.hpp index 7c11e6e9e..ea7f46840 100644 --- a/src/steam/play/timings.hpp +++ b/src/steam/play/timings.hpp @@ -100,7 +100,7 @@ namespace play { PlaybackUrgency playbackUrgency; boost::rational playbackSpeed; /////////////TICKET #902 we need a more generic representation for variable speed playback Time scheduledDelivery; ///< a wall clock time corresponding to the Grid's origin. Can be Time::Never (=not time bound) - Duration outputLatency; + Duration outputLatency; ///////////////TICKET #1301 do we even need this information here (-> rather on some Engine state) explicit Timings (FrameRate fps); @@ -117,6 +117,9 @@ namespace play { Duration getFrameDurationAt (TimeValue refPoint) const; Duration getFrameDurationAt (FrameCnt refFrameNr) const; + /** the next grid point at or after the given reference time */ + FrameCnt getBreakPointAfter (TimeValue refPoint) const; + /** the frame spacing and duration remains constant for some time... * @param startPoint looking from that time point into future * @return duration after this starting point, where it's safe @@ -174,6 +177,7 @@ namespace play { bool isOriginalSpeed() const; + bool isTimebound() const; /** Consistency self-check */ @@ -196,6 +200,12 @@ namespace play { return 1 == playbackSpeed; } + inline bool + Timings::isTimebound() const + { + return play::TIMEBOUND == playbackUrgency; + } + }} // namespace steam::play diff --git a/tests/core/steam/engine/timings-test.cpp b/tests/core/steam/engine/timings-test.cpp index fc76da47c..fa65f565f 100644 --- a/tests/core/steam/engine/timings-test.cpp +++ b/tests/core/steam/engine/timings-test.cpp @@ -28,7 +28,7 @@ #include "lib/test/run.hpp" -#include "lib/error.hpp" +#include "lib/test/test-helper.hpp" //#include "steam/engine/procnode.hpp" #include "steam/play/dummy-play-connection.hpp" @@ -61,7 +61,7 @@ namespace test { using lib::time::FrameRate; using lib::time::Duration; using lib::time::Offset; - using lib::time::TimeVar; + using lib::time::TimeValue; using lib::time::Time; using mobject::ModelPort; using play::Timings; @@ -75,16 +75,23 @@ namespace test { const uint DUMMY_CHANNEL(0); /////////////////////////////////////////////////////////////TICKET #1297 : get rid of the channels (use different ModelPort) - ModelPort - getTestPort() +// ModelPort +// getTestPort() +// { +// using play::test::ModelPorts; +// using play::test::PlayTestFrames_Strategy; +// using DummyPlaybackSetup = play::test::DummyPlayConnection; +// +// DummyPlaybackSetup dummySetup; +// ModelPorts mockModelPorts = dummySetup.provide_testModelPorts(); +// return *mockModelPorts; // using just the first dummy port +// } + + + FSecs + randTicks() { - using play::test::ModelPorts; - using play::test::PlayTestFrames_Strategy; - using DummyPlaybackSetup = play::test::DummyPlayConnection; - - DummyPlaybackSetup dummySetup; - ModelPorts mockModelPorts = dummySetup.provide_testModelPorts(); - return *mockModelPorts; // using just the first dummy port + return FSecs{1 + rand() % 600, 1 + rand() % 600}; } } // (End) Test fixture @@ -120,53 +127,32 @@ namespace test { void verify_simpleFrameStep() { - ModelPort modelPort (getTestPort()); Timings timings (FrameRate::PAL); + CHECK (timings.getOrigin() == Time::ZERO); + ENSURE (START_FRAME == 10); - - TimeAnchor refPoint(timings, START_FRAME); - CHECK (refPoint == Time::ZERO + Duration(10, FrameRate::PAL)); - - FrameCoord frame; /////////////////TODO get / implement offset-by-#-Frames - FrameCnt frameOffset = 15; - - frame.absoluteNominalTime = refPoint; - frame.absoluteFrameNumber = refPoint.getStartFrame(); - frame.absoluteRealDeadline = refPoint.establishDeadlineFor (frameOffset); - frame.modelPort = modelPort; - frame.channelNr = DUMMY_CHANNEL; - - ENSURE (frame.isDefined()); -// frame = dispatcher_->locateRelative (frame, frameOffset); /////////////////////////////OOO MAGIC FAIRY DUST HERE - - CHECK (frame.absoluteNominalTime == Time(0,1)); ///////////////////////////////////OOO Boooooom - CHECK (frame.absoluteFrameNumber == 25); - CHECK (refPoint.remainingRealTimeFor(frame) < Time(FSecs(25,25))); - CHECK (refPoint.remainingRealTimeFor(frame) >= Time(FSecs(24,25))); - CHECK (frame.modelPort == modelPort); - + CHECK (timings.getFrameStartAt(START_FRAME) == Time::ZERO + Duration(10, FrameRate::PAL)); + CHECK (timings.getFrameStartAt(START_FRAME+1) == Time::ZERO + Duration(11, FrameRate::PAL)); #if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1301 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1301 } - /** action used as "continuation" in #check_ContinuationBuilder - * This function expects to be invoked with a time anchor bumped up - * to point exactly behind the end of the previously planned chunk of Jobs + /** @test detect boundaries of frame planning chunks for arbitrary chunk duration. */ void verify_next_startPoint() { Timings timings (FrameRate::PAL); - TimeAnchor nextRefPoint(timings, START_FRAME); //////////////////////////////////////OOO : how is this actually determined (not yet implemented....) - UNIMPLEMENTED ("How to determine the start point of the next planning chunk"); + Time refPoint{randTicks()}; + + FrameCnt startFrame = timings.getBreakPointAfter (refPoint); + Time frameStart = timings.getFrameStartAt(startFrame); Duration frameDuration (1, FrameRate::PAL); - Time startAnchor = Time::ZERO + START_FRAME*frameDuration; - Duration time_to_cover = timings.getPlanningChunkDuration(); - CHECK (Time(nextRefPoint) >= startAnchor + time_to_cover); - CHECK (Time(nextRefPoint) < startAnchor + time_to_cover + 1*frameDuration); + CHECK (frameStart >= refPoint); + CHECK (frameStart < refPoint + frameDuration); } }; diff --git a/tests/core/steam/play/timing-constraints-test.cpp b/tests/core/steam/play/timing-constraints-test.cpp index 378927cf4..f225f2db0 100644 --- a/tests/core/steam/play/timing-constraints-test.cpp +++ b/tests/core/steam/play/timing-constraints-test.cpp @@ -77,7 +77,6 @@ namespace test { CHECK (timings.getOrigin() == Time::ZERO); CHECK (timings.getFrameDurationAt(t) == lengthPAL); - CHECK (timings.getFrameOffsetAt(t) == lengthPAL); CHECK (ASAP == timings.playbackUrgency); #if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #831 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #831 diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index b1906f64a..62b2a464a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -69527,6 +69527,51 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + +

+ ...denn dazu benötigen wir detailierte Timing-Beobachtungen, welche erst im speziellen Job-Funktor vorliegen können, nicht auf der Ebene eines ganzen Planning-Chunk +

+ +
+
+ + + + + + + + + +

+ dann reduziert sich der TimeAnchor komplett auf einen Proxy zu den Timings (die obendrein noch als Kopie mitgeschleppt werden) +

+ +
+
+
+ + + + +
@@ -69565,6 +69610,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -73083,9 +73129,99 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + + + + + + + +

+ ...was auf eine Verwirrung in den Konzepten und Begriffen hindeutet (die ich schon seit Tagen vermute, aber noch nicht recht fassen kann) +

+ +
+ +
+ + + + + + + + + + + + + + + + +

+ also relativ zum Ursprung des Time-Grid dieser Timeline +

+ +
+
+
+ + + + + + + + + + + + + + + +

+ ...deshalb kapiere ich ihn immer nicht +

+

+ ...dann lese ich ihn einzeln durch, und alles sieht „richtig“ aus... +

+ +
+ +
+ + + + + + +

+ ...weil ich erst mal einen Test schreiben wollte, und sonst noch keinerlei tragende Strukturen hatte +

+ +
+
+ + + + + + +

+ ⟹ alles mit Latency und Deadline muß weg +

+ +
+ +
+
+
+ + @@ -73106,12 +73242,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+
- - - - @@ -73126,7 +73259,73 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ bisher: FrameCnt getNextAnchorPoint() +

+ +
+ +
+ + + +
+
+ + + + + + + @@ -73291,7 +73490,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

- + @@ -74079,6 +74278,44 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + +

+ ...ein eigenartiger Widerspruch, den ich nicht auflösen kann... +

+

+ Absolut ⟹ nicht relativ ⟹ nicht explizit auf etwas bezogen ⟹ also implizit auf „den Nullpunkt“ bezogen ⟹ also relativ zur jeweiligen Timeline +

+ +
+
+ + + + + + + +

+ »Deadline« ist immer in realTime +

+ +
+ + + + + + @@ -74481,12 +74718,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- +
- + + @@ -74557,6 +74795,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+