This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 861d17e0f0de4567dac75671ae33fdb2392cb33b
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Mon Mar 9 06:21:48 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Tue Jun 23 19:15:57 2026 +0200

    avcodec/exr: Remove FF_API_EXR_GAMMA
    
    Deprecated on 2025-03-28.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/exr.c           | 117 ++-------------------------------------------
 libavcodec/version_major.h |   1 -
 2 files changed, 5 insertions(+), 113 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 6b52c7e8ef..bef1d62485 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -36,7 +36,6 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-#include "libavutil/csp.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/avstring.h"
@@ -192,15 +191,8 @@ typedef struct EXRContext {
     const char *layer;
     int selected_part;
 
-
     uint8_t *offset_table;
 
-#if FF_API_EXR_GAMMA
-    enum AVColorTransferCharacteristic apply_trc_type;
-    float gamma;
-    uint16_t gamma_table[65536];
-#endif
-
     Float2HalfTables f2h_tables;
     Half2FloatTables h2f_tables;
 } EXRContext;
@@ -1267,10 +1259,6 @@ static int decode_block(AVCodecContext *avctx, void 
*tdata,
     int data_xoffset, data_yoffset, data_window_offset, xsize, ysize;
     int i, x, buf_size = s->buf_size;
     int c, rgb_channel_count;
-#if FF_API_EXR_GAMMA
-    float one_gamma = 1.0f / s->gamma;
-    av_csp_trc_function trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
-#endif
     int ret;
 
     line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
@@ -1460,33 +1448,12 @@ static int decode_block(AVCodecContext *avctx, void 
*tdata,
 
                 if (s->pixel_type == EXR_FLOAT) {
                     // 32-bit
-#if FF_API_EXR_GAMMA
-                    if (trc_func && (!c || (c < 3 && s->desc->flags & 
AV_PIX_FMT_FLAG_PLANAR))) {
-                        for (int x = 0; x < xsize; x++, ptr_x += step) {
-                            float f = av_int2float(bytestream_get_le32(&src));
-                            AV_WN32A(ptr_x, av_float2int(trc_func(f)));
-                        }
-                    } else if (one_gamma != 1.f) {
-                        for (int x = 0; x < xsize; x++, ptr_x += step) {
-                            float f = av_int2float(bytestream_get_le32(&src));
-                            if (f > 0.0f && c < 3)  /* avoid negative values */
-                                f = powf(f, one_gamma);
-                            AV_WN32A(ptr_x, av_float2int(f));
-                        }
-                    } else
-#endif
-                        for (int x = 0; x < xsize; x++, ptr_x += step)
-                            AV_WN32A(ptr_x, bytestream_get_le32(&src));
+                    for (int x = 0; x < xsize; x++, ptr_x += step)
+                        AV_WN32A(ptr_x, bytestream_get_le32(&src));
                 } else if (s->pixel_type == EXR_HALF) {
                     // 16-bit
-#if FF_API_EXR_GAMMA
-                    if (one_gamma != 1.f || (trc_func && (!c || (c < 3 && 
s->desc->flags & AV_PIX_FMT_FLAG_PLANAR)))) {
-                        for (int x = 0; x < xsize; x++, ptr_x += step)
-                            AV_WN16A(ptr_x, 
s->gamma_table[bytestream_get_le16(&src)]);
-                    } else
-#endif
-                        for (int x = 0; x < xsize; x++, ptr_x += step)
-                            AV_WN16A(ptr_x, bytestream_get_le16(&src));
+                    for (int x = 0; x < xsize; x++, ptr_x += step)
+                        AV_WN16A(ptr_x, bytestream_get_le16(&src));
                 }
 
                 // Zero out the end if xmax+1 is not w
@@ -2197,12 +2164,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*picture,
     if (s->channel_offsets[3] >= 0)
         avctx->alpha_mode = AVALPHA_MODE_PREMULTIPLIED;
 
-#if FF_API_EXR_GAMMA
-    if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)
-        avctx->color_trc = s->apply_trc_type;
-    else if (s->gamma > 0.9999f && s->gamma < 1.0001f)
-#endif
-        avctx->color_trc = AVCOL_TRC_LINEAR;
+    avctx->color_trc = AVCOL_TRC_LINEAR;
 
     switch (s->compression) {
     case EXR_RAW:
@@ -2329,12 +2291,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*picture,
 static av_cold int decode_init(AVCodecContext *avctx)
 {
     EXRContext *s = avctx->priv_data;
-#if FF_API_EXR_GAMMA
-    uint32_t i;
-    union av_intfloat32 t;
-    float one_gamma = 1.0f / s->gamma;
-    av_csp_trc_function trc_func = NULL;
-#endif
 
     ff_init_float2half_tables(&s->f2h_tables);
     ff_init_half2float_tables(&s->h2f_tables);
@@ -2347,28 +2303,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     ff_bswapdsp_init(&s->bbdsp);
 #endif
 
-#if FF_API_EXR_GAMMA
-    trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
-    if (trc_func) {
-        for (i = 0; i < 65536; ++i) {
-            t.i = half2float(i, &s->h2f_tables);
-            t.f = trc_func(t.f);
-            s->gamma_table[i] = float2half(av_float2int(t.f), &s->f2h_tables);
-        }
-    } else if (one_gamma != 1.0f) {
-        for (i = 0; i < 65536; ++i) {
-            t.i = half2float(i, &s->h2f_tables);
-            /* If negative value we reuse half value */
-            if (t.f <= 0.0f) {
-                s->gamma_table[i] = i;
-            } else {
-                t.f = powf(t.f, one_gamma);
-                s->gamma_table[i] = float2half(t.i, &s->f2h_tables);
-            }
-        }
-    }
-#endif
-
     // allocate thread data, used for non EXR_RAW compression types
     s->thread_data = av_calloc(avctx->thread_count, sizeof(*s->thread_data));
     if (!s->thread_data)
@@ -2410,47 +2344,6 @@ static const AVOption options[] = {
         AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD },
     { "part",  "Set the decoding part", OFFSET(selected_part),
         AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VD },
-#if FF_API_EXR_GAMMA
-    { "gamma", "Set the float gamma value when decoding (deprecated, use a 
scaler)", OFFSET(gamma),
-        AV_OPT_TYPE_FLOAT, { .dbl = 1.0f }, 0.001, FLT_MAX, VD | 
AV_OPT_FLAG_DEPRECATED },
-
-    // XXX: Note the abuse of the enum using AVCOL_TRC_UNSPECIFIED to subsume 
the existing gamma option
-    { "apply_trc", "color transfer characteristics to apply to EXR linear 
input (deprecated, use a scaler)", OFFSET(apply_trc_type),
-        AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, 
VD | AV_OPT_FLAG_DEPRECATED, .unit = "apply_trc_type"},
-    { "bt709",        "BT.709",           0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT709 },        INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "gamma",        "gamma",            0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED },  INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "gamma22",      "BT.470 M",         0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 },      INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "gamma28",      "BT.470 BG",        0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 },      INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "smpte170m",    "SMPTE 170 M",      0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE170M },    INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "smpte240m",    "SMPTE 240 M",      0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE240M },    INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "linear",       "Linear",           0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LINEAR },       INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "log",          "Log",              0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG },          INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "log_sqrt",     "Log square root",  0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG_SQRT },     INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "iec61966_2_4", "IEC 61966-2-4",    0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_4 }, INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "bt1361",       "BT.1361",          0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT1361_ECG },   INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "iec61966_2_1", "IEC 61966-2-1",    0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "bt2020_10bit", "BT.2020 - 10 bit", 0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_10 },    INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "bt2020_12bit", "BT.2020 - 12 bit", 0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_12 },    INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "smpte2084",    "SMPTE ST 2084",    0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTEST2084 },  INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-    { "smpte428_1",   "SMPTE ST 428-1",   0,
-        AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTEST428_1 }, INT_MIN, INT_MAX, 
VD, .unit = "apply_trc_type"},
-#endif
-
     { NULL },
 };
 
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index fe4366042a..633e60a8b0 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -39,7 +39,6 @@
 
 #define FF_API_INIT_PACKET         (LIBAVCODEC_VERSION_MAJOR < 63)
 
-#define FF_API_EXR_GAMMA           (LIBAVCODEC_VERSION_MAJOR < 63)
 #define FF_API_INTRA_DC_PRECISION  (LIBAVCODEC_VERSION_MAJOR < 63)
 #define FF_API_MJPEG_EXTERN_HUFF   (LIBAVCODEC_VERSION_MAJOR < 63)
 #define FF_API_NVENC_H264_MAIN     (LIBAVCODEC_VERSION_MAJOR < 63)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to