MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / wav2Decode

Function wav2Decode

external/astc-encoder/Source/ThirdParty/tinyexr.h:8150–8263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8148//
8149
8150static void wav2Decode(
8151 unsigned short *in, // io: values are transformed in place
8152 int nx, // i : x size
8153 int ox, // i : x offset
8154 int ny, // i : y size
8155 int oy, // i : y offset
8156 unsigned short mx) // i : maximum in[x][y] value
8157{
8158 bool w14 = (mx < (1 << 14));
8159 int n = (nx > ny) ? ny : nx;
8160 int p = 1;
8161 int p2;
8162
8163 //
8164 // Search max level
8165 //
8166
8167 while (p <= n) p <<= 1;
8168
8169 p >>= 1;
8170 p2 = p;
8171 p >>= 1;
8172
8173 //
8174 // Hierarchical loop on smaller dimension n
8175 //
8176
8177 while (p >= 1) {
8178 unsigned short *py = in;
8179 unsigned short *ey = in + oy * (ny - p2);
8180 int oy1 = oy * p;
8181 int oy2 = oy * p2;
8182 int ox1 = ox * p;
8183 int ox2 = ox * p2;
8184 unsigned short i00, i01, i10, i11;
8185
8186 //
8187 // Y loop
8188 //
8189
8190 for (; py <= ey; py += oy2) {
8191 unsigned short *px = py;
8192 unsigned short *ex = py + ox * (nx - p2);
8193
8194 //
8195 // X loop
8196 //
8197
8198 for (; px <= ex; px += ox2) {
8199 unsigned short *p01 = px + ox1;
8200 unsigned short *p10 = px + oy1;
8201 unsigned short *p11 = p10 + ox1;
8202
8203 //
8204 // 2D wavelet decoding
8205 //
8206
8207 if (w14) {

Callers 1

DecompressPizFunction · 0.85

Calls 2

wdec14Function · 0.85
wdec16Function · 0.85

Tested by

no test coverage detected