[FFmpeg-devel] avformat/mxfdec: Read color metadata from MXF

2020-07-30 Thread Harry Mallon
Hello,

Sorry I wasn't able to send this with git-send-email, I'm trying again with 
patch inline. The following patch adds reading colour metadata (transfer, 
primaries and colour space) from standard MXF files. I wrote it without seeing 
the other patch but it turned out very similar to this one that was never 
merged 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1474694344-31167-1-git-send-email-ste...@strobe.cc/
 .

Thanks.
Harry

From 3ff4c4187654e92a84ce165365e339995512c5be Mon Sep 17 00:00:00 2001

From: Harry Mallon 
Date: Mon, 27 Jul 2020 15:52:17 +0100
Subject: [PATCH 1/2] avformat/mxfdec: Read color metadata from MXF

Reads color_primaries, color_trc and color_space from mxf
headers. ULs are from https://registry.smpte-ra.org/ site.

Signed-off-by: Harry Mallon 
---
 libavformat/mxf.c| 49 
 libavformat/mxf.h|  3 +++
 libavformat/mxfdec.c | 15 ++
 3 files changed, 67 insertions(+)

diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 7d154ca9d3..e51fc48a84 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -86,6 +86,55 @@ const MXFCodecUL ff_mxf_codec_tag_uls[] = {
 { { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, 0 },
 };
 
+const MXFCodecUL ff_mxf_color_primaries_uls[] = {
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x01,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE170M }, /* SMPTE 170M */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x02,0x00,0x00 
}, 14, AVCOL_PRI_BT470BG }, /* ITU-R BT.470 PAL */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x03,0x00,0x00 
}, 14, AVCOL_PRI_BT709 }, /* ITU-R BT.709 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x04,0x00,0x00 
}, 14, AVCOL_PRI_BT2020 }, /* ITU-R BT.2020 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x05,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE428 }, /* SMPTE-DC28 DCDM */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x06,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE432 }, /* P3D65 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x08,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE428 }, /* Cinema Mezzanine */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x0a,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE431 }, /* P3DCI */
+/* alternate mappings for encoding */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x01,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE240M }, /* = AVCOL_PRI_SMPTE170M */
+
+{ { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, AVCOL_PRI_UNSPECIFIED },
+};
+
+const MXFCodecUL ff_mxf_color_trc_uls[] = {
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x01,0x00,0x00 
}, 14, AVCOL_TRC_GAMMA22 }, /* ITU-R BT.470 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x02,0x00,0x00 
}, 14, AVCOL_TRC_BT709 }, /* ITU-R BT.709 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x03,0x00,0x00 
}, 14, AVCOL_TRC_SMPTE240M }, /* SMPTE 240M */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x04,0x00,0x00 
}, 14, AVCOL_TRC_BT709 }, /* SMPTE 274/296M (must appear after ITU-R BT.709) */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x05,0x00,0x00 
}, 14, AVCOL_TRC_BT1361_ECG }, /* ITU-R BT.1361 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x06,0x00,0x00 
}, 14, AVCOL_TRC_LINEAR }, /* Linear */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x08,0x04,0x01,0x01,0x01,0x01,0x07,0x00,0x00 
}, 14, AVCOL_TRC_SMPTE428 }, /* SMPTE-DC28 DCDM */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x08,0x00,0x00 
}, 14, AVCOL_TRC_IEC61966_2_4 }, /* IEC 61966-2-4 xvYCC */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0E,0x04,0x01,0x01,0x01,0x01,0x09,0x00,0x00 
}, 14, AVCOL_TRC_BT2020_10 }, /* ITU-R BT.2020 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x0A,0x00,0x00 
}, 14, AVCOL_TRC_SMPTE2084 }, /* SMPTE ST 2084 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x0B,0x00,0x00 
}, 14, AVCOL_TRC_ARIB_STD_B67 }, /* Hybrid Log-Gamma OETF */
+/* alternate mappings for encoding */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x01,0x00,0x00 
}, 14, AVCOL_TRC_GAMMA28 }, /* = AVCOL_TRC_GAMMA22 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x02,0x00,0x00 
}, 14, AVCOL_TRC_SMPTE170M }, /* = AVCOL_TRC_BT709 */
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0E,0x04,0x01,0x01,0x01,0x01,0x09,0x00,0x00 
}, 14, AVCOL_TRC_BT2020_12 }, /* = AVCOL_TRC_BT2020_10 */
+
+{ { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, AVCOL_TR

[FFmpeg-devel] avformat/mxfdec: Read color metadata from MXF

2020-07-30 Thread Harry Mallon
Hello,

Sorry I wasn't able to send this with git-send-email. The following
patch adds reading colour metadata (transfer, primaries and colour
space) from standard MXF files. I wrote it without seeing the other
patch but it turned out very similar to this one that was never merged
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1474694344-31167-1-git-send-email-ste...@strobe.cc/

Thanks.
Harry




0001-avformat-mxfdec-Read-color-metadata-from-MXF.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".