📜  c++ 代码 2d 块 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:54.189000             🧑  作者: Mango

代码示例1
for(size_t bx = 0; bx < width;  bx += block_width)
for(size_t by = 0; by < height; by += block_height) {
  float sum = 0;
  for(size_t x = 0; x < block_width; ++x)
  for(size_t y = 0; y < block_height; ++y) {
    sum += array[bx + x][by + y];
  }
  average = sum / (block_width * block_height);
  new_array[bx][by] = average;
}