On Tue, Aug 19, 2025 at 06:33:03PM +0300, [email protected] wrote:
> The branch, master has been updated
>        via  4c3f94f2651ce4d6834fbef10e5c287f25720ac9 (commit)
>        via  fe496b0308f1911138698b92bbafac582fa455d7 (commit)
>        via  535a07d14e16eb2930d2b1e16605eafa95959139 (commit)
>        via  8132ee046d1a03c5913759c50fce7beda8d3d627 (commit)
>        via  5d4f873ff31f86f9ae1927f37ca0fcb78da70512 (commit)
>        via  1e816ebefee0ef479fa76bd2a1fb9ec5d5e807df (commit) <----------we 
> are here
>        via  93a8091015978c44462626409af71789080bbef4 (commit)
>        via  303f60684f25ce63951480ef0f759acf41aac938 (commit)
>        via  5caaadee7954f2014d9e0a17d1edfb961893bcf1 (commit)
>        via  d3190a64c366a79091fe47fddf93c09a7d988802 (commit)
>        via  44af3829796427b89c4b76b56652cc5932ada616 (commit)
>        via  f5ad1c910c168d05cb01315773ab0bd094c9372f (commit)
>        via  e3aa1154aab2656c91ce61915f79516d9b563b61 (commit)
>        via  c6cc2115f45ac26ae42442f8796996eb410f4028 (commit)
>        via  52dba25661305e3c4a6209d46aea43cd327c960e (commit)
>        via  bfb17d26306592c85cf0c4e909099c621177b062 (commit)
>        via  ba2ea285e0f270a0a885b414cafaace6a89b9a91 (commit)
>        via  ad77345a5d14862f4701e5ad422b03b14934a5b9 (commit)
>        via  bb90b262d6d23f1bca3587a48abc15b951cbbf05 (commit)
>        via  a99fff4e2d4058c57599ba0b968862af82bdad5b (commit)
>       from  a6b5a382dd7ecdd27c5d0ebba688e1db409d18fd (commit)
> 
> 
> commit 1e816ebefee0ef479fa76bd2a1fb9ec5d5e807df
> Author:     Leo Izen <[email protected]>
> AuthorDate: Wed Apr 9 13:07:49 2025 -0400
> Commit:     Leo Izen <[email protected]>
> CommitDate: Tue Aug 19 11:26:48 2025 -0400
> 

>     avcodec/tiff: decode TIFF non-image-data tags into EXIF metadata struct

Thats not true, the EXIF tag table explicitly includes TIFF storage/layout tags 
such as StripOffsets, StripByteCounts, JPEGInterchangeFormat, and 
JPEGInterchangeFormatLength
and this can also be seen in the fate test results this adds

>     
>     This commit will cause TIFF files to store their tags in the EXIF
>     struct so tags such as orientation can be transfered to other formats
>     (such as PNG) in a way that doesn't corrupt the IFD.
>     
>     Signed-off-by: Leo Izen <[email protected]>
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index b468598fbb..d15bc497ec 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -47,6 +47,7 @@
>  #include "bytestream.h"
>  #include "codec_internal.h"
>  #include "decode.h"
> +#include "exif_internal.h"
>  #include "faxcompr.h"
>  #include "lzw.h"
>  #include "tiff.h"
> @@ -124,6 +125,8 @@ typedef struct TiffContext {
>  
>      int geotag_count;
>      TiffGeoTag *geotags;
> +
> +    AVExifMetadata exif_meta;
>  } TiffContext;
>  
>  static const float d65_white[3] = { 0.950456f, 1.f, 1.088754f };
> @@ -1937,6 +1940,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
> *p,
>      int is_dng;
>      int has_tile_bits, has_strip_bits;
>  
> +    av_exif_free(&s->exif_meta);
> +    /* this will not parse the image data */
> +    ret = av_exif_parse_buffer(avctx, avpkt->data, avpkt->size, 
> &s->exif_meta, AV_EXIF_TIFF_HEADER);
> +    if (ret < 0)
> +        av_log(avctx, AV_LOG_ERROR, "could not parse EXIF data: %s\n", 
> av_err2str(ret));
> +
>      bytestream2_init(&s->gb, avpkt->data, avpkt->size);
>  
>      // parse image header
> @@ -2402,6 +2411,10 @@ again:
>          }
>      }
>  
> +    ret = ff_exif_attach_ifd(avctx, p, &s->exif_meta);
> +    if (ret < 0)
> +        av_log(avctx, AV_LOG_ERROR, "error attaching EXIF ifd: %s\n", 
> av_err2str(ret));
> +

The IFD decoded and the image decoded are unrelated.
This simply decodes the first IFD if iam not mistaken

While the image decoded can be a different one, we support multiple
image TIFFs

Yet still the EXIF from the first image is attacht to the actually
returned, different image

Also this exports unknown tags rendered as 0xXXXX in frame->metadata
So this change turns a previously selective TIFF metadata export into a bulk 
dump of the chosen IFD contents
Is this intended ?


>      *got_frame = 1;
>  
>      return avpkt->size;
> @@ -2450,6 +2463,7 @@ static av_cold int tiff_end(AVCodecContext *avctx)
>      TiffContext *const s = avctx->priv_data;
>  
>      free_geotags(s);
> +    av_exif_free(&s->exif_meta);
>  
>      ff_lzw_decode_close(&s->lzw);
>      av_freep(&s->deinvert_buf);
> diff --git a/tests/ref/fate/exif-image-tiff b/tests/ref/fate/exif-image-tiff
> index 0e604d4271..81737cb983 100644
> --- a/tests/ref/fate/exif-image-tiff
> +++ b/tests/ref/fate/exif-image-tiff
> @@ -32,5 +32,27 @@ color_transfer=unknown
>  chroma_location=unspecified
>  TAG:document_name=image_small.tiff
>  TAG:page_number=    0 /     1
> -TAG:software=ImageMagick 6.5.8-0 2010-02-09 Q16 http://www.imagemagick.org
> +TAG:0x0129=      0,       1
> +TAG:ImageWidth=    200
> +TAG:ImageLength=    112
> +TAG:BitsPerSample=      8,       8,       8
> +TAG:Compression=      1
> +TAG:PhotometricInterpretation=      2
> +TAG:0x010A=      1
> +TAG:0x010D=image_small.tiff
> +TAG:StripOffsets=      8,    7808,   15608,   23408,   31208,   39008,   
> 46808,   54608
> +  62408
> +TAG:Orientation=      1
> +TAG:SamplesPerPixel=      3
> +TAG:RowsPerStrip=     13
> +TAG:StripByteCounts=   7800,    7800,    7800,    7800,    7800,    7800,    
> 7800,    7800
> +   4800
> +TAG:XResolution=1188833536:16777216
> +TAG:YResolution=1188833536:16777216
> +TAG:PlanarConfiguration=      1
> +TAG:ResolutionUnit=      3
> +TAG:Software=ImageMagick 6.5.8-0 2010-02-09 Q16 http://www.imagemagick.org
> +[SIDE_DATA]
> +side_data_type=EXIF metadata
> +[/SIDE_DATA]
>  [/FRAME]
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.

Attachment: signature.asc
Description: PGP signature

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

Reply via email to