MCPcopy Create free account
hub / github.com/davisking/dlib / get_info

Method get_info

dlib/image_loader/jxl_loader.cpp:75–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73// ----------------------------------------------------------------------------------------
74
75 void jxl_loader::get_info()
76 {
77 JxlSignature signature = JxlSignatureCheck(data.data(), data.size());
78 if (signature != JXL_SIG_CODESTREAM && signature != JXL_SIG_CONTAINER)
79 {
80 throw image_load_error("jxl_loader: JxlSignatureCheck failed");
81 }
82
83 auto dec = JxlDecoderMake(nullptr);
84 if (JXL_DEC_SUCCESS != JxlDecoderSubscribeEvents(dec.get(), JXL_DEC_BASIC_INFO))
85 {
86 throw image_load_error("jxl_loader: JxlDecoderSubscribeEvents failed");
87 }
88
89 JxlDecoderSetInput(dec.get(), data.data(), data.size());
90 JxlDecoderCloseInput(dec.get());
91 if (JXL_DEC_BASIC_INFO != JxlDecoderProcessInput(dec.get())) {
92 throw image_load_error("jxl_loader: JxlDecoderProcessInput failed");
93 }
94
95 JxlBasicInfo basic_info;
96 if (JXL_DEC_SUCCESS != JxlDecoderGetBasicInfo(dec.get(), &basic_info))
97 {
98 throw image_load_error("jxl_loader: JxlDecoderGetBasicInfo failed");
99 }
100 width = basic_info.xsize;
101 height = basic_info.ysize;
102 depth = basic_info.num_color_channels + basic_info.num_extra_channels;
103 bits_per_sample = basic_info.bits_per_sample;
104 }
105// ----------------------------------------------------------------------------------------
106
107 void jxl_loader::decode(unsigned char* out, const size_t out_size) const

Callers

nothing calls this directly

Calls 4

image_load_errorClass · 0.70
dataMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected