The branch, master has been updated
       via  c6297b689f1a0ec28d45a9991bc02127e7a2abbd (commit)
       via  ca72b2d7123315c30296385871149bd1c78c2e9b (commit)
      from  796b3ba63ba8eb0deba0248b30b10727920448ad (commit)


- Log -----------------------------------------------------------------
commit c6297b689f1a0ec28d45a9991bc02127e7a2abbd
Author:     James Almer <[email protected]>
AuthorDate: Mon Sep 15 00:21:39 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Wed Sep 17 02:17:09 2025 +0000

    tests/fate/image: add Exif rotation metadata tests
    
    Signed-off-by: James Almer <[email protected]>

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 98c4e0fdcc..3facd8aaa8 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -360,6 +360,13 @@ fate-jpg-rgb-5: CMD = framecrc -idct simple -i 
$(TARGET_SAMPLES)/jpg/jpg-8930-5.
 FATE_JPG_TRANSCODE-$(call TRANSCODE, MJPEG, MJPEG IMAGE_JPEG_PIPE, 
IMAGE_PNG_PIPE_DEMUXER PNG_DECODER SCALE_FILTER) += fate-jpg-icc
 fate-jpg-icc: CMD = transcode png_pipe 
$(TARGET_SAMPLES)/png1/lena-int_rgb24.png mjpeg "-vf scale" "" "-show_frames"
 
