Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
detect.cpp
Go to the documentation of this file.
1#include <haio_codec.hpp>
2
3namespace Haio::Codecs {
4
5/** a jpeg stores yuv, so that is what it holds even though nothing can read it yet */
6template <> struct DefaultColor<Format::JPEG> { static constexpr Color value = Color::YUV420; };
7
8/**
9 * @addtogroup detect
10 * @{
11 */
12
13/**
14 * start of image, then the first marker. every jpeg opens FF D8 FF whatever follows,
15 * be it a jfif header, an exif block or a bare quantisation table.
16 *
17 * @todo detect only: there is no jpeg decoder, so this answers "jpeg yuv420" and then
18 * Decode refuses. that refusal naming the format is the point, and it is what let
19 * describeForeignMagic go away.
20 */
21template <>
23 return data.size() >= 3 && data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF;
24}
25
26/** @} */
27
28}
bool Detect< Format::JPEG, Color::YUV420 >(Bytes data)
Definition detect.cpp:22
std::span< const uint8_t > Bytes