From 09725ba794a992ecec0e068ce4a8f6d6130d498d Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Wed, 21 Dec 2011 11:59:40 -0500 Subject: [PATCH] Correct dither fail. --- cuburn/code/interp.py | 3 +-- cuburn/code/iter.py | 27 ++++++++++++++------------- cuburn/render.py | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cuburn/code/interp.py b/cuburn/code/interp.py index 8a07395..f3d4a7b 100644 --- a/cuburn/code/interp.py +++ b/cuburn/code/interp.py @@ -221,14 +221,13 @@ class GenomePacker(HunkOCode): __global__ void interp_{{tname}}( - {{tname}}* out, mwc_st *rctxes, + {{tname}}* out, const float *times, const float *knots, float tstart, float tstep, int maxid ) { int id = gtid(); if (id >= maxid) return; out = &out[id]; - mwc_st rctx = rctxes[id]; float time = tstart + id * tstep; float *outf = reinterpret_cast(out); diff --git a/cuburn/code/iter.py b/cuburn/code/iter.py index 203a266..7659c9a 100644 --- a/cuburn/code/iter.py +++ b/cuburn/code/iter.py @@ -70,23 +70,15 @@ def precalc_camera(pcam): float cenx = {{pre_cam.center.x}}, ceny = {{pre_cam.center.y}}; float scale = {{pre_cam.scale}} * acc_size.width; - float ditherwidth = {{pre_cam.dither_width}} * 0.33f; - float u0 = mwc_next_01(rctx); - float r = ditherwidth * sqrtf(-2.0f * log2f(u0) / M_LOG2E); - - float u1 = 2.0f * M_PI * mwc_next_01(rctx); - float ditherx = r * cos(u1); - float dithery = r * sin(u1); - {{pre_cam._set('xx')}} = scale * rotcos; {{pre_cam._set('xy')}} = scale * -rotsin; {{pre_cam._set('xo')}} = scale * (rotsin * ceny - rotcos * cenx) - + 0.5f * acc_size.awidth + ditherx; + + 0.5f * acc_size.awidth; {{pre_cam._set('yx')}} = scale * rotsin; {{pre_cam._set('yy')}} = scale * rotcos; {{pre_cam._set('yo')}} = scale * -(rotsin * cenx + rotcos * ceny) - + 0.5f * acc_size.aheight + dithery; + + 0.5f * acc_size.aheight; """).substitute(locals())) @@ -203,13 +195,24 @@ void iter( reinterpret_cast(global_params)[i]; __shared__ int rb_idx; - if (threadIdx.x == 1 && threadIdx.y == 1) + if (threadIdx.y == 1 && threadIdx.x == 1) rb_idx = 32 * blockDim.y * (atomicAdd(&rb_head, 1) % rb_size); __syncthreads(); int this_rb_idx = rb_idx + threadIdx.x + 32 * threadIdx.y; mwc_st rctx = msts[this_rb_idx]; + {{precalc_camera(pcp.camera)}} + if (threadIdx.y == 5 && threadIdx.x == 4) { + float ditherwidth = {{pcp.camera.dither_width}} * 0.5f; + float u0 = mwc_next_01(rctx); + float r = ditherwidth * sqrtf(-2.0f * log2f(u0) / M_LOG2E); + + float u1 = 2.0f * M_PI * mwc_next_01(rctx); + {{pcp.camera.xo}} += r * cos(u1); + {{pcp.camera.yo}} += r * sin(u1); + } + {{if info.acc_mode == 'global'}} __shared__ float time_frac; time_frac = blockIdx.x / (float) gridDim.x; @@ -332,8 +335,6 @@ void iter( float cx, cy, cc; - {{precalc_camera(pcp.camera)}} - {{if 'final' in cp.xforms}} {{apply_affine('fx', 'fy', 'cx', 'cy', pcp.camera)}} cc = fcolor; diff --git a/cuburn/render.py b/cuburn/render.py index 3ae0a64..b3cb405 100644 --- a/cuburn/render.py +++ b/cuburn/render.py @@ -293,7 +293,7 @@ class Renderer(object): block=(256,1,1), grid=(self.palette_height,1), stream=write_stream) - packer_fun(d_infos, d_seeds, d_genome_times, d_genome_knots, + packer_fun(d_infos, d_genome_times, d_genome_knots, f32(ts), f32(td / ntemporal_samples), i32(ntemporal_samples), block=(256,1,1), grid=(int(np.ceil(ntemporal_samples/256.)),1),