History

avcodec: add API for automatic handling of icc profiles

This functionally already exists, but as pointed out in #9672 and #9673, requiring users to manually include filters is clumsy, error-prone and hard to use together with tools like ffplay. To streamline ICC profile support, add a new AVCodecContext flag to globally enable reading and writing ICC profiles, automatically, for all appropriate media types. Note that this commit only includes the new API. The implementation is split off to separate commits for readability.

Niklas Haas committed 4 years ago

Commit e1a0f2d1 parent 61ffa235 files · +15 −1Browse files

Unified · Split

5 files
  1. doc/APIchanges +5 −0
  2. doc/codecs.texi +2 −0
  3. libavcodec/avcodec.h +6 −0
  4. libavcodec/options_table.h +1 −0
  5. libavcodec/version.h +1 −1
doc/APIchanges+5−0
@@ -14,6 +14,11 @@ libavutil: 2021-04-27 · 13 unmodified lines
14 14
15API changes, most recent first:15API changes, most recent first:
16 16
172022-07-xx - xxxxxxxxx - lavc 59.40.100 - avcodec.h
18 Add the AV_CODEC_FLAG2_ICC_PROFILES flag to AVCodecContext, to enable
19 automatic reading and writing of embedded ICC profiles in image files.
20 The "flags2" option now supports the corresponding flag "icc_profiles".
21
172022-07-xx - xxxxxxxxxx - lavu 57.30.100 - frame.h222022-07-xx - xxxxxxxxxx - lavu 57.30.100 - frame.h
18 Add AVFrame.duration, deprecate AVFrame.pkt_duration.23 Add AVFrame.duration, deprecate AVFrame.pkt_duration.
19 24
doc/codecs.texi+2−0
@@ -644,6 +644,8 @@ for codecs that support it. See also @file{doc/examples/export_mvs.c}. · 643 unmodified lines
644Do not skip samples and export skip information as frame side data.644Do not skip samples and export skip information as frame side data.
645@item ass_ro_flush_noop645@item ass_ro_flush_noop
646Do not reset ASS ReadOrder field on flush.646Do not reset ASS ReadOrder field on flush.
647@item icc_profiles
648Generate/parse embedded ICC profiles from/to colorimetry tags.
647@end table649@end table
648 650
649@item export_side_data @var{flags} (@emph{decoding/encoding,audio,video,subtitles})651@item export_side_data @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
libavcodec/avcodec.h+6−0
@@ -331,6 +331,12 @@ typedef struct RcOverride{ · 330 unmodified lines
331 * Do not reset ASS ReadOrder field on flush (subtitles decoding)331 * Do not reset ASS ReadOrder field on flush (subtitles decoding)
332 */332 */
333#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)333#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
334/**
335 * Generate/parse ICC profiles on encode/decode, as appropriate for the type of
336 * file. No effect on codecs which cannot contain embedded ICC profiles, or
337 * when compiled without support for lcms2.
338 */
339#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31)
334 340
335/* Unsupported options :341/* Unsupported options :
336 * Syntax Arithmetic coding (SAC)342 * Syntax Arithmetic coding (SAC)
libavcodec/options_table.h+1−0
@@ -83,6 +83,7 @@ static const AVOption avcodec_options[] = { · 82 unmodified lines
83{"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},83{"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
84{"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, A|D, "flags2"},84{"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, A|D, "flags2"},
85{"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"},85{"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"},
86{"icc_profiles", "generate/parse embedded ICC profiles from/to colorimetry tags", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_ICC_PROFILES}, INT_MIN, INT_MAX, S|D, "flags2"},
86{"export_side_data", "Export metadata as side data", OFFSET(export_side_data), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, A|V|S|D|E, "export_side_data"},87{"export_side_data", "Export metadata as side data", OFFSET(export_side_data), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, A|V|S|D|E, "export_side_data"},
87{"mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_MVS}, INT_MIN, INT_MAX, V|D, "export_side_data"},88{"mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_MVS}, INT_MIN, INT_MAX, V|D, "export_side_data"},
88{"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"},89{"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"},
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30#include "version_major.h"30#include "version_major.h"
31 31
32#define LIBAVCODEC_VERSION_MINOR 3932#define LIBAVCODEC_VERSION_MINOR 40
33#define LIBAVCODEC_VERSION_MICRO 10033#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t