diff --git a/libheif/codecs/uncompressed/decoder_abstract.cc b/libheif/codecs/uncompressed/decoder_abstract.cc index 6178f4e7c0..7b66edbcd4 100644 --- a/libheif/codecs/uncompressed/decoder_abstract.cc +++ b/libheif/codecs/uncompressed/decoder_abstract.cc @@ -18,10 +18,8 @@ * along with libheif. If not, see . */ -#include #include #include -#include #include #include #include diff --git a/libheif/codecs/uncompressed/decoder_abstract.h b/libheif/codecs/uncompressed/decoder_abstract.h index 36b1c923dc..a0a987577a 100644 --- a/libheif/codecs/uncompressed/decoder_abstract.h +++ b/libheif/codecs/uncompressed/decoder_abstract.h @@ -127,13 +127,9 @@ class AbstractDecoder std::shared_ptr& img, uint32_t out_x0, uint32_t out_y0, uint32_t image_width, uint32_t image_height, - uint32_t tile_x, uint32_t tile_y) - { - assert(false); - return Error{heif_error_Unsupported_feature, - heif_suberror_Unsupported_image_type, - "unci tile decoding not supported for this image type"}; - } + uint32_t tile_x, uint32_t tile_y) = 0; + + void buildChannelList(std::shared_ptr& img); protected: AbstractDecoder(uint32_t width, uint32_t height, @@ -178,10 +174,6 @@ class AbstractDecoder std::vector channelList; -public: - void buildChannelList(std::shared_ptr& img); - -protected: void processComponentSample(UncompressedBitReader& srcBits, const ChannelListEntry& entry, uint64_t dst_row_offset, uint32_t tile_column, uint32_t tile_x); // Handles the case where a row consists of a single component type @@ -198,11 +190,6 @@ class AbstractDecoder // Not valid for multi-Y pixel interleave void processComponentTileRow(ChannelListEntry& entry, UncompressedBitReader& srcBits, uint64_t dst_offset); -private: - ChannelListEntry buildChannelListEntry(Box_uncC::Component component, std::shared_ptr& img); - -protected: - // generic compression and uncompressed, per 23001-17 const Error get_compressed_image_data_uncompressed(const HeifContext* context, heif_item_id ID, std::vector* data, @@ -213,6 +200,9 @@ class AbstractDecoder const Error do_decompress_data(std::shared_ptr& cmpC_box, std::vector compressed_data, std::vector* data) const; + +private: + ChannelListEntry buildChannelListEntry(Box_uncC::Component component, std::shared_ptr& img); }; #endif diff --git a/libheif/codecs/uncompressed/decoder_component_interleave.cc b/libheif/codecs/uncompressed/decoder_component_interleave.cc index 31492fd377..a505d2f66b 100644 --- a/libheif/codecs/uncompressed/decoder_component_interleave.cc +++ b/libheif/codecs/uncompressed/decoder_component_interleave.cc @@ -18,22 +18,11 @@ * along with libheif. If not, see . */ -#include -#include #include -#include -#include #include -#include - -#include "common_utils.h" #include "context.h" -#include "compression.h" #include "error.h" #include "libheif/heif.h" -#include "unc_types.h" -#include "unc_boxes.h" -#include "unc_codec.h" #include "unc_dec.h" #include "decoder_component_interleave.h" diff --git a/libheif/codecs/uncompressed/decoder_mixed_interleave.cc b/libheif/codecs/uncompressed/decoder_mixed_interleave.cc index b9e2c82389..cdc2ab96f9 100644 --- a/libheif/codecs/uncompressed/decoder_mixed_interleave.cc +++ b/libheif/codecs/uncompressed/decoder_mixed_interleave.cc @@ -18,22 +18,12 @@ * along with libheif. If not, see . */ -#include #include #include -#include -#include #include -#include - -#include "common_utils.h" #include "context.h" -#include "compression.h" #include "error.h" #include "libheif/heif.h" -#include "unc_types.h" -#include "unc_boxes.h" -#include "unc_codec.h" #include "unc_dec.h" #include "decoder_mixed_interleave.h" diff --git a/libheif/codecs/uncompressed/decoder_pixel_interleave.cc b/libheif/codecs/uncompressed/decoder_pixel_interleave.cc index 5e3e389830..58bff0b7a3 100644 --- a/libheif/codecs/uncompressed/decoder_pixel_interleave.cc +++ b/libheif/codecs/uncompressed/decoder_pixel_interleave.cc @@ -18,25 +18,13 @@ * along with libheif. If not, see . */ -#include -#include +#include "decoder_pixel_interleave.h" + #include -#include -#include #include -#include - -#include "common_utils.h" #include "context.h" -#include "compression.h" #include "error.h" #include "libheif/heif.h" -#include "unc_types.h" -#include "unc_boxes.h" -#include "unc_codec.h" -#include "unc_dec.h" - -#include "decoder_pixel_interleave.h" Error PixelInterleaveDecoder::decode_tile(const HeifContext* context, diff --git a/libheif/codecs/uncompressed/decoder_row_interleave.cc b/libheif/codecs/uncompressed/decoder_row_interleave.cc index fb13096495..7be8cb6633 100644 --- a/libheif/codecs/uncompressed/decoder_row_interleave.cc +++ b/libheif/codecs/uncompressed/decoder_row_interleave.cc @@ -18,26 +18,15 @@ * along with libheif. If not, see . */ -#include -#include +#include "decoder_row_interleave.h" + #include -#include -#include #include -#include - -#include "common_utils.h" #include "context.h" -#include "compression.h" #include "error.h" #include "libheif/heif.h" -#include "unc_types.h" -#include "unc_boxes.h" -#include "unc_codec.h" #include "unc_dec.h" -#include "decoder_row_interleave.h" - Error RowInterleaveDecoder::decode_tile(const HeifContext* context, heif_item_id image_id, diff --git a/libheif/codecs/uncompressed/unc_codec.cc b/libheif/codecs/uncompressed/unc_codec.cc index 745cf4ead6..af270b3699 100644 --- a/libheif/codecs/uncompressed/unc_codec.cc +++ b/libheif/codecs/uncompressed/unc_codec.cc @@ -18,23 +18,14 @@ * along with libheif. If not, see . */ -#include -#include -#include -#include -#include -#include -#include +#include "unc_codec.h" #include "common_utils.h" #include "context.h" -#include "compression.h" #include "error.h" #include "libheif/heif.h" #include "unc_types.h" #include "unc_boxes.h" -#include "unc_codec.h" -#include "unc_dec.h" #include "decoder_abstract.h" #include "decoder_component_interleave.h" @@ -43,6 +34,11 @@ #include "decoder_row_interleave.h" #include "decoder_tile_component_interleave.h" +#include +#include +#include +#include + bool isKnownUncompressedFrameConfigurationBoxProfile(const std::shared_ptr& uncC) { @@ -401,23 +397,19 @@ bool map_uncompressed_component_to_channel(const std::shared_ptr static AbstractDecoder* makeDecoder(uint32_t width, uint32_t height, const std::shared_ptr& cmpd, const std::shared_ptr& uncC) { - if (uncC->get_interleave_type() == interleave_mode_component) { - return new ComponentInterleaveDecoder(width, height, cmpd, uncC); - } - else if (uncC->get_interleave_type() == interleave_mode_pixel) { - return new PixelInterleaveDecoder(width, height, cmpd, uncC); - } - else if (uncC->get_interleave_type() == interleave_mode_mixed) { - return new MixedInterleaveDecoder(width, height, cmpd, uncC); - } - else if (uncC->get_interleave_type() == interleave_mode_row) { - return new RowInterleaveDecoder(width, height, cmpd, uncC); - } - else if (uncC->get_interleave_type() == interleave_mode_tile_component) { - return new TileComponentInterleaveDecoder(width, height, cmpd, uncC); - } - else { - return nullptr; + switch (uncC->get_interleave_type()) { + case interleave_mode_component: + return new ComponentInterleaveDecoder(width, height, cmpd, uncC); + case interleave_mode_pixel: + return new PixelInterleaveDecoder(width, height, cmpd, uncC); + case interleave_mode_mixed: + return new MixedInterleaveDecoder(width, height, cmpd, uncC); + case interleave_mode_row: + return new RowInterleaveDecoder(width, height, cmpd, uncC); + case interleave_mode_tile_component: + return new TileComponentInterleaveDecoder(width, height, cmpd, uncC); + default: + return nullptr; } }