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

Function VerifyOffsetBlock

cmp_unittests/codecbuffer_tests.cpp:516–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514
515template <typename T>
516static void VerifyOffsetBlock(CCodecBuffer* buffer, uint blockOffsetX, uint blockOffsetY, T* testData)
517{
518 // verify RGBA block
519
520 T block[k_blockWidth * k_blockHeight * 4] = {};
521
522 CMP_DWORD bufferWidth = buffer->GetWidth();
523
524 CHECK(buffer->ReadBlockRGBA(blockOffsetX * k_blockWidth, blockOffsetY * k_blockHeight, k_blockWidth, k_blockHeight, block));
525
526 uint channelCount = buffer->GetChannelCount();
527
528 uint blockOffset = blockOffsetY * k_blockHeight * bufferWidth * 4 + blockOffsetX * k_blockWidth * 4;
529
530 for (uint row = 0; row < k_blockWidth; ++row)
531 {
532 for (uint col = 0; col < k_blockHeight; ++col)
533 {
534 for (uint channel = 0; channel < channelCount; ++channel)
535 {
536 CheckEqual(block[row * k_blockWidth * 4 + col * 4 + channel], testData[blockOffset + row * bufferWidth * 4 + col * 4 + channel]);
537 }
538 }
539 }
540
541 // verify individual channels
542
543 VerifyOffsetBlockChannel(buffer, blockOffsetX, blockOffsetY, testData, RED_CHANNEL);
544 VerifyOffsetBlockChannel(buffer, blockOffsetX, blockOffsetY, testData, GREEN_CHANNEL);
545 VerifyOffsetBlockChannel(buffer, blockOffsetX, blockOffsetY, testData, BLUE_CHANNEL);
546
547 if (channelCount == 4)
548 VerifyOffsetBlockChannel(buffer, blockOffsetX, blockOffsetY, testData, ALPHA_CHANNEL);
549}
550
551// TESTS
552

Callers 1

Calls 5

CheckEqualFunction · 0.85
VerifyOffsetBlockChannelFunction · 0.85
GetWidthMethod · 0.45
ReadBlockRGBAMethod · 0.45
GetChannelCountMethod · 0.45

Tested by

no test coverage detected