The branch, master has been updated
via e85947576c517675a12b6dd6615be0079d56e11a (commit)
via bcfb4b2e3ea6f5f57e88794d9a071e80bcef9198 (commit)
via 71c7b9156bd944c7eeeed08db03cfdc7d3b4ea92 (commit)
via 92a688cabdb0f3a53ca6f460fe942ce734e3b12a (commit)
via aeb9b19ebc0295d7fcaa5ed09f9b267fea57895c (commit)
from 08c94518c9ca639dc8333c0403f6acad2496a6e1 (commit)
- Log -----------------------------------------------------------------
commit e85947576c517675a12b6dd6615be0079d56e11a
Author: Lynne <[email protected]>
AuthorDate: Tue Oct 28 20:45:43 2025 +0100
Commit: Lynne <[email protected]>
CommitDate: Tue Oct 28 20:46:25 2025 +0100
ffv1enc_vulkan: limit probability caching to RADV only
Nvidia's drivers recently broke this.
diff --git a/libavcodec/ffv1enc_vulkan.c b/libavcodec/ffv1enc_vulkan.c
index 0baeabd588..8a624a305d 100644
--- a/libavcodec/ffv1enc_vulkan.c
+++ b/libavcodec/ffv1enc_vulkan.c
@@ -1289,7 +1289,8 @@ static int init_encode_shader(AVCodecContext *avctx,
FFVkSPIRVCompiler *spv)
uint8_t *spv_data;
size_t spv_len;
void *spv_opaque = NULL;
- int use_cached_reader = fv->ctx.ac != AC_GOLOMB_RICE;
+ int use_cached_reader = fv->ctx.ac != AC_GOLOMB_RICE &&
+ fv->s.driver_props.driverID ==
VK_DRIVER_ID_MESA_RADV;
RET(ff_vk_shader_init(&fv->s, shd, "ffv1_enc",
VK_SHADER_STAGE_COMPUTE_BIT,
commit bcfb4b2e3ea6f5f57e88794d9a071e80bcef9198
Author: Lynne <[email protected]>
AuthorDate: Tue Oct 28 11:48:56 2025 +0100
Commit: Lynne <[email protected]>
CommitDate: Tue Oct 28 20:46:21 2025 +0100
prores_raw_parser: set color params based on vendor
Panasonic cameras record ProRes RAW in V-Log/V-Gamut internally.
Atomos is a brand of recorders which can record uncompressed
non-debayered RAW over HDMI.
All known cameras output linear RAW over HDMI, so mark the transfer function
as linear in that case.
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index c67935a820..cc6b75319e 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -61,7 +61,23 @@ static int prores_raw_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
}
/* Vendor header (e.g. "peac" for Panasonic or "atm0" for Atmos) */
- bytestream2_skip(&gb, 4);
+ switch (bytestream2_get_be32(&gb)) {
+ case MKBETAG('p','e','a','c'):
+ /* Internal recording from a Panasonic camera, V-Log */
+ avctx->color_primaries = AVCOL_PRI_V_GAMUT;
+ avctx->color_trc = AVCOL_TRC_V_LOG;
+ break;
+ case MKBETAG('a','t','m','0'):
+ /* External recording from an Atomos recorder. Cameras universally
+ * record in their own native log curve internally, but linearize it
+ * when outputting RAW externally */
+ avctx->color_primaries = AVCOL_PRI_UNSPECIFIED;
+ avctx->color_trc = AVCOL_TRC_LINEAR;
+ break;
+ default:
+ avctx->color_trc = AVCOL_TRC_UNSPECIFIED;
+ break;
+ };
s->width = bytestream2_get_be16(&gb);
s->height = bytestream2_get_be16(&gb);
commit 71c7b9156bd944c7eeeed08db03cfdc7d3b4ea92
Author: Lynne <[email protected]>
AuthorDate: Tue Oct 28 11:53:18 2025 +0100
Commit: Lynne <[email protected]>
CommitDate: Tue Oct 28 20:46:21 2025 +0100
lavu: bump minor and add APIchanges entry for V-Log/V-Gamut
diff --git a/doc/APIchanges b/doc/APIchanges
index 8d24f22473..9086093149 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2025-10-xx - xxxxxxxxxx - lavu 60.16.100 - pixfmt.h
+ Add AVCOL_TRC_EXT_BASE and AVCOL_TRC_L_LOG.
+
2025-10-xx - xxxxxxxxxx - lavu 60.15.100 - pixfmt.h
Add AV_PIX_FMT_GRAY10MSB, AV_PIX_FMT_GRAY12MSB,
AV_PIX_FMT_YUV420P10MSB, AV_PIX_FMT_YUV420P12MSB,
diff --git a/libavutil/version.h b/libavutil/version.h
index f2c554a560..a9039fe865 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 60
-#define LIBAVUTIL_VERSION_MINOR 15
+#define LIBAVUTIL_VERSION_MINOR 16
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
commit 92a688cabdb0f3a53ca6f460fe942ce734e3b12a
Author: Lynne <[email protected]>
AuthorDate: Tue Oct 28 14:18:19 2025 +0100
Commit: Lynne <[email protected]>
CommitDate: Tue Oct 28 20:46:21 2025 +0100
lavu: add support for Panasonic V-Gamut
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 6bf0d9fc87..f2cf83ab33 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1665,6 +1665,7 @@ static const AVOption libplacebo_options[] = {
{"smpte432", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_SMPTE432}, INT_MIN, INT_MAX, STATIC, .unit =
"color_primaries"},
{"jedec-p22", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_JEDEC_P22}, INT_MIN, INT_MAX, STATIC, .unit =
"color_primaries"},
{"ebu3213", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_EBU3213}, INT_MIN, INT_MAX, STATIC, .unit =
"color_primaries"},
+ {"vgamut", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_V_GAMUT}, INT_MIN, INT_MAX, STATIC, .unit =
"color_primaries"},
{"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT,
{.i64=-1}, -1, AVCOL_TRC_NB-1, DYNAMIC, .unit = "color_trc"},
{"auto", "keep the same color transfer", 0, AV_OPT_TYPE_CONST, {.i64=-1},
INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index dd765f9d08..17ffa098c2 100644
--- a/libavfilter/vf_setparams.c
+++ b/libavfilter/vf_setparams.c
@@ -66,7 +66,7 @@ static const AVOption setparams_options[] = {
{"pc", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"},
{"jpeg", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"},
- {"color_primaries", "select color primaries", OFFSET(color_primaries),
AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_PRI_NB-1, FLAGS, .unit =
"color_primaries"},
+ {"color_primaries", "select color primaries", OFFSET(color_primaries),
AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_PRI_EXT_NB-1, FLAGS, .unit =
"color_primaries"},
{"auto", "keep the same color primaries", 0, AV_OPT_TYPE_CONST,
{.i64=-1}, 0, 0, FLAGS, .unit = "color_primaries"},
{"bt709", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_BT709}, 0, 0, FLAGS, .unit = "color_primaries"},
{"unknown", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_UNSPECIFIED}, 0, 0, FLAGS, .unit = "color_primaries"},
@@ -81,6 +81,7 @@ static const AVOption setparams_options[] = {
{"smpte432", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_SMPTE432}, 0, 0, FLAGS, .unit = "color_primaries"},
{"jedec-p22", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_JEDEC_P22}, 0, 0, FLAGS, .unit = "color_primaries"},
{"ebu3213", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_EBU3213}, 0, 0, FLAGS, .unit = "color_primaries"},
+ {"vgamut", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_V_GAMUT}, 0, 0, FLAGS, .unit = "color_primaries"},
{"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT,
{.i64=-1}, -1, AVCOL_TRC_EXT_NB-1, FLAGS, .unit = "color_trc"},
{"auto", "keep the same color transfer", 0, AV_OPT_TYPE_CONST, {.i64=-1},
0, 0, FLAGS, .unit = "color_trc"},
diff --git a/libavutil/csp.c b/libavutil/csp.c
index 914de37985..c8ecddc110 100644
--- a/libavutil/csp.c
+++ b/libavutil/csp.c
@@ -87,16 +87,21 @@ static const AVColorPrimariesDesc
color_primaries[AVCOL_PRI_NB] = {
[AVCOL_PRI_JEDEC_P22] = { WP_D65, { { AVR(0.630), AVR(0.340) }, {
AVR(0.295), AVR(0.605) }, { AVR(0.155), AVR(0.077) } } },
};
+static const AVColorPrimariesDesc color_primaries_ext[AVCOL_PRI_EXT_NB -
+ AVCOL_PRI_EXT_BASE] = {
+ [AVCOL_PRI_V_GAMUT - AVCOL_PRI_EXT_BASE] = { WP_D65, { { AVR(0.730),
AVR(0.280) }, { AVR(0.165), AVR(0.840) }, { AVR(0.100), AVR(-0.030) } } },
+};
+
const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum
AVColorPrimaries prm)
{
- const AVColorPrimariesDesc *p;
-
- if ((unsigned)prm >= AVCOL_PRI_NB)
- return NULL;
- p = &color_primaries[prm];
+ const AVColorPrimariesDesc *p = NULL;
+ if ((unsigned)prm < AVCOL_PRI_NB)
+ p = &color_primaries[prm];
+ else if (((unsigned)prm >= AVCOL_PRI_EXT_BASE) &&
+ ((unsigned)prm < AVCOL_PRI_EXT_NB))
+ p = &color_primaries_ext[prm - AVCOL_PRI_EXT_BASE];
if (!p->prim.r.x.num)
return NULL;
-
return p;
}
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7fc47e8ba1..0e00142995 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -3430,6 +3430,11 @@ static const char * const
color_primaries_names[AVCOL_PRI_NB] = {
[AVCOL_PRI_EBU3213] = "ebu3213",
};
+static const char * const color_primaries_names_ext[AVCOL_PRI_EXT_NB -
+ AVCOL_PRI_EXT_BASE] = {
+ [AVCOL_PRI_V_GAMUT - AVCOL_PRI_EXT_BASE] = "vgamut",
+};
+
static const char * const color_transfer_names[] = {
[AVCOL_TRC_RESERVED0] = "reserved",
[AVCOL_TRC_BT709] = "bt709",
@@ -3922,8 +3927,12 @@ int av_color_range_from_name(const char *name)
const char *av_color_primaries_name(enum AVColorPrimaries primaries)
{
- return (unsigned) primaries < AVCOL_PRI_NB ?
- color_primaries_names[primaries] : NULL;
+ if ((unsigned)primaries < AVCOL_PRI_NB)
+ return color_primaries_names[primaries];
+ else if (((unsigned)primaries >= AVCOL_PRI_EXT_BASE) &&
+ ((unsigned)primaries < AVCOL_PRI_EXT_NB))
+ return color_primaries_names_ext[primaries - AVCOL_TRC_EXT_BASE];
+ return NULL;
}
int av_color_primaries_from_name(const char *name)
@@ -3938,6 +3947,14 @@ int av_color_primaries_from_name(const char *name)
return i;
}
+ for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names_ext); i++) {
+ if (!color_primaries_names_ext[i])
+ continue;
+
+ if (av_strstart(name, color_primaries_names_ext[i], NULL))
+ return AVCOL_PRI_EXT_BASE + i;
+ }
+
return AVERROR(EINVAL);
}
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 7cb76d503c..27e0b2d7a7 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -670,7 +670,12 @@ enum AVColorPrimaries {
AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display
P3
AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of
JEDEC P22 group phosphors
AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213,
- AVCOL_PRI_NB ///< Not part of ABI
+ AVCOL_PRI_NB, ///< Not part of ABI
+
+ /* The following entries are not part of H.273, but custom extensions */
+ AVCOL_PRI_EXT_BASE = 256,
+ AVCOL_PRI_V_GAMUT = AVCOL_PRI_EXT_BASE,
+ AVCOL_PRI_EXT_NB ///< Not part of ABI
};
/**
commit aeb9b19ebc0295d7fcaa5ed09f9b267fea57895c
Author: Lynne <[email protected]>
AuthorDate: Tue Oct 28 11:48:08 2025 +0100
Commit: Lynne <[email protected]>
CommitDate: Tue Oct 28 20:46:21 2025 +0100
lavu: add support for Panasonic V-Log
diff --git a/libavcodec/fflcms2.c b/libavcodec/fflcms2.c
index 3b67e62d3a..c7b944a02f 100644
--- a/libavcodec/fflcms2.c
+++ b/libavcodec/fflcms2.c
@@ -50,7 +50,7 @@ void ff_icc_context_uninit(FFIccContext *s)
static int get_curve(FFIccContext *s, enum AVColorTransferCharacteristic trc,
cmsToneCurve **out_curve)
{
- if (trc >= AVCOL_TRC_NB)
+ if ((trc >= AVCOL_TRC_NB && trc < AVCOL_TRC_EXT_BASE) || trc >=
AVCOL_TRC_EXT_NB)
return AVERROR_INVALIDDATA;
if (s->curves[trc])
@@ -128,6 +128,7 @@ static int get_curve(FFIccContext *s, enum
AVColorTransferCharacteristic trc,
case AVCOL_TRC_BT1361_ECG:
case AVCOL_TRC_SMPTE2084:
case AVCOL_TRC_ARIB_STD_B67:
+ case AVCOL_TRC_V_LOG:
return AVERROR_PATCHWELCOME;
default:
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 2d8dd29be0..6bf0d9fc87 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1682,6 +1682,7 @@ static const AVOption libplacebo_options[] = {
{"bt2020-12", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_BT2020_12}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
{"smpte2084", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_SMPTE2084}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
{"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
+ {"vlog", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_V_LOG}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
{"rotate", "rotate the input clockwise", OFFSET(rotation),
AV_OPT_TYPE_INT, {.i64=PL_ROTATION_0}, PL_ROTATION_0, PL_ROTATION_360, DYNAMIC,
.unit = "rotation"},
{"0", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=PL_ROTATION_0}, .flags = STATIC, .unit = "rotation"},
diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index f32757f940..dd765f9d08 100644
--- a/libavfilter/vf_setparams.c
+++ b/libavfilter/vf_setparams.c
@@ -82,7 +82,7 @@ static const AVOption setparams_options[] = {
{"jedec-p22", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_JEDEC_P22}, 0, 0, FLAGS, .unit = "color_primaries"},
{"ebu3213", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_PRI_EBU3213}, 0, 0, FLAGS, .unit = "color_primaries"},
- {"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT,
{.i64=-1}, -1, AVCOL_TRC_NB-1, FLAGS, .unit = "color_trc"},
+ {"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT,
{.i64=-1}, -1, AVCOL_TRC_EXT_NB-1, FLAGS, .unit = "color_trc"},
{"auto", "keep the same color transfer", 0, AV_OPT_TYPE_CONST, {.i64=-1},
0, 0, FLAGS, .unit = "color_trc"},
{"bt709", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_BT709}, 0, 0, FLAGS, .unit = "color_trc"},
{"unknown", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_UNSPECIFIED}, 0, 0, FLAGS, .unit = "color_trc"},
@@ -101,6 +101,7 @@ static const AVOption setparams_options[] = {
{"smpte2084", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_SMPTE2084}, 0, 0, FLAGS, .unit = "color_trc"},
{"smpte428", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_SMPTE428}, 0, 0, FLAGS, .unit = "color_trc"},
{"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_ARIB_STD_B67}, 0, 0, FLAGS, .unit = "color_trc"},
+ {"vlog", NULL, 0, AV_OPT_TYPE_CONST,
{.i64=AVCOL_TRC_V_LOG}, 0, 0, FLAGS, .unit = "color_trc"},
{"colorspace", "select colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT,
{.i64=-1}, -1, AVCOL_SPC_NB-1, FLAGS, .unit = "colorspace"},
{"auto", "keep the same colorspace", 0, AV_OPT_TYPE_CONST, {.i64=-1},
0, 0, FLAGS, .unit = "colorspace"},
diff --git a/libavutil/csp.c b/libavutil/csp.c
index 4cd41fbee7..914de37985 100644
--- a/libavutil/csp.c
+++ b/libavutil/csp.c
@@ -146,14 +146,17 @@ static const double approximate_gamma[AVCOL_TRC_NB] = {
[AVCOL_TRC_SMPTE428] = 2.6,
};
+static const double approximate_gamma_ext[AVCOL_TRC_EXT_NB -
+ AVCOL_TRC_EXT_BASE] = {
+ [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = 2.2,
+};
+
double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc)
{
- double gamma;
- if ((unsigned)trc >= AVCOL_TRC_NB)
- return 0.0;
- gamma = approximate_gamma[trc];
- if (gamma > 0)
- return gamma;
+ if (trc < AVCOL_TRC_NB)
+ return approximate_gamma[trc];
+ else if ((trc >= AVCOL_TRC_EXT_BASE) && (trc < AVCOL_TRC_EXT_NB))
+ return approximate_gamma_ext[trc - AVCOL_TRC_EXT_BASE];
return 0.0;
}
@@ -171,11 +174,19 @@ static const double approximate_eotf_gamma[AVCOL_TRC_NB]
= {
[AVCOL_TRC_SMPTE428] = 2.6,
};
+static const double approximate_eotf_gamma_ext[AVCOL_TRC_EXT_NB -
+ AVCOL_TRC_EXT_BASE] = {
+ [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = 2.2,
+};
+
double av_csp_approximate_eotf_gamma(enum AVColorTransferCharacteristic trc)
{
- if ((unsigned)trc >= AVCOL_TRC_NB)
- return 0.0;
- return approximate_eotf_gamma[trc];
+ if ((unsigned)trc < AVCOL_TRC_NB)
+ return approximate_eotf_gamma[trc];
+ else if (((unsigned)trc >= AVCOL_TRC_EXT_BASE) &&
+ ((unsigned)trc < AVCOL_TRC_EXT_NB))
+ return approximate_eotf_gamma_ext[trc - AVCOL_TRC_EXT_BASE];
+ return 0.0;
}
#define BT709_alpha 1.099296826809442
@@ -399,6 +410,32 @@ static double trc_arib_std_b67_inv(double E)
(E <= 0.5 ? E * E / 3.0 : (exp((E - c) / a) + b) / 12.0);
}
+#define VLOG_c1 0.01
+#define VLOG_c2 0.181
+#define VLOG_b 0.00873
+#define VLOG_c 0.241514
+#define VLOG_d 0.598206
+
+static double trc_v_log(double E)
+{
+ const double c1 = VLOG_c1;
+ const double b = VLOG_b;
+ const double c = VLOG_c;
+ const double d = VLOG_d;
+ return (E < c1) ? (5.6 * E + 0.125) :
+ (c * log10(E + b) + d);
+}
+
+static double trc_v_log_inv(double E)
+{
+ const double c2 = VLOG_c2;
+ const double b = VLOG_b;
+ const double c = VLOG_c;
+ const double d = VLOG_d;
+ return (E < c2) ? (E - 0.125) / 5.6 :
+ (pow(10.0, ((E - d) / c)) - b);
+}
+
static const av_csp_trc_function trc_funcs[AVCOL_TRC_NB] = {
[AVCOL_TRC_BT709] = trc_bt709,
[AVCOL_TRC_GAMMA22] = trc_gamma22,
@@ -418,11 +455,19 @@ static const av_csp_trc_function trc_funcs[AVCOL_TRC_NB]
= {
[AVCOL_TRC_ARIB_STD_B67] = trc_arib_std_b67,
};
+static const av_csp_trc_function trc_funcs_ext[AVCOL_TRC_EXT_NB -
+ AVCOL_TRC_EXT_BASE] = {
+ [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = trc_v_log,
+};
+
av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic
trc)
{
- if ((unsigned)trc >= AVCOL_TRC_NB)
- return NULL;
- return trc_funcs[trc];
+ if ((unsigned)trc < AVCOL_TRC_NB)
+ return trc_funcs[trc];
+ else if (((unsigned)trc >= AVCOL_TRC_EXT_BASE) &&
+ ((unsigned)trc < AVCOL_TRC_EXT_NB))
+ return trc_funcs_ext[trc - AVCOL_TRC_EXT_BASE];
+ return NULL;
}
static const av_csp_trc_function trc_inv_funcs[AVCOL_TRC_NB] = {
@@ -444,11 +489,19 @@ static const av_csp_trc_function
trc_inv_funcs[AVCOL_TRC_NB] = {
[AVCOL_TRC_ARIB_STD_B67] = trc_arib_std_b67_inv,
};
+static const av_csp_trc_function trc_inv_funcs_ext[AVCOL_TRC_EXT_NB -
+ AVCOL_TRC_EXT_BASE] = {
+ [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = trc_v_log_inv,
+};
+
av_csp_trc_function av_csp_trc_func_inv_from_id(enum
AVColorTransferCharacteristic trc)
{
- if ((unsigned)trc >= AVCOL_TRC_NB)
- return NULL;
- return trc_inv_funcs[trc];
+ if ((unsigned)trc < AVCOL_TRC_NB)
+ return trc_inv_funcs[trc];
+ else if (((unsigned)trc >= AVCOL_TRC_EXT_BASE) &&
+ ((unsigned)trc < AVCOL_TRC_EXT_NB))
+ return trc_inv_funcs_ext[trc - AVCOL_TRC_EXT_BASE];
+ return NULL;
}
static void eotf_linear(const double Lw, const double Lb, double E[3])
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index fbd8666863..7fc47e8ba1 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -3452,6 +3452,10 @@ static const char * const color_transfer_names[] = {
[AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
};
+static const char * const color_transfer_names_ext[] = {
+ [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = "vlog",
+};
+
static const char * const color_space_names[] = {
[AVCOL_SPC_RGB] = "gbr",
[AVCOL_SPC_BT709] = "bt709",
@@ -3939,8 +3943,12 @@ int av_color_primaries_from_name(const char *name)
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
{
- return (unsigned) transfer < AVCOL_TRC_NB ?
- color_transfer_names[transfer] : NULL;
+ if ((unsigned)transfer < AVCOL_TRC_NB)
+ return color_transfer_names[transfer];
+ else if (((unsigned)transfer >= AVCOL_TRC_EXT_BASE) &&
+ ((unsigned)transfer < AVCOL_TRC_EXT_NB))
+ return color_transfer_names_ext[transfer - AVCOL_TRC_EXT_BASE];
+ return NULL;
}
int av_color_transfer_from_name(const char *name)
@@ -3955,6 +3963,14 @@ int av_color_transfer_from_name(const char *name)
return i;
}
+ for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names_ext); i++) {
+ if (!color_transfer_names_ext[i])
+ continue;
+
+ if (av_strstart(name, color_transfer_names_ext[i], NULL))
+ return AVCOL_TRC_EXT_BASE + i;
+ }
+
return AVERROR(EINVAL);
}
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index c6e9c59283..7cb76d503c 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -699,7 +699,12 @@ enum AVColorTransferCharacteristic {
AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
- AVCOL_TRC_NB ///< Not part of ABI
+ AVCOL_TRC_NB, ///< Not part of ABI
+
+ /* The following entries are not part of H.273, but custom extensions */
+ AVCOL_TRC_EXT_BASE = 256,
+ AVCOL_TRC_V_LOG = AVCOL_TRC_EXT_BASE,
+ AVCOL_TRC_EXT_NB ///< Not part of ABI
};
/**
diff --git a/libavutil/tests/color_utils.c b/libavutil/tests/color_utils.c
index b8200e91fa..f96955082f 100644
--- a/libavutil/tests/color_utils.c
+++ b/libavutil/tests/color_utils.c
@@ -57,7 +57,10 @@ int main(int argc, char *argv[])
15123.4567, 19845.88923, 98678.4231, 99999.899998
};
- for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_NB;
trc++) {
+ for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_EXT_NB;
trc++) {
+ if (trc == AVCOL_TRC_NB)
+ trc = AVCOL_TRC_EXT_BASE;
+
av_csp_trc_function func = av_csp_trc_func_from_id(trc);
av_csp_trc_function func_inv = av_csp_trc_func_inv_from_id(trc);
const char *name = av_color_transfer_name(trc);
@@ -77,7 +80,10 @@ int main(int argc, char *argv[])
}
}
- for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_NB;
trc++) {
+ for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_EXT_NB;
trc++) {
+ if (trc == AVCOL_TRC_NB)
+ trc = AVCOL_TRC_EXT_BASE;
+
av_csp_eotf_function eotf = av_csp_itu_eotf(trc);
av_csp_eotf_function eotf_inv = av_csp_itu_eotf_inv(trc);
const char *trc_name = av_color_transfer_name(trc);
diff --git a/libswscale/format.c b/libswscale/format.c
index d57f6fee62..e4b9b264e5 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -1295,9 +1295,11 @@ static AVRational *generate_bayer_matrix(const int
size_log2)
static bool trc_is_hdr(enum AVColorTransferCharacteristic trc)
{
static_assert(AVCOL_TRC_NB == 19, "Update this list when adding TRCs");
+ static_assert(AVCOL_TRC_EXT_NB == 257, "Update this list when adding
TRCs");
switch (trc) {
case AVCOL_TRC_LOG:
case AVCOL_TRC_LOG_SQRT:
+ case AVCOL_TRC_V_LOG:
case AVCOL_TRC_SMPTEST2084:
case AVCOL_TRC_ARIB_STD_B67:
return true;
diff --git a/tests/ref/fate/color_utils b/tests/ref/fate/color_utils
index 8da3e5094a..e681ef7310 100644
--- a/tests/ref/fate/color_utils
+++ b/tests/ref/fate/color_utils
@@ -302,6 +302,25 @@ trc=arib-std-b67 calling func(15123.456700)
expected=2.725380 roundtrip=15123.45
trc=arib-std-b67 calling func(19845.889230) expected=2.773978
roundtrip=19845.889230
trc=arib-std-b67 calling func(98678.423100) expected=3.060803
roundtrip=98678.423100
trc=arib-std-b67 calling func(99999.899998) expected=3.063182
roundtrip=99999.899998
+trc=vlog calling func(-0.100000) expected=-0.435000 roundtrip=-0.100000
+trc=vlog calling func(-0.018054) expected=0.023898 roundtrip=-0.018054
+trc=vlog calling func(-0.010000) expected=0.069000 roundtrip=-0.010000
+trc=vlog calling func(-0.004490) expected=0.099856 roundtrip=-0.004490
+trc=vlog calling func(0.000000) expected=0.125000 roundtrip=0.000000
+trc=vlog calling func(0.003162) expected=0.142709 roundtrip=0.003162
+trc=vlog calling func(0.005000) expected=0.153000 roundtrip=0.005000
+trc=vlog calling func(0.009000) expected=0.175400 roundtrip=0.009000
+trc=vlog calling func(0.015000) expected=0.205818 roundtrip=0.015000
+trc=vlog calling func(0.100000) expected=0.365471 roundtrip=0.100000
+trc=vlog calling func(1.000000) expected=0.599118 roundtrip=1.000000
+trc=vlog calling func(52.370000) expected=1.013406 roundtrip=52.370000
+trc=vlog calling func(125.098765) expected=1.104729 roundtrip=125.098765
+trc=vlog calling func(1999.111230) expected=1.395405 roundtrip=1999.111230
+trc=vlog calling func(6945.443000) expected=1.526030 roundtrip=6945.443000
+trc=vlog calling func(15123.456700) expected=1.607650 roundtrip=15123.456700
+trc=vlog calling func(19845.889230) expected=1.636154 roundtrip=19845.889230
+trc=vlog calling func(98678.423100) expected=1.804381 roundtrip=98678.423100
+trc=vlog calling func(99999.899998) expected=1.805776 roundtrip=99999.899998
trc=bt709 EOTF(50, 0, {0}) = {0}
trc=bt709 EOTF(50, 0, {0.1}) = {0.199054}
trc=bt709 EOTF(50, 0, {0.2}) = {1.05061}
-----------------------------------------------------------------------
Summary of changes:
doc/APIchanges | 3 ++
libavcodec/fflcms2.c | 3 +-
libavcodec/ffv1enc_vulkan.c | 3 +-
libavcodec/prores_raw_parser.c | 18 +++++++-
libavfilter/vf_libplacebo.c | 2 +
libavfilter/vf_setparams.c | 6 ++-
libavutil/csp.c | 100 ++++++++++++++++++++++++++++++++---------
libavutil/pixdesc.c | 41 +++++++++++++++--
libavutil/pixfmt.h | 14 +++++-
libavutil/tests/color_utils.c | 10 ++++-
libavutil/version.h | 2 +-
libswscale/format.c | 2 +
tests/ref/fate/color_utils | 19 ++++++++
13 files changed, 188 insertions(+), 35 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]