MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / get_dfd

Method get_dfd

encoder/basisu_comp.cpp:4019–4202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4017 };
4018
4019 bool basis_compressor::get_dfd(uint8_vec &dfd, const basist::ktx2_header &header)
4020 {
4021 BASISU_NOTE_UNUSED(header);
4022
4023 const uint8_t* pDFD = nullptr;
4024 uint32_t dfd_len = 0;
4025
4026 const bool is_xuastc_ldr = basis_tex_format_is_xuastc_ldr(m_fmt_mode);
4027 const bool is_astc_ldr = basis_tex_format_is_astc_ldr(m_fmt_mode);
4028
4029 // TODO: This was writen before m_fmt_mode existed, refactor to use that exclusively instead.
4030
4031 if (is_xuastc_ldr)
4032 {
4033 // XUASTC LDR 4x4-12x12
4034 pDFD = g_ktx2_xuastc_ldr_intermediate_dfd;
4035 dfd_len = sizeof(g_ktx2_xuastc_ldr_intermediate_dfd);
4036 }
4037 else if (is_astc_ldr)
4038 {
4039 // ASTC LDR 4x4-12x12
4040 pDFD = g_ktx2_astc_ldr_dfd;
4041 dfd_len = sizeof(g_ktx2_astc_ldr_dfd);
4042 }
4043 else if (m_params.m_uastc)
4044 {
4045 if (m_params.m_hdr)
4046 {
4047 switch (m_params.m_hdr_mode)
4048 {
4049 case hdr_modes::cUASTC_HDR_4X4:
4050 {
4051 assert(m_fmt_mode == basist::basis_tex_format::cUASTC_HDR_4x4);
4052
4053 pDFD = g_ktx2_uastc_hdr_4x4_nonalpha_dfd;
4054 dfd_len = sizeof(g_ktx2_uastc_hdr_4x4_nonalpha_dfd);
4055 break;
4056 }
4057 case hdr_modes::cASTC_HDR_6X6:
4058 {
4059 assert(m_fmt_mode == basist::basis_tex_format::cASTC_HDR_6x6);
4060
4061 pDFD = g_ktx2_astc_hdr_6x6_nonalpha_dfd;
4062 dfd_len = sizeof(g_ktx2_astc_hdr_6x6_nonalpha_dfd);
4063 break;
4064 }
4065 case hdr_modes::cUASTC_HDR_6X6_INTERMEDIATE:
4066 {
4067 assert(m_fmt_mode == basist::basis_tex_format::cUASTC_HDR_6x6_INTERMEDIATE);
4068
4069 pDFD = g_ktx2_uastc_hdr_6x6_intermediate_nonalpha_dfd;
4070 dfd_len = sizeof(g_ktx2_uastc_hdr_6x6_intermediate_nonalpha_dfd);
4071 break;
4072 }
4073 default:
4074 {
4075 assert(0);
4076 return false;

Callers 3

getDFDSizeMethod · 0.80
getDFDMethod · 0.80

Calls 6

write_le_dwordFunction · 0.85
read_le_dwordFunction · 0.50
resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected