mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Last touchups before ripping out the DSL
This commit is contained in:
parent
e4aac6993f
commit
b938c320a8
@ -142,7 +142,7 @@ class IterThread(PTXEntryPoint):
|
||||
camera.get_index(hist_index, x, y, p_valid_pt)
|
||||
comment('if consec_bad < 0, point is fusing; treat as invalid')
|
||||
op.setp.and_.ge.f32(p_valid_pt, consec_bad, 0., p_valid_pt)
|
||||
# TODO: save and pass correct color value here
|
||||
# TODO: save and pass correct xform value here
|
||||
hist.scatter(hist_index, color, 0, p_valid_pt, 'ldst')
|
||||
with block():
|
||||
reg.u32('num_writes')
|
||||
|
19
main.py
19
main.py
@ -40,31 +40,24 @@ def main(args):
|
||||
anim = Animation(genomes)
|
||||
anim.compile()
|
||||
bins = anim.render_frame()
|
||||
|
||||
# Embarrassingly poor (and s-l-o-w) approximation of log filtering, because
|
||||
# I want to keep working on performance right now
|
||||
alpha = np.array([[bins[y][x][3] for x in range(anim.features.hist_width)]
|
||||
for y in range(anim.features.hist_height)])
|
||||
w, h = anim.features.hist_width, anim.features.hist_height
|
||||
bins = bins[:,:w]
|
||||
alpha = bins[...,3]
|
||||
k2ish = (256./(np.mean(alpha)+1e-9))
|
||||
lses = 20 * np.log2(1.0 + alpha * k2ish) / (alpha+1e-6)
|
||||
for x in range(anim.features.hist_width):
|
||||
for y in range(anim.features.hist_height):
|
||||
bins[y][x] *= lses[y][x]
|
||||
bins *= lses.reshape(h,w,1).repeat(4,2)
|
||||
bins = np.minimum(bins, 255)
|
||||
bins = bins.astype(np.uint8)
|
||||
|
||||
if '-g' not in args:
|
||||
return
|
||||
|
||||
print anim.features.hist_width
|
||||
print anim.features.hist_height
|
||||
print anim.features.hist_stride
|
||||
window = pyglet.window.Window(1600, 900)
|
||||
image = pyglet.image.ImageData(anim.features.hist_width,
|
||||
anim.features.hist_height,
|
||||
'RGBA',
|
||||
bins.tostring(),
|
||||
-anim.features.hist_stride*4)
|
||||
bins.tostring())
|
||||
#-anim.features.hist_stride*4)
|
||||
tex = image.texture
|
||||
|
||||
pal = (anim.ctx.ptx.instances[PaletteLookup].pal * 255.).astype(np.uint8)
|
||||
|
Loading…
Reference in New Issue
Block a user