MCPcopy Create free account
hub / github.com/defold/defold / decode_palettes

Method decode_palettes

engine/dlib/src/basis/transcoder/basisu_transcoder.cpp:7565–7747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7563 }
7564
7565 bool basisu_lowlevel_etc1s_transcoder::decode_palettes(
7566 uint32_t num_endpoints, const uint8_t* pEndpoints_data, uint32_t endpoints_data_size,
7567 uint32_t num_selectors, const uint8_t* pSelectors_data, uint32_t selectors_data_size)
7568 {
7569 if (m_pGlobal_codebook)
7570 {
7571 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 11\n");
7572 return false;
7573 }
7574 bitwise_decoder sym_codec;
7575
7576 huffman_decoding_table color5_delta_model0, color5_delta_model1, color5_delta_model2, inten_delta_model;
7577
7578 if (!sym_codec.init(pEndpoints_data, endpoints_data_size))
7579 {
7580 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 0\n");
7581 return false;
7582 }
7583
7584 if (!sym_codec.read_huffman_table(color5_delta_model0))
7585 {
7586 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 1\n");
7587 return false;
7588 }
7589
7590 if (!sym_codec.read_huffman_table(color5_delta_model1))
7591 {
7592 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 1a\n");
7593 return false;
7594 }
7595
7596 if (!sym_codec.read_huffman_table(color5_delta_model2))
7597 {
7598 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 2a\n");
7599 return false;
7600 }
7601
7602 if (!sym_codec.read_huffman_table(inten_delta_model))
7603 {
7604 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 2b\n");
7605 return false;
7606 }
7607
7608 if (!color5_delta_model0.is_valid() || !color5_delta_model1.is_valid() || !color5_delta_model2.is_valid() || !inten_delta_model.is_valid())
7609 {
7610 BASISU_DEVEL_ERROR("basisu_lowlevel_etc1s_transcoder::decode_palettes: fail 2b\n");
7611 return false;
7612 }
7613
7614 const bool endpoints_are_grayscale = sym_codec.get_bits(1) != 0;
7615
7616 m_local_endpoints.resize(num_endpoints);
7617
7618 color32 prev_color5(16, 16, 16, 0);
7619 uint32_t prev_inten = 0;
7620
7621 for (uint32_t i = 0; i < num_endpoints; i++)
7622 {

Callers 2

start_transcodingMethod · 0.80

Calls 9

read_huffman_tableMethod · 0.80
decode_huffmanMethod · 0.80
init_flagsMethod · 0.80
initMethod · 0.65
is_validMethod · 0.45
get_bitsMethod · 0.45
resizeMethod · 0.45
stopMethod · 0.45
set_selectorMethod · 0.45

Tested by

no test coverage detected