MCPcopy Create free account
hub / github.com/RenderKit/embree / CalculateNumYLevels

Function CalculateNumYLevels

tutorials/common/image/tinyexr.h:5619–5655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5617}
5618
5619static int CalculateNumYLevels(const EXRHeader* exr_header) {
5620 int min_x = exr_header->data_window.min_x;
5621 int max_x = exr_header->data_window.max_x;
5622 int min_y = exr_header->data_window.min_y;
5623 int max_y = exr_header->data_window.max_y;
5624 int num = 0;
5625
5626 switch (exr_header->tile_level_mode) {
5627 case TINYEXR_TILE_ONE_LEVEL:
5628
5629 num = 1;
5630 break;
5631
5632 case TINYEXR_TILE_MIPMAP_LEVELS:
5633
5634 {
5635 int w = max_x - min_x + 1;
5636 int h = max_y - min_y + 1;
5637 num = RoundLog2(std::max(w, h), exr_header->tile_rounding_mode) + 1;
5638 }
5639 break;
5640
5641 case TINYEXR_TILE_RIPMAP_LEVELS:
5642
5643 {
5644 int h = max_y - min_y + 1;
5645 num = RoundLog2(h, exr_header->tile_rounding_mode) + 1;
5646 }
5647 break;
5648
5649 default:
5650
5651 return -1;
5652 }
5653
5654 return num;
5655}
5656
5657static bool CalculateNumTiles(std::vector<int>& numTiles,
5658 int toplevel_size,

Callers 1

PrecalculateTileInfoFunction · 0.85

Calls 2

RoundLog2Function · 0.85
maxFunction · 0.50

Tested by

no test coverage detected