MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / imageDecodeToBgra8

Function imageDecodeToBgra8

Source/3rdParty/bimg/src/image.cpp:4539–4949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4537 }
4538
4539 void imageDecodeToBgra8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat)
4540 {
4541 const uint8_t* src = (const uint8_t*)_src;
4542 uint8_t* dst = (uint8_t*)_dst;
4543
4544 uint32_t width = _width/4;
4545 uint32_t height = _height/4;
4546
4547 uint8_t temp[16*4];
4548
4549 switch (_srcFormat)
4550 {
4551 case TextureFormat::BC1:
4552 if (BX_ENABLED(BIMG_DECODE_BC1) )
4553 {
4554 for (uint32_t yy = 0; yy < height; ++yy)
4555 {
4556 for (uint32_t xx = 0; xx < width; ++xx)
4557 {
4558 decodeBlockDxt1(temp, src);
4559 src += 8;
4560
4561 uint8_t* block = &dst[yy*_dstPitch*4 + xx*16];
4562 bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16);
4563 bx::memCopy(&block[1*_dstPitch], &temp[16], 16);
4564 bx::memCopy(&block[2*_dstPitch], &temp[32], 16);
4565 bx::memCopy(&block[3*_dstPitch], &temp[48], 16);
4566 }
4567 }
4568 }
4569 else
4570 {
4571 BX_WARN(false, "BC1 decoder is disabled (BIMG_DECODE_BC1).");
4572 imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00) );
4573 }
4574 break;
4575
4576 case TextureFormat::BC2:
4577 if (BX_ENABLED(BIMG_DECODE_BC2) )
4578 {
4579 for (uint32_t yy = 0; yy < height; ++yy)
4580 {
4581 for (uint32_t xx = 0; xx < width; ++xx)
4582 {
4583 decodeBlockDxt23A(temp+3, src);
4584 src += 8;
4585 decodeBlockDxt(temp, src);
4586 src += 8;
4587
4588 uint8_t* block = &dst[yy*_dstPitch*4 + xx*16];
4589 bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16);
4590 bx::memCopy(&block[1*_dstPitch], &temp[16], 16);
4591 bx::memCopy(&block[2*_dstPitch], &temp[32], 16);
4592 bx::memCopy(&block[3*_dstPitch], &temp[48], 16);
4593 }
4594 }
4595 }
4596 else

Callers 8

imageConvertFunction · 0.85
imageDecodeToRgba8Function · 0.85
createMethod · 0.85
updateMethod · 0.85
createMethod · 0.85
updateMethod · 0.85
createMethod · 0.85
updateMethod · 0.85

Calls 15

decodeBlockDxt1Function · 0.85
memCopyFunction · 0.85
imageCheckerboardFunction · 0.85
decodeBlockDxt23AFunction · 0.85
decodeBlockDxtFunction · 0.85
decodeBlockDxt45AFunction · 0.85
imageAllocFunction · 0.85
imageDecodeToRgba32fFunction · 0.85
imageConvertFunction · 0.85
imageFreeFunction · 0.85
decodeBlockBc7Function · 0.85
decodeBlockEtc12Function · 0.85

Tested by

no test coverage detected