• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

減色プログラム


Commit MetaInfo

Revision67f915e1d3de05afff455785a1b47667ef07dd6a (tree)
Time2011-05-19 05:15:07
Authorberupon <berupon@gmai...>
Commiterberupon

Log Message

optimized

Change Summary

Incremental Difference

--- a/color_quantizer.sln
+++ b/color_quantizer.sln
@@ -17,4 +17,9 @@ Global
1717 GlobalSection(SolutionProperties) = preSolution
1818 HideSolutionNode = FALSE
1919 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
2025 EndGlobal
--- a/quantize.cpp
+++ b/quantize.cpp
@@ -282,6 +282,12 @@ void compute_initial_s(
282282 int coarse_width = coarse_variables.width_;
283283 int coarse_height = coarse_variables.height_;
284284 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+
285291 Color4f center_b = b_value(b,0,0,0,0);
286292 Color4f zero_vector;
287293 zero_vector.zero();
@@ -290,6 +296,36 @@ void compute_initial_s(
290296 s[alpha][v] = zero_vector;
291297 }
292298 }
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
293329 for (int i_y=0; i_y<coarse_height; i_y++) {
294330 for (int i_x=0; i_x<coarse_width; i_x++) {
295331 int max_j_x = min<int>(coarse_width, i_x - center_x + b.width_);
@@ -312,6 +348,8 @@ void compute_initial_s(
312348 }
313349 }
314350 }
351+#endif
352+ printf("%s finished\n", __FUNCTION__);
315353 }
316354
317355 void update_s(