減色プログラム
Revision | 67f915e1d3de05afff455785a1b47667ef07dd6a (tree) |
---|---|
Time | 2011-05-19 05:15:07 |
Author | berupon <berupon@gmai...> |
Commiter | berupon |
optimized
@@ -17,4 +17,9 @@ Global | ||
17 | 17 | GlobalSection(SolutionProperties) = preSolution |
18 | 18 | HideSolutionNode = FALSE |
19 | 19 | EndGlobalSection |
20 | + GlobalSection(ExtensibilityGlobals) = postSolution | |
21 | + AMDCaPersistentConfig = Release|Win32 | |
22 | + AMDCaPersistentStartup = color_quantizer | |
23 | + AMDCaProjectFile = C:\projects\color_quantizer\CodeAnalyst\color_quantizer.caw | |
24 | + EndGlobalSection | |
20 | 25 | EndGlobal |
@@ -282,6 +282,12 @@ void compute_initial_s( | ||
282 | 282 | int coarse_width = coarse_variables.width_; |
283 | 283 | int coarse_height = coarse_variables.height_; |
284 | 284 | int center_x = (b.width_-1)/2, center_y = (b.height_-1)/2; |
285 | + | |
286 | + printf( | |
287 | + "%s started %d %d %d\n", | |
288 | + __FUNCTION__, palette_size, coarse_width, coarse_height | |
289 | + ); | |
290 | + | |
285 | 291 | Color4f center_b = b_value(b,0,0,0,0); |
286 | 292 | Color4f zero_vector; |
287 | 293 | zero_vector.zero(); |
@@ -290,6 +296,36 @@ void compute_initial_s( | ||
290 | 296 | s[alpha][v] = zero_vector; |
291 | 297 | } |
292 | 298 | } |
299 | +#if 1 | |
300 | + const size_t cv_plane_size = coarse_width * coarse_height; | |
301 | + for (size_t i_y=0; i_y<coarse_height; i_y++) { | |
302 | + for (size_t i_x=0; i_x<coarse_width; i_x++) { | |
303 | + int max_j_x = min<int>(coarse_width, i_x - center_x + b.width_); | |
304 | + int max_j_y = min<int>(coarse_height, i_y - center_y + b.height_); | |
305 | + for (size_t j_y=max<int>(0, i_y - center_y); j_y<max_j_y; j_y++) { | |
306 | + for (size_t j_x=max<int>(0, i_x - center_x); j_x<max_j_x; j_x++) { | |
307 | + if (i_x == j_x && i_y == j_y) continue; | |
308 | + Color4f b_ij = b_value(b,i_x,i_y,j_x,j_y); | |
309 | + const float* p_icv = coarse_variables.pBuff_ + i_y * coarse_width + i_x; | |
310 | + for (size_t v=0; v<palette_size; ++v) { | |
311 | + Color4f b_ij2 = b_ij * (*p_icv); | |
312 | + p_icv += cv_plane_size; | |
313 | + const float* p_jcv = coarse_variables.pBuff_ + cv_plane_size * v + j_y * coarse_width + j_x; | |
314 | + Color4f* ps = s.pBuff_ + v * palette_size + v; | |
315 | + for (size_t alpha=v; alpha<palette_size; ++alpha) { | |
316 | + *ps += (*p_jcv) * b_ij2; | |
317 | + p_jcv += cv_plane_size; | |
318 | + ps += palette_size; | |
319 | + } | |
320 | + } | |
321 | + } | |
322 | + } | |
323 | + for (int v=0; v<palette_size; v++) { | |
324 | + s[v][v] += coarse_variables(v,i_y,i_x)*center_b; | |
325 | + } | |
326 | + } | |
327 | + } | |
328 | +#else | |
293 | 329 | for (int i_y=0; i_y<coarse_height; i_y++) { |
294 | 330 | for (int i_x=0; i_x<coarse_width; i_x++) { |
295 | 331 | int max_j_x = min<int>(coarse_width, i_x - center_x + b.width_); |
@@ -312,6 +348,8 @@ void compute_initial_s( | ||
312 | 348 | } |
313 | 349 | } |
314 | 350 | } |
351 | +#endif | |
352 | + printf("%s finished\n", __FUNCTION__); | |
315 | 353 | } |
316 | 354 | |
317 | 355 | void update_s( |