MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / CalculateNumXLevels

Function CalculateNumXLevels

Source/ThirdParty/tinyexr.h:7022–7058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7020}
7021
7022static int CalculateNumXLevels(const EXRHeader* exr_header) {
7023 int min_x = exr_header->data_window.min_x;
7024 int max_x = exr_header->data_window.max_x;
7025 int min_y = exr_header->data_window.min_y;
7026 int max_y = exr_header->data_window.max_y;
7027
7028 int num = 0;
7029 switch (exr_header->tile_level_mode) {
7030 case TINYEXR_TILE_ONE_LEVEL:
7031
7032 num = 1;
7033 break;
7034
7035 case TINYEXR_TILE_MIPMAP_LEVELS:
7036
7037 {
7038 int w = max_x - min_x + 1;
7039 int h = max_y - min_y + 1;
7040 num = RoundLog2(std::max(w, h), exr_header->tile_rounding_mode) + 1;
7041 }
7042 break;
7043
7044 case TINYEXR_TILE_RIPMAP_LEVELS:
7045
7046 {
7047 int w = max_x - min_x + 1;
7048 num = RoundLog2(w, exr_header->tile_rounding_mode) + 1;
7049 }
7050 break;
7051
7052 default:
7053
7054 return -1;
7055 }
7056
7057 return num;
7058}
7059
7060static int CalculateNumYLevels(const EXRHeader* exr_header) {
7061 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