Skip to content

Commit

Permalink
add TODO comment about alpha scaling (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Jun 11, 2024
1 parent 58ba30d commit 140c1dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,11 @@ Error HeifContext::decode_image_planar(heif_item_id ID,
heif_suberror_Unsupported_color_conversion);
}


// TODO: we should include a decoding option to control whether libheif should automatically scale the alpha channel, and if so, which scaling filter (enum: Off, NN, Bilinear, ...).
// It might also be that a specific output format implies that alpha is scaled (RGBA32). That would favor an enum for the scaling filter option + a bool to switch auto-filtering on.
// But we can only do this when libheif itself doesn't assume anymore that the alpha channel has the same resolution.

if ((alpha_image->get_width() != img->get_width()) || (alpha_image->get_height() != img->get_height())) {
std::shared_ptr<HeifPixelImage> scaled_alpha;
err = alpha->scale_nearest_neighbor(scaled_alpha, img->get_width(), img->get_height());
Expand Down

0 comments on commit 140c1dc

Please sign in to comment.