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

Function CalculateNumXLevels

tutorials/common/image/tinyexr.h:5581–5617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5579}
5580
5581static int CalculateNumXLevels(const EXRHeader* exr_header) {
5582 int min_x = exr_header->data_window.min_x;
5583 int max_x = exr_header->data_window.max_x;
5584 int min_y = exr_header->data_window.min_y;
5585 int max_y = exr_header->data_window.max_y;
5586
5587 int num = 0;
5588 switch (exr_header->tile_level_mode) {
5589 case TINYEXR_TILE_ONE_LEVEL:
5590
5591 num = 1;
5592 break;
5593
5594 case TINYEXR_TILE_MIPMAP_LEVELS:
5595
5596 {
5597 int w = max_x - min_x + 1;
5598 int h = max_y - min_y + 1;
5599 num = RoundLog2(std::max(w, h), exr_header->tile_rounding_mode) + 1;
5600 }
5601 break;
5602
5603 case TINYEXR_TILE_RIPMAP_LEVELS:
5604
5605 {
5606 int w = max_x - min_x + 1;
5607 num = RoundLog2(w, exr_header->tile_rounding_mode) + 1;
5608 }
5609 break;
5610
5611 default:
5612
5613 return -1;
5614 }
5615
5616 return num;
5617}
5618
5619static int CalculateNumYLevels(const EXRHeader* exr_header) {
5620 int min_x = exr_header->data_window.min_x;

Callers 1

PrecalculateTileInfoFunction · 0.85

Calls 2

RoundLog2Function · 0.85
maxFunction · 0.50

Tested by

no test coverage detected