MCPcopy Create free account
hub / github.com/RenderKit/oidn / makeFormat

Function makeFormat

common/common.cpp:41–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 }
40
41 Format makeFormat(DataType dataType, int numChannels)
42 {
43 if (dataType == DataType::Undefined)
44 return Format::Undefined;
45
46 Format baseFormat;
47 switch (dataType)
48 {
49 case DataType::Float16:
50 baseFormat = Format::Half;
51 break;
52 case DataType::Float32:
53 baseFormat = Format::Float;
54 break;
55 default:
56 throw std::invalid_argument("unsupported format data type");
57 }
58
59 if (numChannels < 1 || numChannels > 4)
60 throw std::invalid_argument("invalid number of channels");
61
62 return Format(int(baseFormat) + numChannels - 1);
63 }
64
65OIDN_NAMESPACE_END

Callers 1

ImageBufferMethod · 0.85

Calls 1

FormatEnum · 0.85

Tested by

no test coverage detected