+FATE_JPG_TRANSCODE-$(call TRANSCODE, TIFF, IMAGE2 IMAGE_JPEG_PIPE, 
IMAGE_TIFF_PIPE_DEMUXER MJPEG_DECODER SCALE_FILTER) += fate-jpg-exif-autorotate 
fate-jpg-exif-rotation-override
+fate-jpg-exif-autorotate: CMD = transcode jpeg_pipe 
$(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v tiff -vf scale" "" 
"-show_frames"
+fate-jpg-exif-rotation-override: CMD = transcode jpeg_pipe 
$(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v tiff -vf scale" "" 
"-show_frames" "" "" "-noautorotate -display_rotation 0"
+
+FATE_JPG_TRANSCODE-$(call TRANSCODE, PNG, IMAGE2 IMAGE_JPEG_PIPE, 
IMAGE_PNG_PIPE_DEMUXER MJPEG_DECODER SCALE_FILTER) += fate-jpg-exif-noautorotate
+fate-jpg-exif-noautorotate: CMD = transcode jpeg_pipe 
$(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v png -vf scale" "" 
"-show_frames" "" "-noautorotate" "-noautorotate"
+
 FATE_JPG-$(call FRAMECRC, IMAGE2, MJPEG) += $(FATE_JPG)
 FATE_IMAGE_FRAMECRC += $(FATE_JPG-yes)
 FATE_IMAGE_TRANSCODE += $(FATE_JPG_TRANSCODE-yes)
diff --git a/tests/ref/fate/jpg-exif-autorotate 
b/tests/ref/fate/jpg-exif-autorotate
new file mode 100644
index 0000000000..07321ee336
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-autorotate
@@ -0,0 +1,64 @@
+fb7725b8ccdfb537a600d9e16697078e *tests/data/fate/jpg-exif-autorotate.image2
+90658 tests/data/fate/jpg-exif-autorotate.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 300x200
+#sar 0: 1/1
+0,          0,          0,        1,    90000, 0x458a544e
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=90658
+width=300
+height=200
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv420p
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=unknown
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:0x00FE=      0
+TAG:ImageWidth=    300
+TAG:ImageLength=    200
+TAG:BitsPerSample=      8,       8,       8
+TAG:Compression=  32773
+TAG:PhotometricInterpretation=      6
+TAG:StripOffsets=      8,    8085,   16195,   24339,   32486,   40643,   
48791,   56934
+  65084,   73197,   81294,   89409
+TAG:SamplesPerPixel=      3
+TAG:RowsPerStrip=     18
+TAG:StripByteCounts=   8077,    8110,    8144,    8147,    8157,    8148,    
8143,    8150
+   8113,    8097,    8115,     897
+TAG:XResolution=     72:1      
+TAG:YResolution=     72:1      
+TAG:ResolutionUnit=      2
+TAG:YCbCrSubSampling=      2,       2
+TAG:ReferenceBlackWhite=     15:1      ,     235:1      ,     128:1      ,     
240:1      
+    128:1      ,     240:1      
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=360
+[/SIDE_DATA]
+[/FRAME]
diff --git a/tests/ref/fate/jpg-exif-noautorotate 
b/tests/ref/fate/jpg-exif-noautorotate
new file mode 100644
index 0000000000..c18cdfff91
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-noautorotate
@@ -0,0 +1,63 @@
+e3f1a70f55d680145fca061e4a515133 *tests/data/fate/jpg-exif-noautorotate.image2
+93327 tests/data/fate/jpg-exif-noautorotate.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 200x300
+#sar 0: 1/1
+0,          0,          0,        1,   180000, 0x4c43539a
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=93327
+width=200
+height=300
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=rgb24
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=pc
+color_space=gbr
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:XResolution=      1:1      
+TAG:YResolution=      1:1      
+TAG:ResolutionUnit=      1
+TAG:YCbCrPositioning=      1
+TAG:ImageWidth=    200
+TAG:ImageLength=    300
+TAG:ExifIFD/PixelXDimension=    200
+TAG:ExifIFD/PixelYDimension=    300
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+00000000:            0       65536           0
+00000001:        65536           0           0
+00000002:            0           0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=144
+[/SIDE_DATA]
+[/FRAME]
diff --git a/tests/ref/fate/jpg-exif-rotation-override 
b/tests/ref/fate/jpg-exif-rotation-override
new file mode 100644
index 0000000000..e76ffb727f
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-rotation-override
@@ -0,0 +1,73 @@
+0fd5facf5235c64ddc984bbd83db6b89 
*tests/data/fate/jpg-exif-rotation-override.image2
+90688 tests/data/fate/jpg-exif-rotation-override.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 200x300
+#sar 0: 1/1
+0,          0,          0,        1,    90000, 0x157a544e
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=90688
+width=200
+height=300
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv420p
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=unknown
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:0x00FE=      0
+TAG:ImageWidth=    200
+TAG:ImageLength=    300
+TAG:BitsPerSample=      8,       8,       8
+TAG:Compression=  32773
+TAG:PhotometricInterpretation=      6
+TAG:StripOffsets=      8,    8464,   16902,   25347,   33787,   42187,   
50628,   59079
+  67494,   75928,   84353
+TAG:SamplesPerPixel=      3
+TAG:RowsPerStrip=     28
+TAG:StripByteCounts=   8456,    8438,    8445,    8440,    8400,    8441,    
8451,    8415
+   8434,    8425,    5979
+TAG:XResolution=     72:1      
+TAG:YResolution=     72:1      
+TAG:ResolutionUnit=      2
+TAG:YCbCrSubSampling=      2,       2
+TAG:ReferenceBlackWhite=     15:1      ,     235:1      ,     128:1      ,     
240:1      
+    128:1      ,     240:1      
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+00000000:        65536           0           0
+00000001:            0       65536           0
+00000002:            0           0  1073741824
+
+rotation=0
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=352
+[/SIDE_DATA]
+[/FRAME]

commit ca72b2d7123315c30296385871149bd1c78c2e9b
Author:     James Almer <[email protected]>
AuthorDate: Mon Sep 15 18:10:04 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Wed Sep 17 02:17:09 2025 +0000

    avcodec/tiffenc: support writing Orientation tag
    
    Signed-off-by: James Almer <[email protected]>

diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h
index 12afcfa6e5..dc44eda015 100644
--- a/libavcodec/tiff.h
+++ b/libavcodec/tiff.h
@@ -54,6 +54,7 @@ enum TiffTags {
     TIFF_MAKE               = 0x10F,
     TIFF_MODEL              = 0x110,
     TIFF_STRIP_OFFS         = 0x111,
+    TIFF_ORIENTATION        = 0x112,
     TIFF_SAMPLES_PER_PIXEL  = 0x115,
     TIFF_ROWSPERSTRIP       = 0x116,
     TIFF_STRIP_SIZE,
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 9a5291c257..1916db9a31 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -464,6 +464,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
     ADD_ENTRY1(s, TIFF_PHOTOMETRIC, AV_TIFF_SHORT, 
s->photometric_interpretation);
     ADD_ENTRY(s,  TIFF_STRIP_OFFS,  AV_TIFF_LONG,  strips, s->strip_offsets);
 
+    AVFrameSideData *sd = av_frame_get_side_data(pict, 
AV_FRAME_DATA_DISPLAYMATRIX);
+    if (sd) {
+        int orientation = av_exif_matrix_to_orientation((int32_t *) sd->data);
+        if (orientation >= 1 && orientation <= 8)
+            ADD_ENTRY1(s, TIFF_ORIENTATION, AV_TIFF_SHORT, orientation);
+    }
+
     if (s->bpp_tab_size)
         ADD_ENTRY1(s, TIFF_SAMPLES_PER_PIXEL, AV_TIFF_SHORT, s->bpp_tab_size);
 

-----------------------------------------------------------------------

Summary of changes:
 libavcodec/tiff.h                         |  1 +
 libavcodec/tiffenc.c                      |  7 +++
 tests/fate/image.mak                      |  7 +++
 tests/ref/fate/jpg-exif-autorotate        | 64 +++++++++++++++++++++++++++
 tests/ref/fate/jpg-exif-noautorotate      | 63 ++++++++++++++++++++++++++
 tests/ref/fate/jpg-exif-rotation-override | 73 +++++++++++++++++++++++++++++++
 6 files changed, 215 insertions(+)
 create mode 100644 tests/ref/fate/jpg-exif-autorotate
 create mode 100644 tests/ref/fate/jpg-exif-noautorotate
 create mode 100644 tests/ref/fate/jpg-exif-rotation-override


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to