Haio
0.2.X
Homebrew Asset IO/CDN
Toggle main menu visibility
Loading...
Searching...
No Matches
detect.cpp
Go to the documentation of this file.
1
#include <
haio_codec.hpp
>
2
3
namespace
Haio::Codecs
{
4
5
/** a jpeg stores yuv, so that is what it holds even though nothing can read it yet */
6
template
<>
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
*/
21
template
<>
22
bool
Detect<Format::JPEG, Color::YUV420>
(
Bytes
data) {
23
return
data.size() >= 3 && data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF;
24
}
25
26
/** @} */
27
28
}
Haio::Codecs::Detect< Format::JPEG, Color::YUV420 >
bool Detect< Format::JPEG, Color::YUV420 >(Bytes data)
Definition
detect.cpp:22
haio_codec.hpp
Haio::Codecs
Definition
haio_codec.hpp:136
Haio::Codecs::DefaultColor
Definition
haio_codec.hpp:143
Haio::Color
Color
Definition
haio_formats.hpp:106
Haio::Color::YUV420
@ YUV420
Definition
haio_formats.hpp:139
Haio::Format
Format
Definition
haio_formats.hpp:17
Haio::Format::JPEG
@ JPEG
Definition
haio_formats.hpp:34
Haio::Bytes
std::span< const uint8_t > Bytes
Definition
haio_codec.hpp:14
Haio::Codecs::DefaultColor< Format::JPEG >::value
static constexpr Color value
Definition
detect.cpp:6
library
backend
codecs
container
jpeg
detect.cpp
Generated by
1.18.0