PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ calc_tile_size()

static void calc_tile_size ( uint32_t  dimX,
uint32_t  dimY,
int *  tileX,
int *  tileY 
)
static

Definition at line 457 of file raster2pgsql.c.

458{
459 uint32_t min_tile_size = 30;
460 uint32_t max_tile_size = 300;
461
462 for (uint8_t current_dimension = 0; current_dimension <= 1; current_dimension++)
463 {
464 uint32_t img_size = (current_dimension == 0) ? dimX : dimY;
465 uint32_t best_gap = max_tile_size;
466 uint32_t best_size = img_size;
467
468 if (img_size > max_tile_size)
469 {
470 for (uint32_t tile_size = max_tile_size; tile_size >= min_tile_size; tile_size--)
471 {
472 uint32_t gap = img_size % tile_size;
473 if (gap < best_gap)
474 {
475 best_gap = gap;
476 best_size = tile_size;
477 }
478 }
479 }
480
481 if (current_dimension == 0)
482 *tileX = best_size;
483 else
484 *tileY = best_size;
485 }
486}

Referenced by convert_raster().

Here is the caller graph for this function: