Skip to content

Commit

Permalink
handle case where color conversion pipeline has no ops
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Aug 23, 2024
1 parent 315a3bc commit f49905f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions libheif/color-conversion/colorconversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ std::string ColorConversionPipeline::debug_dump_pipeline() const
}


std::shared_ptr<HeifPixelImage> ColorConversionPipeline::convert_image(const std::shared_ptr<const HeifPixelImage>& input)
std::shared_ptr<HeifPixelImage> ColorConversionPipeline::convert_image(const std::shared_ptr<HeifPixelImage>& input)
{
std::shared_ptr<const HeifPixelImage> in = input;
std::shared_ptr<HeifPixelImage> out;
std::shared_ptr<HeifPixelImage> in = input;
std::shared_ptr<HeifPixelImage> out = in;

for (const auto& step : m_conversion_steps) {

Expand Down
2 changes: 1 addition & 1 deletion libheif/color-conversion/colorconversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ColorConversionPipeline
const ColorState& target_state,
const heif_color_conversion_options& options);

std::shared_ptr<HeifPixelImage> convert_image(const std::shared_ptr<const HeifPixelImage>& input);
std::shared_ptr<HeifPixelImage> convert_image(const std::shared_ptr<HeifPixelImage>& input);

std::string debug_dump_pipeline() const;

Expand Down
4 changes: 2 additions & 2 deletions tests/conversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ void TestConversion(const std::string& test_name, const ColorState& input_state,
int height = 8;
REQUIRE(MakeTestImage(input_state, width, height, in_image.get()));

std::shared_ptr<HeifPixelImage> out_image =
pipeline.convert_image(in_image);
std::shared_ptr<HeifPixelImage> out_image;
out_image = pipeline.convert_image(in_image);

REQUIRE(out_image != nullptr);
CHECK(out_image->get_colorspace() == target_state.colorspace);
Expand Down

0 comments on commit f49905f

Please sign in to comment.