MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / VerifyChannel

Function VerifyChannel

cmp_unittests/codecbuffer_tests.cpp:275–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273
274template <typename T>
275static void VerifyChannel(CCodecBuffer* buffer, uint x, uint y, uint w, uint h, TestChannel channel, bool allEqual = false)
276{
277 T* readData = (T*)calloc(w * h, sizeof(T));
278
279 bool error = false;
280
281 if (channel == RED_CHANNEL)
282 error = buffer->ReadBlockR(x, y, w, h, readData);
283 else if (channel == GREEN_CHANNEL)
284 error = buffer->ReadBlockG(x, y, w, h, readData);
285 else if (channel == BLUE_CHANNEL)
286 error = buffer->ReadBlockB(x, y, w, h, readData);
287 else if (channel == ALPHA_CHANNEL)
288 error = buffer->ReadBlockA(x, y, w, h, readData);
289
290 CHECK(error);
291
292 T* srcData = GetSrcDataOfType<T>();
293
294 for (uint i = 0; i < w * h; ++i)
295 {
296 if (allEqual)
297 CheckEqual(readData[i], readData[0]);
298 else
299 CheckEqual(readData[i], srcData[y * w + x + i]);
300 }
301
302 free(readData);
303}
304
305template <typename T>
306static inline void VerifyRedChannel(CCodecBuffer* buffer, uint x, uint y, uint w, uint h, bool allEqual = false)

Callers

nothing calls this directly

Calls 5

CheckEqualFunction · 0.85
ReadBlockRMethod · 0.45
ReadBlockGMethod · 0.45
ReadBlockBMethod · 0.45
ReadBlockAMethod · 0.45

Tested by

no test coverage detected