MCPcopy Create free account
hub / github.com/darktable-org/rawspeed / parseHints

Method parseHints

src/librawspeed/decoders/NakedDecoder.cpp:52–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52void NakedDecoder::parseHints() {
53 const auto& cHints = cam->hints;
54 const auto& make = cam->make.c_str();
55 const auto& model = cam->model.c_str();
56
57 auto parseHint = [&cHints, &make, &model](const string& name) {
58 if (!cHints.has(name))
59 ThrowRDE("%s %s: couldn't find %s", make, model, name.c_str());
60
61 return cHints.get(name, 0U);
62 };
63
64 width = parseHint("full_width");
65 height = parseHint("full_height");
66
67 if (width == 0 || height == 0)
68 ThrowRDE("%s %s: image is of zero size?", make, model);
69
70 filesize = parseHint("filesize");
71 offset = cHints.get("offset", 0);
72 if (filesize == 0 || offset >= filesize)
73 ThrowRDE("%s %s: no image data found", make, model);
74
75 bits = cHints.get("bits", (filesize-offset)*8/width/height);
76 if (bits == 0)
77 ThrowRDE("%s %s: image bpp is invalid: %u", make, model, bits);
78
79 auto order = cHints.get("order", string());
80 if (!order.empty()) {
81 try {
82 bo = order2enum.at(order);
83 } catch (std::out_of_range&) {
84 ThrowRDE("%s %s: unknown order: %s", make, model, order.c_str());
85 }
86 }
87}
88
89RawImage NakedDecoder::decodeRawInternal() {
90 parseHints();

Callers

nothing calls this directly

Calls 3

hasMethod · 0.80
emptyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected