MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / GetOutputFormat

Function GetOutputFormat

python/mod_cvcuda/CvtColorUtil.cpp:244–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242};
243
244nvcv::ImageFormat GetOutputFormat(nvcv::DataType in, NVCVColorConversionCode code)
245{
246 auto outFormatIt = kOutputFormat.find(code);
247 if (outFormatIt == kOutputFormat.end())
248 {
249 throw std::runtime_error("Invalid color conversion code");
250 }
251 nvcv::ImageFormat outFormat{outFormatIt->second};
252
253 auto inPackingParams = nvcv::GetParams(in.packing());
254 int inNumBits = 0;
255 for (const auto &numBits : inPackingParams.bits)
256 {
257 if (numBits > 0)
258 {
259 inNumBits = (inNumBits == 0) ? numBits : inNumBits;
260 if (numBits != inNumBits)
261 {
262 throw std::runtime_error("Invalid input format, all channels must have the same bit-depth");
263 }
264 }
265 }
266 auto outPackingParams = nvcv::GetParams(outFormat.planePacking(0));
267 for (auto &numBits : outPackingParams.bits)
268 {
269 numBits = (numBits > 0) ? inNumBits : numBits;
270 }
271 auto outPacking = nvcv::MakePacking(outPackingParams);
272 outFormat = outFormat.swizzleAndPacking(outFormat.swizzle(), outPacking, nvcv::Packing::NONE, nvcv::Packing::NONE,
273 nvcv::Packing::NONE);
274
275 return outFormat;
276}
277
278int64_t GetOutputHeight(int64_t height, NVCVColorConversionCode code)
279{

Callers 3

CvtColorFunction · 0.85
CvtColorVarShapeFunction · 0.85
AdvCvtColorFunction · 0.85

Calls 8

GetParamsFunction · 0.85
MakePackingFunction · 0.85
findMethod · 0.80
endMethod · 0.45
packingMethod · 0.45
planePackingMethod · 0.45
swizzleAndPackingMethod · 0.45
swizzleMethod · 0.45

Tested by

no test coverage detected