hyperframes 0.8.70 → 0.8.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54528,6 +54528,10 @@ uniform vec2 u_size;
54528
54528
  uniform float u_t;
54529
54529
  uniform float u_fps;
54530
54530
  uniform sampler2D u_src;
54531
+ uniform sampler2D u_src2;
54532
+ // 1 when the map ref named another element, 0 when the map is the layer
54533
+ // itself. Set by the runtime for every pass, from whether a ref resolved.
54534
+ uniform float u_hasSrc2;
54531
54535
  uniform float u_useH;
54532
54536
  uniform float u_maxH;
54533
54537
  uniform float u_useV;
@@ -54555,7 +54559,7 @@ float hfMapChannel(vec4 premultiplied, float selector) {
54555
54559
  }
54556
54560
 
54557
54561
  void main() {
54558
- vec4 mapTexel = texture(u_src, v_uv);
54562
+ vec4 mapTexel = u_hasSrc2 > 0.5 ? texture(u_src2, v_uv) : texture(u_src, v_uv);
54559
54563
  float h = hfMapChannel(mapTexel, u_useH);
54560
54564
  float v = hfMapChannel(mapTexel, u_useV);
54561
54565
  vec2 d = vec2((h - 0.5) * 2.0 * u_maxH, (v - 0.5) * 2.0 * u_maxV);
@@ -54565,6 +54569,135 @@ void main() {
54565
54569
  }
54566
54570
  });
54567
54571
 
54572
+ // ../core/dist/vfx/lumaMatte.frag.js
54573
+ var lumaR2, lumaG2, lumaB2, LUMA_MATTE_FRAG;
54574
+ var init_lumaMatte_frag = __esm({
54575
+ "../core/dist/vfx/lumaMatte.frag.js"() {
54576
+ "use strict";
54577
+ init_displacementMap_frag();
54578
+ ({ lumaR: lumaR2, lumaG: lumaG2, lumaB: lumaB2 } = DISPLACEMENT_MAP_CONSTANTS);
54579
+ LUMA_MATTE_FRAG = `#version 300 es
54580
+ precision highp float;
54581
+
54582
+ in vec2 v_uv;
54583
+ out vec4 fragColor;
54584
+
54585
+ uniform vec2 u_size;
54586
+ uniform float u_t;
54587
+ uniform float u_fps;
54588
+ uniform sampler2D u_src;
54589
+ uniform sampler2D u_src2;
54590
+ uniform float u_mode;
54591
+
54592
+ // The matte texel is premultiplied, so its rgb is already "over black" \u2014 the
54593
+ // composite After Effects reads a luma matte through.
54594
+ float hfCoverage(vec4 matte, float mode) {
54595
+ if (mode < 1.5) return matte.a;
54596
+ if (mode < 2.5) return 1.0 - matte.a;
54597
+ float luma = dot(matte.rgb, vec3(${lumaR2}, ${lumaG2}, ${lumaB2}));
54598
+ if (mode < 3.5) return luma;
54599
+ return 1.0 - luma;
54600
+ }
54601
+
54602
+ void main() {
54603
+ vec4 src = texture(u_src, v_uv);
54604
+ vec4 matte = texture(u_src2, v_uv);
54605
+ fragColor = src * clamp(hfCoverage(matte, u_mode), 0.0, 1.0);
54606
+ }
54607
+ `;
54608
+ }
54609
+ });
54610
+
54611
+ // ../core/dist/vfx/noise.frag.js
54612
+ var NOISE_CONSTANTS, lcgMulA, lcgMulB, lcgAdd, highMask, lowMask, byteScale, NOISE_FRAG;
54613
+ var init_noise_frag = __esm({
54614
+ "../core/dist/vfx/noise.frag.js"() {
54615
+ "use strict";
54616
+ NOISE_CONSTANTS = {
54617
+ lcgMulA: 1103515245,
54618
+ lcgMulB: 12996205,
54619
+ lcgAdd: 12345,
54620
+ highMask: 32640,
54621
+ lowMask: 255,
54622
+ byteScale: 32704
54623
+ };
54624
+ ({ lcgMulA, lcgMulB, lcgAdd, highMask, lowMask, byteScale } = NOISE_CONSTANTS);
54625
+ NOISE_FRAG = `#version 300 es
54626
+ precision highp float;
54627
+ // NOT decoration: a fragment shader's default integer precision is mediump,
54628
+ // and a mediump uint is only guaranteed 16 bits (ESSL 3.00 \xA74.5.2). Every step
54629
+ // below \u2014 the Jenkins mix, both LCG rounds \u2014 is defined by 32-bit wraparound,
54630
+ // so without this the hash is a different function on any implementation that
54631
+ // honours the minimum. ANGLE and SwiftShader both use 32-bit ints, which is
54632
+ // exactly why no test on this machine would catch it.
54633
+ precision highp int;
54634
+
54635
+ in vec2 v_uv;
54636
+ out vec4 fragColor;
54637
+
54638
+ uniform vec2 u_size;
54639
+ uniform float u_t;
54640
+ uniform float u_fps;
54641
+ uniform sampler2D u_src;
54642
+ uniform float u_amount;
54643
+ uniform float u_useColorNoise;
54644
+ uniform float u_clipping;
54645
+
54646
+ // Bob Jenkins' 1997 integer mix, the six-round shift/xor/subtract sequence the
54647
+ // metallib runs verbatim. uint arithmetic wraps in GLSL ES 3.00, which is what
54648
+ // makes this bit-identical to the C original.
54649
+ uint hfJenkinsMix(uint a, uint b, uint c) {
54650
+ a -= b; a -= c; a ^= (c >> 13u);
54651
+ b -= c; b -= a; b ^= (a << 8u);
54652
+ c -= a; c -= b; c ^= (b >> 13u);
54653
+ a -= b; a -= c; a ^= (c >> 12u);
54654
+ b -= c; b -= a; b ^= (a << 16u);
54655
+ c -= a; c -= b; c ^= (b >> 5u);
54656
+ a -= b; a -= c; a ^= (c >> 3u);
54657
+ b -= c; b -= a; b ^= (a << 10u);
54658
+ c -= a; c -= b; c ^= (b >> 15u);
54659
+ return c;
54660
+ }
54661
+
54662
+ // The hash's 15-bit output byte for one channel.
54663
+ float hfNoiseByte(uint a, uint y, uint seed) {
54664
+ uint h = hfJenkinsMix(a, y, seed);
54665
+ uint t2 = h * ${lcgMulA}u + ${lcgAdd}u;
54666
+ uint t4 = t2 * ${lcgMulB}u + ${lcgAdd}u;
54667
+ return float(((t4 >> 16u) & ${lowMask}u) ^ ((t2 >> 9u) & ${highMask}u));
54668
+ }
54669
+
54670
+ void main() {
54671
+ vec4 src = texture(u_src, v_uv);
54672
+ vec2 px = floor(v_uv * u_size);
54673
+ uint x = uint(max(px.x, 0.0));
54674
+ // After Effects indexes rows from the top; v_uv is y-up.
54675
+ uint y = uint(max(u_size.y - 1.0 - px.y, 0.0));
54676
+ float frame = floor(u_t * u_fps + 0.5);
54677
+ uint seed = uint(max(frame, 0.0)) & 0xFFFFu;
54678
+
54679
+ float amount = u_amount * 0.01;
54680
+ vec3 nz;
54681
+ if (u_useColorNoise > 0.5) {
54682
+ uint a = x * 3u;
54683
+ nz = vec3(hfNoiseByte(a, y, seed), hfNoiseByte(a + 1u, y, seed), hfNoiseByte(a + 2u, y, seed));
54684
+ } else {
54685
+ nz = vec3(hfNoiseByte(x, y, seed));
54686
+ }
54687
+ nz = amount * (nz / ${byteScale}.0 - 0.5);
54688
+
54689
+ vec4 out4 = vec4(src.rgb + nz, src.a);
54690
+ // A valid premultiplied colour needs rgb <= a component-wise; noise on a
54691
+ // near-transparent texel can push rgb above it, which our fixed 8-bit RGBA
54692
+ // storage cannot carry safely the way AE's float pipeline can (see the doc
54693
+ // comment above). This runs before, and independently of, u_clipping.
54694
+ out4.rgb = min(out4.rgb, out4.a);
54695
+ fragColor = u_clipping > 0.5 ? clamp(out4, 0.0, 1.0) : out4;
54696
+ }
54697
+ `;
54698
+ }
54699
+ });
54700
+
54568
54701
  // ../core/dist/vfx/waveWarp.frag.js
54569
54702
  var WAVE_WARP_CONSTANTS, tau, degreesPerTurn, WAVE_WARP_FRAG;
54570
54703
  var init_waveWarp_frag = __esm({
@@ -54690,6 +54823,8 @@ var init_vfx = __esm({
54690
54823
  "use strict";
54691
54824
  init_fractalNoise_frag();
54692
54825
  init_displacementMap_frag();
54826
+ init_lumaMatte_frag();
54827
+ init_noise_frag();
54693
54828
  init_waveWarp_frag();
54694
54829
  HF_VFX_ATTR = "data-vfx-chain";
54695
54830
  HF_VFX_CHAIN_VERSION = 1;
@@ -54914,6 +55049,14 @@ var init_vfx = __esm({
54914
55049
  capture: "self",
54915
55050
  frag: DISPLACEMENT_MAP_FRAG,
54916
55051
  params: [
55052
+ {
55053
+ kind: "ref",
55054
+ key: "map",
55055
+ label: "Displacement Map Layer",
55056
+ // Optional: empty means the AE default the corpus uses, a map layer
55057
+ // pointing at the layer itself, which `u_src` already holds.
55058
+ optional: true
55059
+ },
54917
55060
  {
54918
55061
  kind: "enum",
54919
55062
  key: "useH",
@@ -54975,6 +55118,67 @@ var init_vfx = __esm({
54975
55118
  default: true
54976
55119
  }
54977
55120
  ]
55121
+ },
55122
+ {
55123
+ id: "luma-matte",
55124
+ label: "Matte",
55125
+ // Not one AE effect: the runtime form of every matte the exporter cannot
55126
+ // express as CSS — unsupported track-matte sources, stencils and
55127
+ // silhouettes, Set Matte. Which element is the source and which the matte
55128
+ // is the exporter's choice of what to wrap and what to name in `matte`.
55129
+ capture: "self",
55130
+ frag: LUMA_MATTE_FRAG,
55131
+ params: [
55132
+ { kind: "ref", key: "matte", label: "Matte Layer" },
55133
+ {
55134
+ kind: "enum",
55135
+ key: "mode",
55136
+ label: "Matte Mode",
55137
+ options: [
55138
+ { value: 1, label: "Alpha" },
55139
+ { value: 2, label: "Alpha Inverted" },
55140
+ { value: 3, label: "Luma" },
55141
+ { value: 4, label: "Luma Inverted" }
55142
+ ],
55143
+ default: 1
55144
+ }
55145
+ ]
55146
+ },
55147
+ {
55148
+ id: "noise",
55149
+ label: "Noise",
55150
+ ae: "ADBE Noise",
55151
+ // `self` on a content layer and `backdrop` on an adjustment layer are the
55152
+ // same kernel reading the same `u_src`; the runtime resolves which from
55153
+ // the DOM (a `data-vfx-for` wrapper), so the def declares only that a
55154
+ // texture is needed.
55155
+ capture: "self",
55156
+ frag: NOISE_FRAG,
55157
+ params: [
55158
+ {
55159
+ kind: "number",
55160
+ key: "amount",
55161
+ label: "Amount of Noise",
55162
+ unit: "%",
55163
+ min: 0,
55164
+ max: 400,
55165
+ step: 0.1,
55166
+ default: 0,
55167
+ animatable: true
55168
+ },
55169
+ {
55170
+ kind: "bool",
55171
+ key: "useColorNoise",
55172
+ label: "Use Color Noise",
55173
+ default: false
55174
+ },
55175
+ {
55176
+ kind: "bool",
55177
+ key: "clipping",
55178
+ label: "Clip Result Values",
55179
+ default: true
55180
+ }
55181
+ ]
54978
55182
  }
54979
55183
  ];
54980
55184
  BY_ID2 = new Map(HF_VFX.map((d) => [d.id, d]));
@@ -63342,9 +63546,18 @@ async function extractMediaMetadata(filePath) {
63342
63546
  const streamStart = Number.isFinite(parsedStreamStart) ? parsedStreamStart : 0;
63343
63547
  const parsedNbFrames = videoStream.nb_frames ? parseInt(videoStream.nb_frames, 10) : NaN;
63344
63548
  const frames = Number.isFinite(parsedNbFrames) && parsedNbFrames > 0 ? parsedNbFrames : void 0;
63549
+ let effectiveStreamDuration;
63550
+ if (streamDuration > 0) {
63551
+ effectiveStreamDuration = streamDuration;
63552
+ } else if (frames !== void 0 && fps > 0 && containerDuration > 0) {
63553
+ const frameDerivedDuration = frames / fps;
63554
+ effectiveStreamDuration = frameDerivedDuration < containerDuration * 0.9 ? frameDerivedDuration : containerDuration;
63555
+ } else {
63556
+ effectiveStreamDuration = containerDuration;
63557
+ }
63345
63558
  return {
63346
63559
  durationSeconds: containerDuration,
63347
- videoStreamDurationSeconds: streamDuration > 0 ? streamDuration : containerDuration,
63560
+ videoStreamDurationSeconds: effectiveStreamDuration,
63348
63561
  videoStreamStartSeconds: streamStart,
63349
63562
  width: videoStream.width || stillImage()?.width || 0,
63350
63563
  height: videoStream.height || stillImage()?.height || 0,
@@ -103737,8 +103950,8 @@ async function runFontLocalize(io, localize) {
103737
103950
  }
103738
103951
 
103739
103952
  // src/version.ts
103740
- var VERSION = true ? "0.8.70" : "0.0.0-dev";
103741
- var PRODUCER_VERSION = true ? "0.8.70" : "0.0.0-dev";
103953
+ var VERSION = true ? "0.8.72" : "0.0.0-dev";
103954
+ var PRODUCER_VERSION = true ? "0.8.72" : "0.0.0-dev";
103742
103955
 
103743
103956
  // src/fontLocalizeCli.ts
103744
103957
  async function readStdin() {