/src/libheif/libheif/codecs/uncompressed/unc_dec.h
Line | Count | Source |
1 | | /* |
2 | | * HEIF codec. |
3 | | * Copyright (c) 2024 Dirk Farin <dirk.farin@gmail.com> |
4 | | * |
5 | | * This file is part of libheif. |
6 | | * |
7 | | * libheif is free software: you can redistribute it and/or modify |
8 | | * it under the terms of the GNU Lesser General Public License as |
9 | | * published by the Free Software Foundation, either version 3 of |
10 | | * the License, or (at your option) any later version. |
11 | | * |
12 | | * libheif is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | | * GNU Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General Public License |
18 | | * along with libheif. If not, see <http://www.gnu.org/licenses/>. |
19 | | */ |
20 | | |
21 | | #ifndef HEIF_UNC_DEC_H |
22 | | #define HEIF_UNC_DEC_H |
23 | | |
24 | | #include "libheif/heif.h" |
25 | | #include "box.h" |
26 | | #include "error.h" |
27 | | |
28 | | #include <memory> |
29 | | #include <vector> |
30 | | #include "codecs/decoder.h" |
31 | | |
32 | | class Box_uncC; |
33 | | class Box_cmpd; |
34 | | |
35 | | |
36 | | class Decoder_uncompressed : public Decoder |
37 | | { |
38 | | public: |
39 | | explicit Decoder_uncompressed(const std::shared_ptr<const Box_uncC>& uncC, |
40 | | const std::shared_ptr<const Box_cmpd>& cmpd, |
41 | 0 | const std::shared_ptr<const Box_ispe>& ispe) : m_uncC(uncC), m_cmpd(cmpd), m_ispe(ispe) {} |
42 | | |
43 | 0 | heif_compression_format get_compression_format() const override { return heif_compression_uncompressed; } |
44 | | |
45 | | int get_luma_bits_per_pixel() const override; |
46 | | |
47 | | int get_chroma_bits_per_pixel() const override; |
48 | | |
49 | | Error get_coded_image_colorspace(heif_colorspace*, heif_chroma*) const override; |
50 | | |
51 | | bool has_alpha_component() const; |
52 | | |
53 | | Result<std::vector<uint8_t>> read_bitstream_configuration_data() const override; |
54 | | |
55 | | Result<std::shared_ptr<HeifPixelImage>> |
56 | | decode_single_frame_from_compressed_data(const struct heif_decoding_options& options, |
57 | | const struct heif_security_limits* limits) override; |
58 | | |
59 | | |
60 | | // Push data for one frame into decoder. |
61 | | Error |
62 | | decode_sequence_frame_from_compressed_data(bool upload_configuration_NALs, |
63 | | const heif_decoding_options& options, |
64 | | uintptr_t user_data, |
65 | | const heif_security_limits* limits) override; |
66 | | |
67 | 0 | Error flush_decoder() override { return {}; } |
68 | | |
69 | | // Get a decoded frame from the decoder. |
70 | | // It may return NULL when there is buffering in the codec. |
71 | | Result<std::shared_ptr<HeifPixelImage> > get_decoded_frame(const heif_decoding_options& options, |
72 | | uintptr_t* out_user_data, |
73 | | const heif_security_limits* limits) override; |
74 | | |
75 | | private: |
76 | | const std::shared_ptr<const Box_uncC> m_uncC; |
77 | | const std::shared_ptr<const Box_cmpd> m_cmpd; |
78 | | const std::shared_ptr<const Box_ispe> m_ispe; |
79 | | |
80 | | std::shared_ptr<HeifPixelImage> m_decoded_image; |
81 | | uintptr_t m_decoded_image_user_data; |
82 | | }; |
83 | | |
84 | | #endif |