@@ -2594,29 +2594,45 @@ fn read_irot<T: Read>(src: &mut BMFFBox<T>) -> Result<ImageRotation> {
2594
2594
Ok ( image_rotation)
2595
2595
}
2596
2596
2597
- #[ repr( C ) ]
2598
- #[ derive( Debug ) ]
2599
2597
/// The axis about which the image is mirrored (opposite of flip)
2600
2598
/// Visualized in terms of starting with (⥠) UPWARDS HARPOON WITH BARB LEFT FROM BAR
2601
2599
/// similar to a DIGIT ONE (1)
2600
+ #[ repr( C ) ]
2601
+ #[ derive( Debug ) ]
2602
2602
pub enum ImageMirror {
2603
- /// left and right sides swapped
2604
- /// ⥜ UPWARDS HARPOON WITH BARB RIGHT FROM BAR
2605
- V ,
2606
- /// top and bottom halves swapped
2603
+ /// top and bottom parts exchanged
2607
2604
/// ⥡ DOWNWARDS HARPOON WITH BARB LEFT FROM BAR
2608
- H ,
2605
+ TopBottom ,
2606
+ /// left and right parts exchanged
2607
+ /// ⥜ UPWARDS HARPOON WITH BARB RIGHT FROM BAR
2608
+ LeftRight ,
2609
2609
}
2610
2610
2611
2611
/// Parse image mirroring box
2612
- /// See HEIF (ISO 23008-12:2017) § 6.5.12
2612
+ /// See HEIF (ISO 23008-12:2017) § 6.5.12<br />
2613
+ /// Note: [ISO/IEC 23008-12:2017/DAmd 2](https://www.iso.org/standard/81688.html)
2614
+ /// reverses the interpretation of the 'imir' box in § 6.5.12.3:
2615
+ /// > `axis` specifies a vertical (`axis` = 0) or horizontal (`axis` = 1) axis
2616
+ /// > for the mirroring operation.
2617
+ ///
2618
+ /// is replaced with:
2619
+ /// > `mode` specifies how the mirroring is performed: 0 indicates that the top
2620
+ /// > and bottom parts of the image are exchanged; 1 specifies that the left and
2621
+ /// > right parts are exchanged.
2622
+ /// >
2623
+ /// > NOTE: In Exif, orientation tag can be used to signal mirroring operations.
2624
+ /// > Exif orientation tag 4 corresponds to `mode` = 0 of `ImageMirror`, and
2625
+ /// > Exif orientation tag 2 corresponds to `mode` = 1 accordingly.
2626
+ ///
2627
+ /// This implementation conforms to the text in Draft Amendment 2, which is the
2628
+ /// opposite of the published standard as of 4 June 2021.
2613
2629
fn read_imir < T : Read > ( src : & mut BMFFBox < T > ) -> Result < ImageMirror > {
2614
2630
let imir = src. read_into_try_vec ( ) ?;
2615
2631
let mut imir = BitReader :: new ( & imir) ;
2616
2632
let _reserved = imir. read_u8 ( 7 ) ?;
2617
2633
let image_mirror = match imir. read_u8 ( 1 ) ? {
2618
- 0 => ImageMirror :: V ,
2619
- 1 => ImageMirror :: H ,
2634
+ 0 => ImageMirror :: TopBottom ,
2635
+ 1 => ImageMirror :: LeftRight ,
2620
2636
_ => unreachable ! ( ) ,
2621
2637
} ;
2622
2638
0 commit comments