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

Function GetImageCentered

cmp_core/shaders/bc7_encode_kernel.cpp:510–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508};
509
510void GetImageCentered(CGV_FLOAT image_centered_out[SOURCE_BLOCK_SIZE * MAX_CHANNELS],
511 CGV_FLOAT mean_out[MAX_CHANNELS],
512 CGV_FLOAT image_src[SOURCE_BLOCK_SIZE * MAX_CHANNELS],
513 CGV_INT numEntries, // < 16
514 CGU_UINT8 channels3or4)
515{ // IN: 3 = RGB or 4 = RGBA (4 = MAX_CHANNELS)
516 for (CGU_UINT8 ch = 0; ch < channels3or4; ch++)
517 {
518 mean_out[ch] = 0.0F;
519 if (numEntries > 0)
520 {
521 for (CGV_INT k = 0; k < numEntries; k++)
522 {
523 mean_out[ch] = mean_out[ch] + image_src[k + (ch * SOURCE_BLOCK_SIZE)];
524 }
525 mean_out[ch] /= numEntries;
526 for (CGV_INT k = 0; k < numEntries; k++)
527 image_centered_out[k + (ch * SOURCE_BLOCK_SIZE)] = image_src[k + (ch * SOURCE_BLOCK_SIZE)] - mean_out[ch];
528 }
529 }
530}
531
532void GetCovarianceVector(CGV_FLOAT covariance_out[MAX_CHANNELS * MAX_CHANNELS], // OUT: Covariance vector
533 CGV_FLOAT image_centered[SOURCE_BLOCK_SIZE * MAX_CHANNELS],

Callers 1

GetQuantizeIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected