From 8694d9ebc1902279d5a75f2e068819cd68022d24 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 10 Feb 2025 22:48:31 +0100 Subject: [PATCH] Invocation: also provide a mixer node backed by ''Test Rand'' --- tests/core/steam/engine/node-devel-test.cpp | 60 ++- .../core/steam/engine/test-rand-ontology.hpp | 43 +- tests/core/steam/engine/testframe.cpp | 7 +- tests/core/steam/engine/testframe.hpp | 1 + wiki/thinkPad.ichthyo.mm | 392 +++++++++++++----- 5 files changed, 384 insertions(+), 119 deletions(-) diff --git a/tests/core/steam/engine/node-devel-test.cpp b/tests/core/steam/engine/node-devel-test.cpp index a72f8330c..00f642520 100644 --- a/tests/core/steam/engine/node-devel-test.cpp +++ b/tests/core/steam/engine/node-devel-test.cpp @@ -389,9 +389,9 @@ namespace test { // reproduce the same checksum... buff.buildData(frameNr,flavour); CHECK (buff->isPristine()); - CHECK (checksum != buff->markChecksum()); + CHECK (checksum != buff->getChecksum()); ont::manipulateFrame (buff, buff, param); - CHECK (checksum == buff->markChecksum()); + CHECK (checksum == buff->getChecksum()); // Build a node using this processing-functor... ProcNode nSrc = makeSrcNode (frameNr,flavour); @@ -427,13 +427,65 @@ namespace test { } + /** @test use the »TestRand«-framework to setup a two-chain mixer node - * + * - demonstrate convenience setup to package the ont::combineFrames() as »mix« Node + * - this time, we need two source chains, both generating \ref TestFrame data + * - complete processing with all steps can be verified by performing similar + * computations directly and comparing the result checksum. */ void testRand_buildMixNode() { - UNIMPLEMENTED ("Mixer Node"); + auto spec = testRand().setupCombinator(); + CHECK (spec.PROTO == "combine-TestFrame"_expect); + + // generate a binding as processing-functor + auto procFun = spec.makeFun(); + using Sig = lib::meta::_Fun::Sig; + CHECK (showType() == "void (double, array, " + "engine::test::TestFrame*)"_expect); //^^/////////////////TICKET #1391 needlessly rendered as `long` + size_t frameNr = defaultGen.u64(); + uint flavour = defaultGen.u64(); + double mix = defaultGen.uni(); + + // Build node graph to combine two chains + ProcNode nS1 = makeSrcNode (frameNr,flavour+0); + ProcNode nS2 = makeSrcNode (frameNr,flavour+1); + ProcNode nMix{prepareNode(spec.nodeID()) + .preparePort() + .invoke(spec.procID(), procFun) + .setParam(mix) + .connectLead(nS1) + .connectLead(nS2) + .completePort() + .build()}; + + CHECK (not watch(nMix).isSrc()); + CHECK (watch(nS1).getNodeSpec() == "Test:generate-◎"_expect ); + CHECK (watch(nS2).getNodeSpec() == "Test:generate-◎"_expect ); + CHECK (watch(nMix).getNodeSpec() == "Test:combine┉┉{Test:generate}"_expect ); + CHECK (watch(nMix).getPortSpec(0) == "combine(TestFrame/2)"_expect ); + + // prepare to invoke this Node chain... + BufferProvider& provider = DiagnosticBufferProvider::build(); + BuffHandle buffHandle = provider.lockBuffer (provider.getDescriptorFor(sizeof(TestFrame))); + CHECK (not buffHandle.accessAs().isValid()); + uint port{0}; + + // Trigger Node invocation... + buffHandle = nMix.pull (port, buffHandle, Time::ZERO, ProcessKey{0}); + + CHECK (buffHandle.accessAs().isValid()); + HashVal checksum = buffHandle.accessAs().getChecksum(); + buffHandle.release(); + + // verify the result data by reproducing it through direct computation + Buffer bu1, bu2; + bu1.buildData(frameNr,flavour+0); + bu2.buildData(frameNr,flavour+1); + ont::combineFrames (bu1, bu1, bu2, mix); + CHECK (bu1->getChecksum() == checksum); } }; diff --git a/tests/core/steam/engine/test-rand-ontology.hpp b/tests/core/steam/engine/test-rand-ontology.hpp index d248ce060..e627947e1 100644 --- a/tests/core/steam/engine/test-rand-ontology.hpp +++ b/tests/core/steam/engine/test-rand-ontology.hpp @@ -124,6 +124,7 @@ namespace test { auto setupGenerator(); auto setupManipulator(); + auto setupCombinator(); private: }; @@ -229,6 +230,34 @@ namespace test { % streamType; } }; + + /** extended config for combining/mixing operations */ + struct ConfMix + { + using InFeed = std::array; + string streamType; + + ConfMix(Spec const& spec) + : streamType{spec.BASE_TYPE} + { } + + auto + binding() + { + return [] + (Factr mix, InFeed inChan, TestFrame* out) + { + combineFrames (out, inChan[0],inChan[1], mix); + }; + } + + string + procSpec() + { + return _Fmt{"(%s/2)"} + % streamType; + } + }; }//(End)namespace ont @@ -243,9 +272,8 @@ namespace test { return builder; } - /** - * Initiate configuration of a generator-node to produce TestFrame(s) + * Initiate configuration of a filter-node to manipulate TestFrame(s) */ inline auto TestRandOntology::setupManipulator() @@ -255,6 +283,17 @@ namespace test { return builder; } + /** + * Initiate configuration for a mixing-node to combine TestFrame(s) + */ + inline auto + TestRandOntology::setupCombinator() + { + Spec spec{"combine", ont::TYPE_TESTFRAME}; + Builder builder{spec}; + return builder; + } + /** Singleton accessor */ extern lib::Depend testRand; diff --git a/tests/core/steam/engine/testframe.cpp b/tests/core/steam/engine/testframe.cpp index d0a805306..7ea6e7b1b 100644 --- a/tests/core/steam/engine/testframe.cpp +++ b/tests/core/steam/engine/testframe.cpp @@ -365,7 +365,12 @@ namespace test { { return accessHeader().checksum = computeChecksum(); } - + /** access current checksum without recomputing. */ + HashVal + TestFrame::getChecksum() + { + return accessHeader().checksum; + } bool TestFrame::hasValidChecksum() const diff --git a/tests/core/steam/engine/testframe.hpp b/tests/core/steam/engine/testframe.hpp index 61364f52b..d3802a4b6 100644 --- a/tests/core/steam/engine/testframe.hpp +++ b/tests/core/steam/engine/testframe.hpp @@ -105,6 +105,7 @@ namespace test { /** recompute and store checksum based on current contents */ HashVal markChecksum(); + HashVal getChecksum(); /** Helper to verify that a given memory location holds * an active TestFrame instance (created, not yet destroyed) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 783cd45d6..3e5522278 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -92232,8 +92232,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -92241,9 +92241,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -92253,7 +92253,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -92262,8 +92262,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -92809,6 +92809,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -95440,8 +95441,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -99368,21 +99369,36 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + + + + + +

+ umbenannt in MediaWeavingPattern +

+ + +
- + + + + - - - - - + + + + + + + @@ -99393,8 +99409,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -99404,8 +99420,36 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + + + + + + + +

+ man muß den Rückgabewert wirklich weiterverarbeiten; das ist aber eine unvermeidbare Einschränkung, wenn man überhaupt so ein Verhalten mit flexibel weiterentwickelten Typen realisieren will.... +

+ +
+ +
+ + + +
+
+ + + + + + + + @@ -99414,30 +99458,49 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + -
- - - + - + + + + + + + + - + - + - + + + + + + + +

+ Der Prototype wurde selber zu einer Policy, weil er auch das Parameter-Binding mit steuern muß +

+ +
+ +
@@ -99473,7 +99536,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -99486,20 +99549,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + - - + + + + - + @@ -99523,8 +99588,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -99619,9 +99684,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -100619,7 +100684,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -100749,7 +100814,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -100776,7 +100841,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -100787,6 +100852,30 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + +

+ komplexe Typ-Verbindungen +

+

+ noch nie wirklich getestet +

+ +
+ + + + + + + + + + + +
@@ -101891,8 +101980,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- - + + @@ -101941,7 +102030,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + @@ -102027,7 +102117,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + @@ -102054,10 +102145,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + - + @@ -102293,7 +102385,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -102310,8 +102402,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -102373,7 +102465,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -102382,7 +102474,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

- + @@ -102419,9 +102511,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- - - + + +
@@ -103114,9 +103206,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- - - + + + @@ -103163,11 +103255,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - - - + + + + + @@ -103187,7 +103279,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -103197,7 +103289,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -103206,17 +103298,15 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - - + + - - - + @@ -103233,6 +103323,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + @@ -103252,19 +103345,32 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - - + + + + + + + + + + + + + + + + + + + - - - - @@ -103469,8 +103575,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -104222,14 +104328,14 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - - + + + - + @@ -104301,8 +104407,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -104336,6 +104442,47 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + +

+ ergibt hier keinen Sinn — berechnet wird eine einfache lineare Interpolation, zwar ohne Beschränkung des Wertebereichs, jedoch sind aus Sicht des Aufrufers nur Werte [0.0 ... 1.0] plausibel +

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

+ ...damit wird der Binding-Funktor ein Einzeiler +

+ +
+ +
+ + + + +

+ ...da std::array auch das Tuple-Protocol unterstützt; und der Fall mit einem direkt gegebenen Einzel-Argument wird über eine Hilfsfunktion integriert +

+ +
+ +
+
+
+
@@ -104441,8 +104588,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -105115,8 +105262,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -105127,23 +105274,23 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - - + + + - - - + + + - - + + @@ -105199,7 +105346,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- + @@ -105248,6 +105395,22 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + + +

+ ...da war doch irgendwas mit der Sequenz-Nr und Channel-Nr, die habe ich entweder mit anderen Aufrufen harmonisiert oder die Anordnung im Cache verändert; wenn ich mich bloß an die Details erinnern könnte +

+ + +
+
+ +
@@ -107734,7 +107897,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -107783,11 +107946,6 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - - - @@ -107796,6 +107954,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + +
@@ -107808,6 +107971,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + +