Re-enable base jitter capped to +-1px; speed up bursts, shorten pauses

Re-enabled _glitch_base_jitter per request, but capped the shift to
+-1px instead of splitting the difference between the two bands' own
(larger) shift values -- a full-frame shift reads very differently than
a thin band shifting, so it needed to stay subtle. Confirmed no black
border across a full worst-case render (strong zoom, random position,
all 200 frames, all four corners).

Also sped up the RGB-split jitter (GLITCH_HOLD_TICKS 5 -> 2, ~100ms per
state) and shortened the pause between bursts (GLITCH_PAUSE_TICKS
15 -> 3, ~150ms). Payload stayed comfortably under budget despite both
changes adding more distinct frames to encode: 355KB worst case (strong
zoom + random position), vs. the 460KB device limit.
This commit is contained in:
poprhythm committed 2026-10-08 22:07:05 -04:00
1 parent f45cdb6250
commit ae80be329a
1 file changed
+9 -9
+9 -9
View File
@@ -370,8 +370,8 @@ def _zoom_transformation(art_bytes, zoom_scale, zoom_position, subsonic_id):
# (top/height as a fraction of ART_SLOT) are loosely modeled on the one # (top/height as a fraction of ART_SLOT) are loosely modeled on the one
# keyframe that was visible: roughly the top third and an overlapping # keyframe that was visible: roughly the top third and an overlapping
# middle band, each about 30% of the frame's height. # middle band, each about 30% of the frame's height.
GLITCH_HOLD_TICKS = 5 # ~250ms per jitter state at the default 50ms/tick GLITCH_HOLD_TICKS = 2 # ~100ms per jitter state at the default 50ms/tick
GLITCH_PAUSE_TICKS = 15 # ~750ms of clean art between bursts GLITCH_PAUSE_TICKS = 3 # ~150ms of clean art between bursts
GLITCH_STATES_PER_CYCLE = 4 GLITCH_STATES_PER_CYCLE = 4
# A larger pool than any one burst needs, so repeated cycles (see # A larger pool than any one burst needs, so repeated cycles (see
@@ -480,14 +480,14 @@ def _glitch_jitter(zoom):
sequence = [] sequence = []
for cycle_index in range(GLITCH_REPEATS): for cycle_index in range(GLITCH_REPEATS):
for top1, h1, shift1, hue1, top2, h2, shift2, hue2 in _glitch_states_for_cycle(cycle_index): for top1, h1, shift1, hue1, top2, h2, shift2, hue2 in _glitch_states_for_cycle(cycle_index):
# The art itself nudging along with the bands (not just the # The art itself nudges along with the bands, not just the
# bands moving over a static image) was tried here via # bands moving over a static image. Capped to +-1px (rather
# _glitch_base_jitter, splitting the difference between the # than splitting the difference between the two bands' own,
# two bands' own shift values -- commented out, not deleted, # larger shift values) -- a full-frame shift reads very
# pending a call on whether it's actually working well. # differently than a thin band shifting, so it stays subtle.
# base_shift = int((shift1 + shift2) / 2.0) base_shift = max(-1, min(1, int((shift1 + shift2) / 2.0)))
state = render.Stack(children = [ state = render.Stack(children = [
# _glitch_base_jitter(zoom, base_shift), _glitch_base_jitter(zoom, base_shift),
_glitch_band(zoom, top1, h1, shift1, hue1), _glitch_band(zoom, top1, h1, shift1, hue1),
_glitch_band(zoom, top2, h2, shift2, hue2), _glitch_band(zoom, top2, h2, shift2, hue2),
]) ])
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.