Compare commits

...

9 Commits

Author SHA1 Message Date
Kacper Michajłow ddeec523a2
avcodec/x86/idctdsp: add restrict to match function pointer types
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:15 +02:00
Kacper Michajłow 49cfafefd4
avcodec/rectangle: use uintptr_t for integer pointer type
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:15 +02:00
Kacper Michajłow 0cd999266f
avcodec/put_bits: add explicit cast to suppress MSVC warning
Supresses:
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Also drop L, as shift will never exceed 31.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:15 +02:00
Kacper Michajłow fe425d97d1
avcodec/cbs*: remove redundant const, it's already in typedef
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:15 +02:00
Kacper Michajłow 9ad20839fb
avcodec/pixblockdsp: be consistent about restrict use in ff_{get,diff}_pixels
Suppresses warnings about function pointer mismatch.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:15 +02:00
Kacper Michajłow c597d8cac1
avcodec/aacpsdsp: add restrict to function pointers to match declarations
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:14 +02:00
Kacper Michajłow 20f59bfc6b
fftools/ffmpeg: use enum VideoSyncMethod instead of int
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 01:01:14 +02:00
Kacper Michajłow a2b47ccfbf avcodec/{png,mov}enc: use EOTF gamma approximation for gAMA chunk
This is how images encoded with specific transfer function should be
viewed. Image viewers that doesn't support named trc metadata, will
fallback to simple gAMA value and both of those cases should produce the
same image apperance for the viewer.

Fixes: https://github.com/mpv-player/mpv/issues/13438

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-24 22:24:54 +00:00
Kacper Michajłow 00e43619cd avutil/csp: add av_csp_approximate_eotf_gamma()
2.2 gamma was used for bt.1886 aproximation as the most common target in
real world.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-24 22:24:54 +00:00
28 changed files with 99 additions and 59 deletions

View File

@ -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.14.100 - csp.h
Add av_csp_approximate_eotf_gamma().
2025-08-xx - xxxxxxxxxx - lavf 62.6.100 - oggparsevorbis.h oggparseopus.h oggparseflac.h
Drop header packets from secondary chained ogg/{flac, opus, vorbis} streams
from demuxer output.

View File

