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

Function CalculateNumYLevels

Source/ThirdParty/tinyexr.h:7060–7096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7058}
7059
7060static int CalculateNumYLevels(const EXRHeader* exr_header) {
7061 int min_x = exr_header->data_window.min_x;
7062 int max_x = exr_header->data_window.max_x;
7063 int min_y = exr_header->data_window.min_y;
7064 int max_y = exr_header->data_window.max_y;
7065 int num = 0;
7066
7067 switch (exr_header->tile_level_mode) {
7068 case TINYEXR_TILE_ONE_LEVEL:
7069
7070 num = 1;
7071 break;
7072
7073 case TINYEXR_TILE_MIPMAP_LEVELS:
7074
7075 {
7076 int w = max_x - min_x + 1;
7077 int h = max_y - min_y + 1;
7078 num = RoundLog2(std::max(w, h), exr_header->tile_rounding_mode) + 1;
7079 }
7080 break;
7081
7082 case TINYEXR_TILE_RIPMAP_LEVELS:
7083
7084 {
7085 int h = max_y - min_y + 1;
7086 num = RoundLog2(h, exr_header->tile_rounding_mode) + 1;
7087 }
7088 break;
7089
7090 default:
7091
7092 return -1;
7093 }
7094
7095 return num;
7096}
7097
7098static bool CalculateNumTiles(std::vector<int>& numTiles,
7099 int toplevel_size,

Callers 1

PrecalculateTileInfoFunction · 0.85

Calls 2

RoundLog2Function · 0.85
maxFunction · 0.50

Tested by

no test coverage detected