From patchwork Mon Sep 16 14:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 35180 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9fc3:0:b0:48e:c0f8:d0de with SMTP id k3csp1424006vqy; Mon, 16 Sep 2024 08:39:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVf0UZGgQpJLWy6usuXlOYuBK/YMeLhO7zFH2T4ToexRHEwQMu0LTxG8V/76krEaGOBB68athVL5HNYXRxqxIbr@gmail.com X-Google-Smtp-Source: AGHT+IFwPy8+R7EnwAUIWNDof6oagdA7NJqXcEWldzLxL8hgGSUm7c3tmrShPtXBecycQnOqLoqb X-Received: by 2002:a17:907:7d87:b0:a8a:9054:83b5 with SMTP id a640c23a62f3a-a90293fc43fmr707699866b.3.1726501156078; Mon, 16 Sep 2024 08:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726501156; cv=none; d=google.com; s=arc-20240605; b=VprcQacYhHMY1xJ64CEgtS+gce2hjRDJgy/PofrqPzk12Z+B0RtOIV3Wc3tjVOwEdu 6wAd7DH9VPdtE0CLnhr5qSWj2f7OJcJYeLhIFPkdAMmIwwEVHB1U7OHe0UPCqTr4YOjw vFcyLxVsGmwsB3SshjB9T+R1EvB/zwZQuzdfYmgvtX3HtcyizPID7dx+eObXMKMKNT3h bAYLg9lrzgjezSO7IT6wgSNv1oF4DElO2q1e4eMWVVOR+9+cxQInCbATq1Ctd5Nc3PLR fc2sNiUBYbUxGq6P2JA9iulw6SSErYj0T1iFpwyblMwd5qswpEjJhN5mvnFtXozTuLPg Msng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=K73/MgJevLYuiST5DwoKR90H1lsHj7AiebRi5PRHc4s=; fh=+bdjGe20eEUjtjncwA1dnEEVYNfJL4vyhV+sIRR4l+g=; b=EBAQdnXPeeO2RMjpAMHlKXVruvmaKH8ILmcZ012OCYWCJ5d85WWgapg/xPKSirTmJQ yOCzLF5eHtgm6o2Dy8U8+4Md/vomreMNoy+xQZLZbaeKHMYWbVxCMy0cnLkmGF6Tjs0M 7WRbAn8qY51GJ9PRtbezdTWxZasTMY9AQh3ZR3pXOVOwPdfQ+WM4mezhsfWB2z7uA8jA hfqC3TkO2/U75EiJ3CeDEg73NpmpJDXb2ABIPwitdPANoUK+uueQ+pXZpYBTWW9ITic6 Wb2erCM7KkEpv7LPgeoje9naDjYXmynMn020RbvcG/6jKTeA5Nf4Ktn1HTRvguzGcvpS 3oZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=TdKtcfkG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a906133aae5si393472166b.857.2024.09.16.08.39.15; Mon, 16 Sep 2024 08:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=TdKtcfkG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3BBC968DC70; Mon, 16 Sep 2024 17:44:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E2A7568D4E7 for ; Mon, 16 Sep 2024 17:44:03 +0300 (EEST) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5e1cdfe241eso1226246eaf.1 for ; Mon, 16 Sep 2024 07:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726497842; x=1727102642; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bYGEu/CBS3wOFXe6XtbGsL7M9KcpFe9jG8hqyqlUXtU=; b=TdKtcfkGGDm0X8Wp4HMtv927WrQepZGmyT20Jss+mQ7ugWnPzo9JVnEY4P6QOqLkF4 bIC1syN5k64wEqaMtoxbHxx+MebsqZDVr1MMW+cbF0YOcoe1sR/VEcNQq8yHCoP19lir 76kmfjzBm5QDETvO1mOMngqAsUzpAlEFPSYVItvhEPoc/3PqHQbCyeJqyNbqPFjiquzD 4zsFdcNFVEBd7kOl/AaA3cNRrDCjl2x6UVZMr/xTahkY6GVxfSzyRpx+vEA0QTLjv6ts 48M01XVqjAUD1YgDCVivGKehP+nbRjYBtTcKWSCBRiF6VHD4KdsIz8U6WXL9Ymx97Sdv 33Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726497842; x=1727102642; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bYGEu/CBS3wOFXe6XtbGsL7M9KcpFe9jG8hqyqlUXtU=; b=w/+y5nv8SrtxxcWKd1qwzD18dRqiOs/yywa/u7URK30U6c/V/B93EPXTxeyQlnkSYF ikk6aJmX5/tZ8QHTK5GD8/TP0TuWtwldqILK7kxKvoJeFecyp5kpzwA+9k4If0jGNSUT 8f2o/F5wALZtzH1Y74EdzR+oFqgROyUPG84KwIhvCh3+nXLc+J4dXJ0G9z2qUWkzKf4z o3tjqkufQzlvpP9dai2pGGyHyM5Y3IRrpBea4w1u6fSZ871zZmBnke9XlaRixoMtz8PY DJ1Gn7iETG3oLeImDVj0V6VkzDyIW7lfjIbx+N2GhJia6INMwZy+QMsQRd9gKjkMDeDh OKzg== X-Gm-Message-State: AOJu0Yx2CyVdQTTbyi/HK4qmJEFkfWQSzWxqq/iEwGTNn4tXTrPEgXjP Lcna2NMHMCiU9ZrOteph0U4C7RE8KHTiXjxh3Wn7RQQqR579grFq5bKyhg== X-Received: by 2002:a05:6358:3a0c:b0:1a5:2f55:c46e with SMTP id e5c5f4694b2df-1bc394938bdmr204562155d.9.1726497841700; Mon, 16 Sep 2024 07:44:01 -0700 (PDT) Received: from gauss.local (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-459aac864c9sm27815501cf.38.2024.09.16.07.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 07:44:01 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Mon, 16 Sep 2024 10:43:41 -0400 Message-ID: <20240916144344.390716-1-leo.izen@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 0/3] [RFC] Exif Overhaul X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Leo Izen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5GpXlPLXAom2 I've made some changes to the last EXIF overhaul patch I sent, notably I fixed up some bugs and added MakerNote parsing, so it should not corrupt MakerNotes that are inside TIFF files. MakerNote is supposed to be a binary blob but many camera manufacturers treat it as an IFD (e.g. Canon) with offsets relative to the start of the file, so it has to be parsed in order to move it from TIFF to another file or it will be corrupted. I also fixed the fate tests now that pngenc.c writes eXIf chunks, so those should pass. I haven't come up with a solution that Andreas proposed, which is: > If I see this correctly, then these patches can lead to a situation > where an input packet has rotation metadata in exif which gets exported > twice -- as displaymatrix and as exif metadata side data. If the user > changes the displaymatrix (e.g. applies the transformation to the image > data and removes the displaymatrix side data before reencoding), the > exif data (that the user would probably not be aware of) would still be > there and get propagated into the output, corrupting it. Zeroing out the EXIF orientation tag upon attaching the displaymatrix is something I did consider, but it would corrupt encoding unless I also read the displaymatrix data and attach it as EXIF orientation. This isn't too hard if the Orientation tag exists but it's more difficult if it doesn't already exist. It's also not clear what to do if the AVDisplayMatrix is not in the dihedral group D4. Currently there's no code that takes an AVDictionary and writes it back into EXIF as these are not compatible structures. EXIF includes integers of varying lengths, while AVDictionary contains strings only. Leo Izen (3): various: change EXIF metadata into AVFrameSideData avcodec/pngdec: parse eXIf chunk avcodec/pngenc: write eXIf chunks fftools/ffprobe.c | 27 +- libavcodec/Makefile | 1 + libavcodec/exif.c | 394 +++++++++++++++++++++-- libavcodec/exif.h | 32 +- libavcodec/exif_internal.h | 55 ++++ libavcodec/mjpegdec.c | 91 +----- libavcodec/mjpegdec.h | 2 +- libavcodec/pngdec.c | 35 ++ libavcodec/pngenc.c | 4 + libavcodec/tiff.c | 19 +- libavcodec/tiff.h | 1 + libavcodec/version.h | 2 +- libavcodec/webp.c | 38 +-- libavformat/avidec.c | 4 +- libavutil/frame.c | 2 + libavutil/frame.h | 6 + tests/ref/fate/cover-art-mp3-id3v2-remux | 6 +- tests/ref/fate/exif-image-embedded | 5 +- tests/ref/fate/exif-image-jpg | 91 +++--- tests/ref/fate/exif-image-webp | 91 +++--- tests/ref/fate/mov-cover-image | 6 +- 21 files changed, 676 insertions(+), 236 deletions(-) create mode 100644 libavcodec/exif_internal.h