@ -771,7 +771,7 @@ int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used
int assert_file_overwrite(const char *filename);
int find_codec(void *logctx, const char *name,
enum AVMediaType type, int encoder, const AVCodec **codec);
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx, int is_global);
int filtergraph_is_simple(const FilterGraph *fg);
int fg_create_simple(FilterGraph **pfg,

View File

@ -295,7 +295,7 @@ int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
return 0;
}
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx, int is_global)
{
if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR;

View File

@ -30,15 +30,15 @@
#define PS_MAX_AP_DELAY 5
typedef struct PSDSPContext {
void (*add_squares)(INTFLOAT *dst, const INTFLOAT (*src)[2], int n);
void (*mul_pair_single)(INTFLOAT (*dst)[2], INTFLOAT (*src0)[2], INTFLOAT *src1,
void (*add_squares)(INTFLOAT *restrict dst, const INTFLOAT (*src)[2], int n);
void (*mul_pair_single)(INTFLOAT (*restrict dst)[2], INTFLOAT (*src0)[2], INTFLOAT *src1,
int n);
void (*hybrid_analysis)(INTFLOAT (*out)[2], INTFLOAT (*in)[2],
void (*hybrid_analysis)(INTFLOAT (*restrict out)[2], INTFLOAT (*in)[2],
const INTFLOAT (*filter)[8][2],
ptrdiff_t stride, int n);
void (*hybrid_analysis_ileave)(INTFLOAT (*out)[32][2], INTFLOAT L[2][38][64],
void (*hybrid_analysis_ileave)(INTFLOAT (*restrict out)[32][2], INTFLOAT L[2][38][64],
int i, int len);
void (*hybrid_synthesis_deint)(INTFLOAT out[2][38][64], INTFLOAT (*in)[32][2],
void (*hybrid_synthesis_deint)(INTFLOAT out[2][38][64], INTFLOAT (*restrict in)[32][2],
int i, int len);
void (*decorrelate)(INTFLOAT (*out)[2], INTFLOAT (*delay)[2],
INTFLOAT (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],

View File

@ -23,9 +23,9 @@
#include "libavutil/aarch64/cpu.h"
#include "libavcodec/pixblockdsp.h"
void ff_get_pixels_neon(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_neon(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_diff_pixels_neon(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_neon(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
av_cold void ff_pixblockdsp_init_aarch64(PixblockDSPContext *c,

View File

@ -23,18 +23,18 @@
#include "libavutil/arm/cpu.h"
#include "libavcodec/pixblockdsp.h"
void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_armv6(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_armv6(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
void ff_get_pixels_neon(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_neon(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_get_pixels_unaligned_neon(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_unaligned_neon(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_diff_pixels_neon(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_neon(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
void ff_diff_pixels_unaligned_neon(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_unaligned_neon(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
av_cold void ff_pixblockdsp_init_arm(PixblockDSPContext *c,

View File

@ -891,7 +891,7 @@ void CBS_FUNC(delete_unit)(CodedBitstreamFragment *frag,
static void cbs_default_free_unit_content(AVRefStructOpaque opaque, void *content)
{
const CodedBitstreamUnitTypeDescriptor *desc = opaque.c;
CodedBitstreamUnitTypeDescriptor *desc = opaque.c;
for (int i = 0; i < desc->type.ref.nb_offsets; i++) {
void **ptr = (void**)((char*)content + desc->type.ref.offsets[i]);
@ -899,11 +899,11 @@ static void cbs_default_free_unit_content(AVRefStructOpaque opaque, void *conten
}
}
static const CodedBitstreamUnitTypeDescriptor
static CodedBitstreamUnitTypeDescriptor
*cbs_find_unit_type_desc(CodedBitstreamContext *ctx,
CodedBitstreamUnit *unit)
{
const CodedBitstreamUnitTypeDescriptor *desc;
CodedBitstreamUnitTypeDescriptor *desc;
int i, j;
if (!ctx->codec->unit_types)
@ -927,7 +927,7 @@ static const CodedBitstreamUnitTypeDescriptor
return NULL;
}
static void *cbs_alloc_content(const CodedBitstreamUnitTypeDescriptor *desc)
static void *cbs_alloc_content(CodedBitstreamUnitTypeDescriptor *desc)
{
return av_refstruct_alloc_ext_c(desc->content_size, 0,
(AVRefStructOpaque){ .c = desc },
@ -939,7 +939,7 @@ static void *cbs_alloc_content(const CodedBitstreamUnitTypeDescriptor *desc)
int CBS_FUNC(alloc_unit_content)(CodedBitstreamContext *ctx,
CodedBitstreamUnit *unit)
{
const CodedBitstreamUnitTypeDescriptor *desc;
CodedBitstreamUnitTypeDescriptor *desc;
av_assert0(!unit->content && !unit->content_ref);
@ -957,7 +957,7 @@ int CBS_FUNC(alloc_unit_content)(CodedBitstreamContext *ctx,
static int cbs_clone_noncomplex_unit_content(void **clonep,
const CodedBitstreamUnit *unit,
const CodedBitstreamUnitTypeDescriptor *desc)
CodedBitstreamUnitTypeDescriptor *desc)
{
const uint8_t *src;
uint8_t *copy;
@ -1017,7 +1017,7 @@ fail:
static int cbs_clone_unit_content(CodedBitstreamContext *ctx,
CodedBitstreamUnit *unit)
{
const CodedBitstreamUnitTypeDescriptor *desc;
CodedBitstreamUnitTypeDescriptor *desc;
void *new_content;
int err;

View File

@ -421,7 +421,7 @@ static void cbs_apv_free_metadata(AVRefStructOpaque unused, void *content)
}
}
static const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[] = {
{
.nb_unit_types = CBS_UNIT_TYPE_RANGE,
.unit_type.range = {

View File

@ -1312,7 +1312,7 @@ static void cbs_av1_free_metadata(AVRefStructOpaque unused, void *content)
}
#endif
static const CodedBitstreamUnitTypeDescriptor cbs_av1_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_av1_unit_types[] = {
CBS_UNIT_TYPE_POD(AV1_OBU_SEQUENCE_HEADER, AV1RawOBU),
CBS_UNIT_TYPE_POD(AV1_OBU_TEMPORAL_DELIMITER, AV1RawOBU),
CBS_UNIT_TYPE_POD(AV1_OBU_FRAME_HEADER, AV1RawOBU),

View File

@ -1997,7 +1997,7 @@ static void cbs_h264_free_sei(AVRefStructOpaque unused, void *content)
ff_cbs_sei_free_message_list(&sei->message_list);
}
static const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[] = {
CBS_UNIT_TYPE_POD(H264_NAL_SPS, H264RawSPS),
CBS_UNIT_TYPE_POD(H264_NAL_SPS_EXT, H264RawSPSExtension),
@ -2023,7 +2023,7 @@ static void cbs_h265_free_sei(AVRefStructOpaque unused, void *content)
ff_cbs_sei_free_message_list(&sei->message_list);
}
static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(HEVC_NAL_VPS, H265RawVPS, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(HEVC_NAL_SPS, H265RawSPS, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(HEVC_NAL_PPS, H265RawPPS, extension_data.data),
@ -2060,7 +2060,7 @@ static void cbs_h266_free_sei(AVRefStructOpaque unused, void *content)
ff_cbs_sei_free_message_list(&sei->message_list);
}
static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(VVC_DCI_NUT, H266RawDCI, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_OPI_NUT, H266RawOPI, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, extension_data.data),

View File

@ -151,7 +151,7 @@ typedef struct CodedBitstreamType {
// List of unit type descriptors for this codec.
// Terminated by a descriptor with nb_unit_types equal to zero.
const CodedBitstreamUnitTypeDescriptor *unit_types;
CodedBitstreamUnitTypeDescriptor *unit_types;
// Split frag->data into coded bitstream units, creating the
// frag->units array. Fill data but not content on each unit.

View File

@ -417,7 +417,7 @@ static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx,
return 0;
}
static const CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types[] = {
CBS_UNIT_RANGE_POD(JPEG_MARKER_SOF0, JPEG_MARKER_SOF3, JPEGRawFrameHeader),
CBS_UNIT_RANGE_INTERNAL_REF(JPEG_MARKER_APPN, JPEG_MARKER_APPN + 15,

View File

@ -397,7 +397,7 @@ static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
return 0;
}
static const CodedBitstreamUnitTypeDescriptor cbs_mpeg2_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_mpeg2_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(MPEG2_START_PICTURE, MPEG2RawPictureHeader,
extra_information_picture.extra_information),

View File

@ -366,7 +366,7 @@ static int cbs_vp8_assemble_fragment(CodedBitstreamContext *ctx,
return AVERROR_PATCHWELCOME;
}
static const CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(0, VP8RawFrame, data),
CBS_UNIT_TYPE_END_OF_LIST,
};

View File

@ -594,7 +594,7 @@ static av_cold void cbs_vp9_flush(CodedBitstreamContext *ctx)
memset(vp9->ref, 0, sizeof(vp9->ref));
}
static const CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[] = {
static CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(0, VP9RawFrame, data),
CBS_UNIT_TYPE_END_OF_LIST
};

View File

@ -56,7 +56,7 @@ typedef struct DVEncContext {
AVCodecContext *avctx;
uint8_t *buf;
void (*get_pixels)(int16_t *block, const uint8_t *pixels, ptrdiff_t linesize);
void (*get_pixels)(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t linesize);
void (*fdct[2])(int16_t *block);
me_cmp_func ildct_cmp;

View File

@ -323,7 +323,7 @@ static int png_get_chrm(enum AVColorPrimaries prim, uint8_t *buf)
static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf)
{
double gamma = av_csp_approximate_trc_gamma(trc);
double gamma = av_csp_approximate_eotf_gamma(trc);
if (gamma <= 1e-6)
return 0;

View File

@ -256,7 +256,7 @@ static inline void put_bits_no_assert(PutBitContext *s, int n, BitBuf value)
*/
static inline void put_bits(PutBitContext *s, int n, BitBuf value)
{
av_assert2(n <= 31 && value < (1UL << n));
av_assert2(n <= 31 && value < (BitBuf)(1U << n));
put_bits_no_assert(s, n, value);
}
@ -265,7 +265,7 @@ static inline void put_bits_le(PutBitContext *s, int n, BitBuf value)
BitBuf bit_buf;
int bit_left;
av_assert2(n <= 31 && value < (1UL << n));
av_assert2(n <= 31 && value < (BitBuf)(1U << n));
bit_buf = s->bit_buf;
bit_left = s->bit_left;

View File

@ -46,7 +46,7 @@ static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride,
w *= size;
stride *= size;
av_assert2((((long)vp)&(FFMIN(w, 8<<(HAVE_NEON|ARCH_PPC|HAVE_MMX))-1)) == 0);
av_assert2((((uintptr_t)vp)&(FFMIN(w, 8<<(HAVE_NEON|ARCH_PPC|HAVE_MMX))-1)) == 0);
av_assert2((stride&(w-1))==0);
if(w==2){
const uint16_t v= size==4 ? val : val*0x0101;

View File

@ -26,18 +26,18 @@
#include "libavutil/riscv/cpu.h"
#include "libavcodec/pixblockdsp.h"
void ff_get_pixels_8_rvi(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_8_rvi(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_get_pixels_16_rvi(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_16_rvi(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_get_pixels_8_rvv(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_8_rvv(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_get_pixels_unaligned_8_rvv(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_unaligned_8_rvv(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t stride);
void ff_diff_pixels_rvv(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_rvv(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
void ff_diff_pixels_unaligned_rvv(int16_t *block, const uint8_t *s1,
void ff_diff_pixels_unaligned_rvv(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, ptrdiff_t stride);
av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,

View File

@ -26,14 +26,14 @@
#include "libavutil/attributes.h"
#include "libavcodec/aacpsdsp.h"
void ff_ps_add_squares_sse (float *dst, const float (*src)[2], int n);
void ff_ps_add_squares_sse3 (float *dst, const float (*src)[2], int n);
void ff_ps_mul_pair_single_sse (float (*dst)[2], float (*src0)[2],
void ff_ps_add_squares_sse (float *restrict dst, const float (*src)[2], int n);
void ff_ps_add_squares_sse3 (float *restrict dst, const float (*src)[2], int n);
void ff_ps_mul_pair_single_sse (float (*restrict dst)[2], float (*src0)[2],
float *src1, int n);
void ff_ps_hybrid_analysis_sse (float (*out)[2], float (*in)[2],
void ff_ps_hybrid_analysis_sse (float (*restrict out)[2], float (*in)[2],
const float (*filter)[8][2],
ptrdiff_t stride, int n);
void ff_ps_hybrid_analysis_fma3(float (*out)[2], float (*in)[2],
void ff_ps_hybrid_analysis_fma3(float (*restrict out)[2], float (*in)[2],
const float (*filter)[8][2],
ptrdiff_t stride, int n);
void ff_ps_stereo_interpolate_sse3(float (*l)[2], float (*r)[2],
@ -42,11 +42,11 @@ void ff_ps_stereo_interpolate_sse3(float (*l)[2], float (*r)[2],
void ff_ps_stereo_interpolate_ipdopd_sse3(float (*l)[2], float (*r)[2],
float h[2][4], float h_step[2][4],
int len);
void ff_ps_hybrid_synthesis_deint_sse(float out[2][38][64], float (*in)[32][2],
void ff_ps_hybrid_synthesis_deint_sse(float out[2][38][64], float (*restrict in)[32][2],
int i, int len);
void ff_ps_hybrid_synthesis_deint_sse4(float out[2][38][64], float (*in)[32][2],
void ff_ps_hybrid_synthesis_deint_sse4(float out[2][38][64], float (*restrict in)[32][2],
int i, int len);
void ff_ps_hybrid_analysis_ileave_sse(float (*out)[32][2], float L[2][38][64],
void ff_ps_hybrid_analysis_ileave_sse(float (*restrict out)[32][2], float L[2][38][64],
int i, int len);
av_cold void ff_psdsp_init_x86(PSDSPContext *s)

View File

@ -25,7 +25,7 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/dnxhdenc.h"
void ff_get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels,
void ff_get_pixels_8x4_sym_sse2(int16_t *restrict block, const uint8_t *pixels,
ptrdiff_t line_size);
av_cold void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)

View File

@ -22,11 +22,11 @@
#include <stddef.h>
#include <stdint.h>
void ff_add_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels,
void ff_add_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels,
ptrdiff_t line_size);
void ff_put_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels,
void ff_put_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels,
ptrdiff_t line_size);
void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels,
void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels,
ptrdiff_t line_size);

View File

@ -23,8 +23,8 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/pixblockdsp.h"
void ff_get_pixels_sse2(int16_t *block, const uint8_t *pixels, ptrdiff_t stride);
void ff_diff_pixels_sse2(int16_t *block, const uint8_t *s1, const uint8_t *s2,
void ff_get_pixels_sse2(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t stride);
void ff_diff_pixels_sse2(int16_t *restrict block, const uint8_t *s1, const uint8_t *s2,
ptrdiff_t stride);
av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,

View File

@ -2523,7 +2523,7 @@ static int mov_write_gama_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
{
uint32_t gama = 0;
if (gamma <= 0.0)
gamma = av_csp_approximate_trc_gamma(track->par->color_trc);
gamma = av_csp_approximate_eotf_gamma(track->par->color_trc);
av_log(s, AV_LOG_DEBUG, "gamma value %g\n", gamma);
if (gamma > 1e-6) {

View File

@ -157,6 +157,27 @@ double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc)
return 0.0;
}
static const double approximate_eotf_gamma[AVCOL_TRC_NB] = {
[AVCOL_TRC_BT709] = 2.2,
[AVCOL_TRC_SMPTE170M] = 2.2,
[AVCOL_TRC_SMPTE240M] = 2.2,
[AVCOL_TRC_BT1361_ECG] = 2.2,
[AVCOL_TRC_BT2020_10] = 2.2,
[AVCOL_TRC_BT2020_12] = 2.2,
[AVCOL_TRC_GAMMA22] = 2.2,
[AVCOL_TRC_IEC61966_2_1] = 2.2,
[AVCOL_TRC_GAMMA28] = 2.8,
[AVCOL_TRC_LINEAR] = 1.0,
[AVCOL_TRC_SMPTE428] = 2.6,
};
double av_csp_approximate_eotf_gamma(enum AVColorTransferCharacteristic trc)
{
if ((unsigned)trc >= AVCOL_TRC_NB)
return 0.0;
return approximate_eotf_gamma[trc];
}
#define BT709_alpha 1.099296826809442
#define BT709_beta 0.018053968510807

View File

@ -133,6 +133,22 @@ enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *
*/
double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc);
/**
* Determine a suitable EOTF 'gamma' value to match the supplied
* AVColorTransferCharacteristic.
*
* This function returns the gamma value (exponent) for a simple pure power
* function approximation of the supplied AVColorTransferCharacteristic, or 0.
* if no reasonable approximation exists.
*
* EOTF(v) = (L_w - L_b) * v^gamma + L_b
*
* @return Will return an approximation to the simple gamma function matching
* the supplied Transfer Characteristic EOTF, Will return 0.0 for any
* we cannot reasonably match against.
*/
double av_csp_approximate_eotf_gamma(enum AVColorTransferCharacteristic trc);
/**
* Determine the function needed to apply the given
* AVColorTransferCharacteristic to linear input.

View File

@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 60
#define LIBAVUTIL_VERSION_MINOR 13
#define LIBAVUTIL_VERSION_MINOR 14
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \