From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id D3AEE4B2BF for ; Fri, 29 Aug 2025 07:59:29 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'+3VO6JRSuJoi2jMYPsmNok3mI67KckqMogz/AMvd1A4=', expected b'aOTre9gs18U3JMVVCzoO1TVj/2eQ1ObcigowRv82nAA=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756454317; h=mime-version : to : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=+3VO6JRSuJoi2jMYPsmNok3mI67KckqMogz/AMvd1A4=; b=zHVLS+M9KlbyI9QIAyhbNpFeOQDQvB1PVMvSgT4EsxqFg991E6gl0FVNe5ji2+6p8fpQ7 qX7dw0jFKTqF+nHM/SZMOXAaNELVDN718Vk1EUja3w2ZRLErlDkqNYcXWTq/wkohoz9kbqm kjgbpk73uvJrfON8TsNpcIvZ5hdx4IMi5cls9+XVmVy6vF9E7mML7k6CtS9QMSFppv4yFco qCZfVtkaJwEAUOgeZVA6IY3Qi4OWmF814SafgiAPawbtdPkML5bdxA3ljR7QCBELUQojqxg NuEv8xaUIVmYpxNj+na7j1RghbAUHsaSfzXrUs/HihGNPUUI/0I47E/e5WKg== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id C179168E719; Fri, 29 Aug 2025 10:58:37 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756454276; b=fRtbRGPHI65bkd2Tsb9Ry/S6vQx8UuvEz7QPzhdBmnYkbequRd5B1lWN/r7diSzcBuZcC QmxQefpMcuu7pF8gyWE5nl8yBGJwrzjTVjPLW0YGxA4KZVvMihQx2j94IoxjDtlGYzqDW/9 AacFfRs9Zq78fcg35Tswav0ExHDSZLPtZ5+WSCRvAjNsc0R9EFJntUUkDC3p3J98qYhvpZS m+yWAArvLW4dtBiC2iiNyumUVdpvZBa+8VXF//0NysTDXhuSEbcQDEqh1z0FVLC4fMs2zFo 6vJ26Ne0TxWpKuRaT3cHXb/HIjNWHDzPNUBvjkU4RdjyXWNjB/nbxp4LX40Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756454276; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=ey2W18KqyE/TCPNnGdDUdlsY93vft427iUPjuQ2K9QQ=; b=n8MvIFkomKAd/Q4WMfiBRHY6K7uBTHcoRkTqwrBRTmKzfSq5bLklWxjbBCR+qgmbWmfo3 zTnL4zTmdl2VPA7YduLk0nYqiqrtfrqKcPXvq/BKPeYQkwFq+kAi+qtY+EDTx1OQuc21IXF yiwJTWvoY5mQ9pXhB1+NuAyLZYtsidRNiJ/k5PHim+suS6SqsQggViL/mkzjlr5SmzdPAie aihZFsVH2u9VF+laHnkgj/9u3DpKgAz4rAACgbqH+qtnfCf6qh5ph3omrdVxN70JBUCR4s3 GqHmxLoJhvRflEQNSRfw+W8DbqkivccG83cGxGRSpBxdWvv0RlaS01hw6gkw== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756454264; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : from; bh=aOTre9gs18U3JMVVCzoO1TVj/2eQ1ObcigowRv82nAA=; b=ZegI/rXsUn/BYYCw0SZbF9rvaB6GEBR/otK7ySIoCs+3ff76NT8k1mavP9kOKHuZmPd4n mIA1gg22LXBLTPcmTh8oOSkmNBtdltdpVPDuW4Ficp6M3dPSUnuhwrGIoaviiwiYU8MYmgo wxz80b1SHNCm7hqSCQvtZ1Ti5JSpbz2DLVe4phDVwvTszhf2ACrU4V36mc/HdMVNiZxNRXd bbMXaQrJItWoWwNIYIWPWnjZkRT9jWY3POyDmW/9PkVRmJK0QaO0bGLfPAcwAXYkUSoOqqd Bqk138Gvfx9opTAZu1OLIN7a9A9C8JGUzQLbtFzp+eRYFYKyGwOwX9wvL/LQ== Received: from 5d8f51c41678 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 17847680303 for ; Fri, 29 Aug 2025 10:57:44 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Message-ID: <175645426431.25.964419051948033752@463a07221176> Message-ID-Hash: 3CBL6GXXX6PVDDM5GWVJ45GQ6ENAERGG X-Message-ID-Hash: 3CBL6GXXX6PVDDM5GWVJ45GQ6ENAERGG X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] dpxenc: map AVCodecContext color transfer and color primaries fields (PR #20365) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ross via ffmpeg-devel Cc: Peter Ross Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20365 opened by Peter Ross (pross) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20365 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20365.patch Fixes issue #20341 >>From cbac28e3292bc8240a8b3aca371ffc611b8cdcf7 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Fri, 29 Aug 2025 17:51:06 +1000 Subject: [PATCH 1/2] avcodec/dpx: move enum DPX_TRC and DPX_COL_SPEC to dpx.h --- libavcodec/dpx.c | 33 +--------------------------- libavcodec/dpx.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 32 deletions(-) create mode 100644 libavcodec/dpx.h diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 80616d98a2..1b1ada316a 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -27,38 +27,7 @@ #include "avcodec.h" #include "codec_internal.h" #include "decode.h" - -enum DPX_TRC { - DPX_TRC_USER_DEFINED = 0, - DPX_TRC_PRINTING_DENSITY = 1, - DPX_TRC_LINEAR = 2, - DPX_TRC_LOGARITHMIC = 3, - DPX_TRC_UNSPECIFIED_VIDEO = 4, - DPX_TRC_SMPTE_274 = 5, - DPX_TRC_ITU_R_709_4 = 6, - DPX_TRC_ITU_R_601_625 = 7, - DPX_TRC_ITU_R_601_525 = 8, - DPX_TRC_SMPTE_170 = 9, - DPX_TRC_ITU_R_624_4_PAL = 10, - DPX_TRC_Z_LINEAR = 11, - DPX_TRC_Z_HOMOGENEOUS = 12, -}; - -enum DPX_COL_SPEC { - DPX_COL_SPEC_USER_DEFINED = 0, - DPX_COL_SPEC_PRINTING_DENSITY = 1, - /* 2 = N/A */ - /* 3 = N/A */ - DPX_COL_SPEC_UNSPECIFIED_VIDEO = 4, - DPX_COL_SPEC_SMPTE_274 = 5, - DPX_COL_SPEC_ITU_R_709_4 = 6, - DPX_COL_SPEC_ITU_R_601_625 = 7, - DPX_COL_SPEC_ITU_R_601_525 = 8, - DPX_COL_SPEC_SMPTE_170 = 9, - DPX_COL_SPEC_ITU_R_624_4_PAL = 10, - /* 11 = N/A */ - /* 12 = N/A */ -}; +#include "dpx.h" static unsigned int read16(const uint8_t **ptr, int is_big) { diff --git a/libavcodec/dpx.h b/libavcodec/dpx.h new file mode 100644 index 0000000000..800c651e5a --- /dev/null +++ b/libavcodec/dpx.h @@ -0,0 +1,57 @@ +/* + * DPX (.dpx) image decoder + * Copyright (c) 2009 Jimmy Christensen + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DPX_H +#define AVCODEC_DPX_H + +enum DPX_TRC { + DPX_TRC_USER_DEFINED = 0, + DPX_TRC_PRINTING_DENSITY = 1, + DPX_TRC_LINEAR = 2, + DPX_TRC_LOGARITHMIC = 3, + DPX_TRC_UNSPECIFIED_VIDEO = 4, + DPX_TRC_SMPTE_274 = 5, + DPX_TRC_ITU_R_709_4 = 6, + DPX_TRC_ITU_R_601_625 = 7, + DPX_TRC_ITU_R_601_525 = 8, + DPX_TRC_SMPTE_170 = 9, + DPX_TRC_ITU_R_624_4_PAL = 10, + DPX_TRC_Z_LINEAR = 11, + DPX_TRC_Z_HOMOGENEOUS = 12, +}; + +enum DPX_COL_SPEC { + DPX_COL_SPEC_USER_DEFINED = 0, + DPX_COL_SPEC_PRINTING_DENSITY = 1, + /* 2 = N/A */ + /* 3 = N/A */ + DPX_COL_SPEC_UNSPECIFIED_VIDEO = 4, + DPX_COL_SPEC_SMPTE_274 = 5, + DPX_COL_SPEC_ITU_R_709_4 = 6, + DPX_COL_SPEC_ITU_R_601_625 = 7, + DPX_COL_SPEC_ITU_R_601_525 = 8, + DPX_COL_SPEC_SMPTE_170 = 9, + DPX_COL_SPEC_ITU_R_624_4_PAL = 10, + /* 11 = N/A */ + /* 12 = N/A */ +}; + +#endif /* AVCODEC_DPX_H */ -- 2.49.1 >>From f10e4902c9c64119ca3f030c44ad3b97c6db1e70 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Fri, 29 Aug 2025 17:51:46 +1000 Subject: [PATCH 2/2] libavcodec/dpxenc: map AVCodecContext color transfer and color primaries fields --- libavcodec/dpxenc.c | 44 +++++++++++++++++++++++++++++++++-- tests/ref/lavf/dpx | 2 +- tests/ref/lavf/gbrp10le.dpx | 2 +- tests/ref/lavf/gbrp12le.dpx | 2 +- tests/ref/lavf/rgb48le.dpx | 2 +- tests/ref/lavf/rgb48le_10.dpx | 2 +- tests/ref/lavf/rgba64le.dpx | 2 +- 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c index 400ff98395..e136c7a249 100644 --- a/libavcodec/dpxenc.c +++ b/libavcodec/dpxenc.c @@ -26,6 +26,7 @@ #include "codec_internal.h" #include "encode.h" #include "version.h" +#include "dpx.h" typedef struct DPXContext { int big_endian; @@ -178,6 +179,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, DPXContext *s = avctx->priv_data; int size, ret, need_align, len; uint8_t *buf; + int color_trc, color_spec; #define HEADER_SIZE 1664 /* DPX Generic header */ if (s->bits_per_component == 10) @@ -217,8 +219,46 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, write32(buf + 772, avctx->width); write32(buf + 776, avctx->height); buf[800] = s->descriptor; - buf[801] = 2; /* linear transfer */ - buf[802] = 2; /* linear colorimetric */ + + switch (avctx->color_trc) { + case AVCOL_TRC_BT709: + color_trc = DPX_TRC_ITU_R_709_4; + break; + default: + av_log(avctx, AV_LOG_WARNING, "unsupported color transfer\n"); + case AVCOL_TRC_UNSPECIFIED: + color_trc = DPX_TRC_UNSPECIFIED_VIDEO; + break; + case AVCOL_TRC_GAMMA28: + color_trc = DPX_TRC_ITU_R_624_4_PAL; + break; + case AVCOL_TRC_SMPTE170M: + color_trc = DPX_TRC_SMPTE_170; + break; + case AVCOL_TRC_LINEAR: + color_trc = DPX_TRC_LINEAR; + break; + } + buf[801] = color_trc; + + switch (avctx->color_primaries) { + case AVCOL_PRI_BT709: + color_spec = DPX_COL_SPEC_ITU_R_709_4; + break; + default: + av_log(avctx, AV_LOG_WARNING, "unsupported colorimetric specification\n"); + case AVCOL_PRI_UNSPECIFIED: + color_spec = DPX_COL_SPEC_UNSPECIFIED_VIDEO; + break; + case AVCOL_PRI_BT470BG: + color_spec = DPX_COL_SPEC_ITU_R_624_4_PAL; + break; + case AVCOL_PRI_SMPTE170M: + color_spec = DPX_COL_SPEC_SMPTE_170; + break; + } + buf[802] = color_spec; + buf[803] = s->bits_per_component; write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ? 1 : 0); /* packing method */ diff --git a/tests/ref/lavf/dpx b/tests/ref/lavf/dpx index 736fe39cff..9ac74196d0 100644 --- a/tests/ref/lavf/dpx +++ b/tests/ref/lavf/dpx @@ -1,3 +1,3 @@ -4c8880d5835ffb5fe37c1ed8c8d404de *tests/data/images/dpx/02.dpx +1ac8708e2d140b63915f0abfbdeb953f *tests/data/images/dpx/02.dpx 305792 tests/data/images/dpx/02.dpx tests/data/images/dpx/%02d.dpx CRC=0x6da01946 diff --git a/tests/ref/lavf/gbrp10le.dpx b/tests/ref/lavf/gbrp10le.dpx index 35e34d0859..54c01ea2fa 100644 --- a/tests/ref/lavf/gbrp10le.dpx +++ b/tests/ref/lavf/gbrp10le.dpx @@ -1,3 +1,3 @@ -7ca935d5d5e00c54acbc85565d3039b6 *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx +79aa69bb78c4422a883a7d2323f6b066 *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx 407168 tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx tests/data/images/gbrp10le.dpx/%02d.gbrp10le.dpx CRC=0xe6663fba diff --git a/tests/ref/lavf/gbrp12le.dpx b/tests/ref/lavf/gbrp12le.dpx index 2758982d5a..ed15abe056 100644 --- a/tests/ref/lavf/gbrp12le.dpx +++ b/tests/ref/lavf/gbrp12le.dpx @@ -1,3 +1,3 @@ -a4cfea1797c928f2eff73573e559675d *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx +6969191e30f9f8b0d895784dc4d07f96 *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx 609920 tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx tests/data/images/gbrp12le.dpx/%02d.gbrp12le.dpx CRC=0x1c755633 diff --git a/tests/ref/lavf/rgb48le.dpx b/tests/ref/lavf/rgb48le.dpx index b808ff4bdc..7d818d9d0f 100644 --- a/tests/ref/lavf/rgb48le.dpx +++ b/tests/ref/lavf/rgb48le.dpx @@ -1,3 +1,3 @@ -075963c3c08978b6a20555ba09161434 *tests/data/images/rgb48le.dpx/02.rgb48le.dpx +35376cc1ff5f1b934cdfc1bf0776cf48 *tests/data/images/rgb48le.dpx/02.rgb48le.dpx 609920 tests/data/images/rgb48le.dpx/02.rgb48le.dpx tests/data/images/rgb48le.dpx/%02d.rgb48le.dpx CRC=0xe5b9c023 diff --git a/tests/ref/lavf/rgb48le_10.dpx b/tests/ref/lavf/rgb48le_10.dpx index a49d929f7f..2a5d82dff5 100644 --- a/tests/ref/lavf/rgb48le_10.dpx +++ b/tests/ref/lavf/rgb48le_10.dpx @@ -1,3 +1,3 @@ -b9f22728f8ff393bf30cf6cbd624fa95 *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx +46533558d2f7ff875756dcd9227b9907 *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx 407168 tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx tests/data/images/rgb48le_10.dpx/%02d.rgb48le_10.dpx CRC=0xf38d5830 diff --git a/tests/ref/lavf/rgba64le.dpx b/tests/ref/lavf/rgba64le.dpx index 5ccde8975b..66ea06d33b 100644 --- a/tests/ref/lavf/rgba64le.dpx +++ b/tests/ref/lavf/rgba64le.dpx @@ -1,3 +1,3 @@ -545603630f30dec2768c8ae8d12eb8ea *tests/data/images/rgba64le.dpx/02.rgba64le.dpx +89f545002e21044b01378aeccc437dcd *tests/data/images/rgba64le.dpx/02.rgba64le.dpx 812672 tests/data/images/rgba64le.dpx/02.rgba64le.dpx tests/data/images/rgba64le.dpx/%02d.rgba64le.dpx CRC=0xe72ce131 -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org