Cleanup: Use uint8_t for num of channels.
This commit is contained in:
parent
b9d2e2ec97
commit
a9e64d8613
|
@ -81,7 +81,7 @@ class MemoryBuffer {
|
|||
* \brief the number of channels of a single value in the buffer.
|
||||
* For value buffers this is 1, vector 3 and color 4
|
||||
*/
|
||||
unsigned int m_num_channels;
|
||||
uint8_t m_num_channels;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ class MemoryBuffer {
|
|||
*/
|
||||
~MemoryBuffer();
|
||||
|
||||
unsigned int get_num_channels()
|
||||
uint8_t get_num_channels()
|
||||
{
|
||||
return this->m_num_channels;
|
||||
}
|
||||
|
|
|
@ -93,19 +93,21 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
|||
|
||||
const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBuffer)
|
||||
{
|
||||
const cl_image_format *imageFormat;
|
||||
int num_channels = memoryBuffer->get_num_channels();
|
||||
if (num_channels == 1) {
|
||||
imageFormat = &IMAGE_FORMAT_VALUE;
|
||||
}
|
||||
else if (num_channels == 3) {
|
||||
imageFormat = &IMAGE_FORMAT_VECTOR;
|
||||
}
|
||||
else {
|
||||
imageFormat = &IMAGE_FORMAT_COLOR;
|
||||
switch (memoryBuffer->get_num_channels()) {
|
||||
case 1:
|
||||
return &IMAGE_FORMAT_VALUE;
|
||||
break;
|
||||
case 3:
|
||||
return &IMAGE_FORMAT_VECTOR;
|
||||
break;
|
||||
case 4:
|
||||
return &IMAGE_FORMAT_COLOR;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Unsupported num_channels.");
|
||||
}
|
||||
|
||||
return imageFormat;
|
||||
return &IMAGE_FORMAT_COLOR;
|
||||
}
|
||||
|
||||
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
|
|
|
@ -122,7 +122,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src,
|
|||
unsigned int x, y, sz;
|
||||
unsigned int i;
|
||||
float *buffer = src->getBuffer();
|
||||
const unsigned int num_channels = src->get_num_channels();
|
||||
const uint8_t num_channels = src->get_num_channels();
|
||||
|
||||
// <0.5 not valid, though can have a possibly useful sort of sharpening effect
|
||||
if (sigma < 0.5f) {
|
||||
|
|
|
@ -60,7 +60,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/
|
|||
{
|
||||
MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer();
|
||||
float *buffer = memoryBuffer->getBuffer();
|
||||
const int num_channels = memoryBuffer->get_num_channels();
|
||||
const uint8_t num_channels = memoryBuffer->get_num_channels();
|
||||
if (this->m_input->isComplex()) {
|
||||
void *data = this->m_input->initializeTileData(rect);
|
||||
int x1 = rect->xmin;
|
||||
|
|
Loading…
Reference in New Issue