Skip to content

Commit

Permalink
fix cmin update by imir transformation (#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Jun 20, 2024
1 parent 5ca525b commit fd8bdaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libheif/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,16 +1059,16 @@ class Box_cmin : public FullBox
principal_point_y -= clap->top(image_height);
}

void apply_imir(const Box_imir* imir) {
void apply_imir(const Box_imir* imir, int image_width, int image_height) {
switch (imir->get_mirror_direction()) {
case heif_transform_mirror_direction_horizontal:
focal_length_x *= -1;
skew *= -1;
principal_point_x *= -1;
principal_point_x = image_width - 1 - principal_point_x;
break;
case heif_transform_mirror_direction_vertical:
focal_length_y *= -1;
principal_point_y *= -1;
principal_point_y = image_height - 1 - principal_point_y;
break;
case heif_transform_mirror_direction_invalid:
break;
Expand Down
2 changes: 1 addition & 1 deletion libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ Error HeifContext::interpret_heif_file()

auto imir = std::dynamic_pointer_cast<Box_imir>(prop);
if (imir) {
image->get_intrinsic_matrix().apply_imir(imir.get());
image->get_intrinsic_matrix().apply_imir(imir.get(), image->get_width(), image->get_height());
}

auto irot = std::dynamic_pointer_cast<Box_irot>(prop);
Expand Down

0 comments on commit fd8bdaf

Please sign in to comment.