MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / PackedImageDesc

Method PackedImageDesc

src/OpenColorIO/ImageDesc.cpp:332–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330};
331
332PackedImageDesc::PackedImageDesc(void * data,
333 long width, long height,
334 long numChannels)
335 : ImageDesc()
336 , m_impl(new PackedImageDesc::Impl)
337{
338 getImpl()->m_data = data;
339 getImpl()->m_width = width;
340 getImpl()->m_height = height;
341 getImpl()->m_numChannels = numChannels;
342 getImpl()->m_bitDepth = BIT_DEPTH_F32;
343
344 if(numChannels==4)
345 {
346 getImpl()->m_chanOrder = CHANNEL_ORDERING_RGBA;
347 }
348 else if(numChannels==3)
349 {
350 getImpl()->m_chanOrder = CHANNEL_ORDERING_RGB;
351 }
352 else
353 {
354 throw Exception("PackedImageDesc Error: Invalid number of channels.");
355 }
356
357 constexpr unsigned oneChannelInBytes = sizeof(BitDepthInfo<BIT_DEPTH_F32>::Type);
358
359 getImpl()->m_chanStrideBytes = oneChannelInBytes;
360 getImpl()->m_xStrideBytes = getImpl()->m_chanStrideBytes * getImpl()->m_numChannels;
361 getImpl()->m_yStrideBytes = getImpl()->m_xStrideBytes* width;
362
363 getImpl()->initValues();
364
365 getImpl()->m_isRGBAPacked = getImpl()->isRGBAPacked();
366 getImpl()->m_isFloat = getImpl()->isFloat();
367
368 getImpl()->validate();
369}
370
371PackedImageDesc::PackedImageDesc(void * data,
372 long width, long height,

Callers 2

test_applyMethod · 0.45
test_apply_src_dstMethod · 0.45

Calls 6

initValuesMethod · 0.80
GetChannelSizeInBytesFunction · 0.70
getImplFunction · 0.50
isRGBAPackedMethod · 0.45
isFloatMethod · 0.45
validateMethod · 0.45

Tested by 2

test_applyMethod · 0.36
test_apply_src_dstMethod · 0.36