* [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config()
@ 2024-04-08 12:57 Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 01/17] avcodec/internal: add FFCodec.color_ranges Niklas Haas
` (16 more replies)
0 siblings, 17 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel
Changes since v1:
- Add implementation of AV_CODEC_CONFIG_COLOR_RANGE for all codecs
- Use AVBPrint instead of char desc[128] for printing channel
descriptions
- Implement new constraints inside fftools/ffmpeg_filter.c
- Remove old YUVJ/MJPEG strictness hack
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 01/17] avcodec/internal: add FFCodec.color_ranges
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config() Niklas Haas
` (15 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
I went through all codecs and put them into five basic categories:
1. JPEG range only
2. MPEG range only
3. Explicitly tagged
4. Broken (codec supports both but encoder ignores tags)
5. N/A (headerless or pseudo-formats)
Filters in category 5 remain untouched. The rest gain an explicit
assignment of their supported color ranges, with codecs in category
4 being set to MPEG-only for safety.
It might be considered redundant to distinguish between 0 (category 5)
and MPEG+JPEG (category 3), but in doing so we effectively communicate
that we can guarantee that these tags will be encoded, which is distinct
from the situation where there are some codecs that simply don't have
tagging or implied semantics (e.g. rawvideo).
A full list of codecs follows:
JPEG range only:
- amv
- roqvideo
MPEG range only:
- asv1, asv2
- avui
- cfhd
- cljr
- dnxhd
- dvvideo
- ffv1
- flv
- h261, h263, h263p
- {h263,vp8}_v4l2m2m
- huffyuv, ffvhuff
- jpeg2000
- libopenjpeg
- libtheora
- libwebp, libwebp_anim
- libx262
- libxavs, libxavs2
- libxvid
- mpeg1video, mpeg2video
- mpeg2_qsv
- mpeg2_vaapi
- mpeg4, msmpeg4, msmpeg4v2, wmv1, wmv2
- mpeg4_omx
- rv10, rv20
- snow
- speedhq
- svq1
- tiff
- utvideo
Explicitly tagged (MPEG/JPEG):
- {av1,h264,hevc}_nvenc
- {av1,h264,hevc}_vaapi
- {av1,h264,hevc,vp8,vp9,mpeg4}_mediacodec
- {av1,h264,hevc,vp9}_qsv
- h264_amf
- {h264,hevc,prores}_videotoolbox
- libaom-av1
- libkvazaar
- libopenh264
- librav1e
- libsvtav1
- libvpx, libvpx-vp9
- libx264
- libx265
- ljpeg
- mjpeg
- vc2
Broken (encoder ignores tags):
- {av1,hevc}_amf
- {h264,hevc,mpeg4}_v4l2m2m
- h264_omx
- libxeve
- magicyuv
- {vp8,vp9,mjpeg}_vaapi
N/A:
- ayuv, yuv4, y41p, v308, v210, v410, v408 (headerless)
- pgmyuv (headerless)
- prores, prores_aw, prores_ks (?)
- rawvideo, bitpacked (headerless)
- vnull, wrapped_avframe (pseudocodecs)
---
libavcodec/amfenc_av1.c | 1 +
libavcodec/amfenc_h264.c | 1 +
libavcodec/amfenc_hevc.c | 1 +
libavcodec/asvenc.c | 2 ++
libavcodec/avuienc.c | 1 +
libavcodec/cfhdenc.c | 1 +
libavcodec/cljrenc.c | 1 +
libavcodec/codec_internal.h | 8 +++++++-
libavcodec/dnxhdenc.c | 1 +
libavcodec/dvenc.c | 1 +
libavcodec/ffv1enc.c | 1 +
libavcodec/flvenc.c | 1 +
libavcodec/h261enc.c | 1 +
libavcodec/huffyuvenc.c | 2 ++
libavcodec/ituh263enc.c | 2 ++
libavcodec/j2kenc.c | 1 +
libavcodec/libaomenc.c | 1 +
libavcodec/libkvazaar.c | 1 +
libavcodec/libopenh264enc.c | 1 +
libavcodec/libopenjpegenc.c | 1 +
libavcodec/librav1e.c | 1 +
libavcodec/libsvtav1.c | 1 +
libavcodec/libtheoraenc.c | 1 +
libavcodec/libvpxenc.c | 2 ++
libavcodec/libwebpenc.c | 1 +
libavcodec/libwebpenc_animencoder.c | 1 +
libavcodec/libx264.c | 2 ++
libavcodec/libx265.c | 1 +
libavcodec/libxavs.c | 1 +
libavcodec/libxavs2.c | 1 +
libavcodec/libxeve.c | 1 +
libavcodec/libxvid.c | 1 +
libavcodec/ljpegenc.c | 1 +
libavcodec/magicyuvenc.c | 1 +
libavcodec/mediacodecenc.c | 1 +
libavcodec/mjpegenc.c | 2 ++
libavcodec/mpeg12enc.c | 2 ++
libavcodec/mpeg4videoenc.c | 1 +
libavcodec/msmpeg4enc.c | 3 +++
libavcodec/nvenc_av1.c | 1 +
libavcodec/nvenc_h264.c | 1 +
libavcodec/nvenc_hevc.c | 1 +
libavcodec/omx.c | 2 ++
libavcodec/qsvenc_av1.c | 1 +
libavcodec/qsvenc_h264.c | 1 +
libavcodec/qsvenc_hevc.c | 1 +
libavcodec/qsvenc_jpeg.c | 1 +
libavcodec/qsvenc_mpeg2.c | 1 +
libavcodec/qsvenc_vp9.c | 1 +
libavcodec/roqvideoenc.c | 1 +
libavcodec/rv10enc.c | 1 +
libavcodec/rv20enc.c | 1 +
libavcodec/snowenc.c | 1 +
libavcodec/speedhqenc.c | 1 +
libavcodec/svq1enc.c | 1 +
libavcodec/tiffenc.c | 1 +
libavcodec/utvideoenc.c | 1 +
libavcodec/v4l2_m2m_enc.c | 1 +
libavcodec/vaapi_encode_av1.c | 1 +
libavcodec/vaapi_encode_h264.c | 1 +
libavcodec/vaapi_encode_h265.c | 1 +
libavcodec/vaapi_encode_mjpeg.c | 1 +
libavcodec/vaapi_encode_mpeg2.c | 1 +
libavcodec/vaapi_encode_vp8.c | 1 +
libavcodec/vaapi_encode_vp9.c | 1 +
libavcodec/vc2enc.c | 3 ++-
libavcodec/videotoolboxenc.c | 2 ++
libavcodec/wmv2enc.c | 1 +
68 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 9f18aac6487..c2885fe5858 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -485,6 +485,7 @@ const FFCodec ff_av1_amf_encoder = {
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_amf_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.p.wrapper_name = "amf",
.hw_configs = ff_amfenc_hw_configs,
};
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index abfac2a90f2..1aca90ff231 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -539,6 +539,7 @@ const FFCodec ff_h264_amf_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_amf_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.wrapper_name = "amf",
.hw_configs = ff_amfenc_hw_configs,
};
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 0a74ccd6c48..cbeca96b43b 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -454,6 +454,7 @@ const FFCodec ff_hevc_amf_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_amf_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.p.wrapper_name = "amf",
.hw_configs = ff_amfenc_hw_configs,
};
diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index 6179b505836..4f81a4015d6 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -367,6 +367,7 @@ const FFCodec ff_asv1_encoder = {
FF_CODEC_ENCODE_CB(encode_frame),
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
};
#endif
@@ -382,5 +383,6 @@ const FFCodec ff_asv2_encoder = {
FF_CODEC_ENCODE_CB(encode_frame),
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
};
#endif
diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c
index 495f6d36fb0..a2391b31ef6 100644
--- a/libavcodec/avuienc.c
+++ b/libavcodec/avuienc.c
@@ -100,6 +100,7 @@ const FFCodec ff_avui_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_EXPERIMENTAL |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_UYVY422, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.init = avui_encode_init,
FF_CODEC_ENCODE_CB(avui_encode_frame),
};
diff --git a/libavcodec/cfhdenc.c b/libavcodec/cfhdenc.c
index 5657d0f96c5..c63e6f2a301 100644
--- a/libavcodec/cfhdenc.c
+++ b/libavcodec/cfhdenc.c
@@ -871,5 +871,6 @@ const FFCodec ff_cfhd_encoder = {
AV_PIX_FMT_GBRAP12,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/cljrenc.c b/libavcodec/cljrenc.c
index 31ad5ce0cfe..4698dfd725d 100644
--- a/libavcodec/cljrenc.c
+++ b/libavcodec/cljrenc.c
@@ -118,5 +118,6 @@ const FFCodec ff_cljr_encoder = {
FF_CODEC_ENCODE_CB(encode_frame),
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV411P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &cljr_class,
};
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index d6757e2deff..2134f184094 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -133,7 +133,13 @@ typedef struct FFCodec {
/**
* Internal codec capabilities FF_CODEC_CAP_*.
*/
- unsigned caps_internal:29;
+ unsigned caps_internal:27;
+
+ /**
+ * This field determines the video color ranges supported by a codec.
+ * Should be set to a bitmask of AVCOL_RANGE_MPEG and AVCOL_RANGE_JPEG.
+ */
+ unsigned color_ranges:2;
/**
* This field determines the type of the codec (decoder/encoder)
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 0cb25d77143..31e507a8134 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -1371,6 +1371,7 @@ const FFCodec ff_dnxhd_encoder = {
AV_PIX_FMT_GBRP10,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &dnxhd_class,
.defaults = dnxhd_defaults,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 3afeedbb871..a4433edc2a8 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -1247,5 +1247,6 @@ const FFCodec ff_dvvideo_encoder = {
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &dvvideo_encode_class,
};
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 94d9215acd6..9a6cb4673e5 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1303,6 +1303,7 @@ const FFCodec ff_ffv1_encoder = {
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ffv1_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_EOF_FLUSH,
};
diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index 6a96cb0f2f9..40eec07b3eb 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -105,5 +105,6 @@ const FFCodec ff_flv_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index 438ebb63d91..52bed42a7fd 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -413,5 +413,6 @@ const FFCodec ff_h261_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 294d6ad41cf..5e8b5c0dd76 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -1026,6 +1026,7 @@ const FFCodec ff_huffyuv_encoder = {
AV_PIX_FMT_YUV422P, AV_PIX_FMT_RGB24,
AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
@@ -1066,6 +1067,7 @@ const FFCodec ff_ffvhuff_encoder = {
AV_PIX_FMT_RGB24,
AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
#endif
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 97abfb3f456..a3ac98b3f97 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -907,6 +907,7 @@ const FFCodec ff_h263_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H263,
.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &h263_class,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
@@ -938,6 +939,7 @@ const FFCodec ff_h263p_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H263P,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &h263p_class,
.p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 8cf82f7216c..8cee11a8c08 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1864,6 +1864,7 @@ const FFCodec ff_jpeg2000_encoder = {
AV_PIX_FMT_PAL8,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &j2k_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 4a71bba9c9c..5023d2fda42 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1517,6 +1517,7 @@ FFCodec ff_libaom_av1_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_ENCODER_RECON_FRAME |
AV_CODEC_CAP_OTHER_THREADS,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.p.priv_class = &class_aom,
.p.wrapper_name = "libaom",
diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 0711d9ab387..8be1c8c3bff 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -334,6 +334,7 @@ const FFCodec ff_libkvazaar_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_OTHER_THREADS,
.p.pix_fmts = pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.priv_data_size = sizeof(LibkvazaarContext),
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 0aa2a54e68b..7107c1a6799 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -445,6 +445,7 @@ const FFCodec ff_libopenh264_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.defaults = svc_enc_defaults,
.p.priv_class = &class,
.p.wrapper_name = "libopenh264",
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 6a4364b1fee..01b67dffda4 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -785,6 +785,7 @@ const FFCodec ff_libopenjpeg_encoder = {
AV_PIX_FMT_XYZ12,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &openjpeg_class,
.p.wrapper_name = "libopenjpeg",
};
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index b83e2118edc..546d00297d9 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -668,6 +668,7 @@ const FFCodec ff_librav1e_encoder = {
.p.priv_class = &class,
.defaults = librav1e_defaults,
.p.pix_fmts = librav1e_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_RECON_FRAME |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 105c3369c0f..f15152b5531 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -729,6 +729,7 @@ const FFCodec ff_libsvtav1_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = eb_enc_defaults,
.p.wrapper_name = "libsvtav1",
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index 58da008a820..8844f4be6ac 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -391,5 +391,6 @@ const FFCodec ff_libtheora_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.wrapper_name = "libtheora",
};
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index bcbdc4981e5..cdb83312614 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -2044,6 +2044,7 @@ const FFCodec ff_libvpx_vp8_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class_vp8,
.defaults = defaults,
.p.wrapper_name = "libvpx",
@@ -2115,6 +2116,7 @@ FFCodec ff_libvpx_vp9_encoder = {
.p.wrapper_name = "libvpx",
.priv_data_size = sizeof(VPxContext),
.init = vp9_init,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
FF_CODEC_ENCODE_CB(vpx_encode),
.close = vpx_free,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c
index f40dd013453..670412cc6eb 100644
--- a/libavcodec/libwebpenc.c
+++ b/libavcodec/libwebpenc.c
@@ -95,6 +95,7 @@ const FFCodec ff_libwebp_encoder = {
.p.id = AV_CODEC_ID_WEBP,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.p.pix_fmts = ff_libwebpenc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_libwebpenc_class,
.p.wrapper_name = "libwebp",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c
index 6f52fa7cf1e..c5361d7f920 100644
--- a/libavcodec/libwebpenc_animencoder.c
+++ b/libavcodec/libwebpenc_animencoder.c
@@ -168,6 +168,7 @@ const FFCodec ff_libwebp_anim_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.p.pix_fmts = ff_libwebpenc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_libwebpenc_class,
.p.wrapper_name = "libwebp",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index eadb20d2b39..97d1385f6ef 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1670,6 +1670,7 @@ FFCodec ff_libx264_encoder = {
#else
.p.pix_fmts = pix_fmts_all,
#endif
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
#if X264_BUILD < 158
| FF_CODEC_CAP_NOT_INIT_THREADSAFE
@@ -1727,6 +1728,7 @@ const FFCodec ff_libx262_encoder = {
AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.p.pix_fmts = pix_fmts_8bit,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &X262_class,
.p.wrapper_name = "libx264",
.priv_data_size = sizeof(X264Context),
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 0645cd20457..3533ac5cc1f 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -948,6 +948,7 @@ FFCodec ff_libx265_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.p.wrapper_name = "libx265",
.init = libx265_encode_init,
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index 4c7b1908cc4..d0f6e141c75 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -435,6 +435,7 @@ const FFCodec ff_libxavs_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &xavs_class,
.defaults = xavs_defaults,
.p.wrapper_name = "libxavs",
diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index c493ddc325a..1021d2ae2f5 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -301,6 +301,7 @@ const FFCodec ff_libxavs2_encoder = {
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &libxavs2,
.defaults = xavs2_defaults,
.p.wrapper_name = "libxavs2",
diff --git a/libavcodec/libxeve.c b/libavcodec/libxeve.c
index 1d9972619da..f434737ae61 100644
--- a/libavcodec/libxeve.c
+++ b/libavcodec/libxeve.c
@@ -613,5 +613,6 @@ const FFCodec ff_libxeve_encoder = {
.p.profiles = NULL_IF_CONFIG_SMALL(ff_evc_profiles),
.p.wrapper_name = "libxeve",
.p.pix_fmts = supported_pixel_formats,
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_NOT_INIT_THREADSAFE,
};
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index b9ac39429de..6e6c29ee21a 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -908,6 +908,7 @@ const FFCodec ff_libxvid_encoder = {
FF_CODEC_ENCODE_CB(xvid_encode_frame),
.close = xvid_encode_close,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &xvid_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "libxvid",
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 46546e21603..927420c2d43 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -328,4 +328,5 @@ const FFCodec ff_ljpeg_encoder = {
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
AV_PIX_FMT_YUV420P , AV_PIX_FMT_YUV444P , AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE},
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
};
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index 93eabb9f9a5..bc0fd9142fa 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -693,5 +693,6 @@ const FFCodec ff_magicyuv_encoder = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_GRAY8,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index b59de75b9ba..a4519bbc981 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -627,6 +627,7 @@ const FFCodec ff_ ## short_name ## _mediacodec_encoder = { \
| AV_CODEC_CAP_HARDWARE, \
.priv_data_size = sizeof(MediaCodecEncContext), \
.p.pix_fmts = avc_pix_fmts, \
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, \
.init = mediacodec_init, \
FF_CODEC_RECEIVE_PACKET_CB(mediacodec_encode), \
.close = mediacodec_close, \
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index b6de50edce7..137b68a98db 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -657,6 +657,7 @@ const FFCodec ff_mjpeg_encoder = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &mjpeg_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
};
@@ -683,6 +684,7 @@ const FFCodec ff_amv_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_JPEG,
.p.priv_class = &amv_class,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index f956dde78f0..ff1119415fc 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -1245,6 +1245,7 @@ const FFCodec ff_mpeg1video_encoder = {
.p.supported_framerates = ff_mpeg12_frame_rate_tab + 1,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
@@ -1264,6 +1265,7 @@ const FFCodec ff_mpeg2video_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index f806ad8a749..3da94401d26 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1404,6 +1404,7 @@ const FFCodec ff_mpeg4_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 119ea8f15e3..82e64f6dc00 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -685,6 +685,7 @@ const FFCodec ff_msmpeg4v2_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_MSMPEG4V2,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
@@ -700,6 +701,7 @@ const FFCodec ff_msmpeg4v3_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_MSMPEG4V3,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
@@ -715,6 +717,7 @@ const FFCodec ff_wmv1_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_WMV1,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
.p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c
index d37ee07bff2..562e2bc7fef 100644
--- a/libavcodec/nvenc_av1.c
+++ b/libavcodec/nvenc_av1.c
@@ -194,6 +194,7 @@ const FFCodec ff_av1_nvenc_encoder = {
.p.priv_class = &av1_nvenc_class,
.defaults = defaults,
.p.pix_fmts = ff_nvenc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_ENCODER_FLUSH | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 4d6f968e0b7..8cbe4dca39b 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -265,6 +265,7 @@ const FFCodec ff_h264_nvenc_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_nvenc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.wrapper_name = "nvenc",
.hw_configs = ff_nvenc_hw_configs,
};
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index bd8b6153f31..0a4c36357ef 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -253,6 +253,7 @@ const FFCodec ff_hevc_nvenc_encoder = {
.p.priv_class = &hevc_nvenc_class,
.defaults = defaults,
.p.pix_fmts = ff_nvenc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_ENCODER_FLUSH | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index 86913237b27..2c3865506ff 100644
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -948,6 +948,7 @@ const FFCodec ff_mpeg4_omx_encoder = {
FF_CODEC_ENCODE_CB(omx_encode_frame),
.close = omx_encode_end,
.p.pix_fmts = omx_encoder_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &omx_mpeg4enc_class,
@@ -969,6 +970,7 @@ const FFCodec ff_h264_omx_encoder = {
FF_CODEC_ENCODE_CB(omx_encode_frame),
.close = omx_encode_end,
.p.pix_fmts = omx_encoder_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.p.capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &omx_h264enc_class,
diff --git a/libavcodec/qsvenc_av1.c b/libavcodec/qsvenc_av1.c
index 33727bb07e5..30360a3651b 100644
--- a/libavcodec/qsvenc_av1.c
+++ b/libavcodec/qsvenc_av1.c
@@ -150,6 +150,7 @@ FFCodec ff_av1_qsv_encoder = {
AV_PIX_FMT_P010,
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 53e4e744b28..304d1e7dcb2 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -202,6 +202,7 @@ const FFCodec ff_h264_qsv_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 2ccbe0464b2..803d1b10a1f 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -406,6 +406,7 @@ const FFCodec ff_hevc_qsv_encoder = {
AV_PIX_FMT_VUYX,
AV_PIX_FMT_XV30,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
diff --git a/libavcodec/qsvenc_jpeg.c b/libavcodec/qsvenc_jpeg.c
index 2add12adc90..b2458eee062 100644
--- a/libavcodec/qsvenc_jpeg.c
+++ b/libavcodec/qsvenc_jpeg.c
@@ -93,6 +93,7 @@ const FFCodec ff_mjpeg_qsv_encoder = {
AV_PIX_FMT_BGRA,
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.p.wrapper_name = "qsv",
diff --git a/libavcodec/qsvenc_mpeg2.c b/libavcodec/qsvenc_mpeg2.c
index fabf461fe32..ad3da6d6723 100644
--- a/libavcodec/qsvenc_mpeg2.c
+++ b/libavcodec/qsvenc_mpeg2.c
@@ -105,6 +105,7 @@ const FFCodec ff_mpeg2_qsv_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
index a760e4932e5..b247c39c86e 100644
--- a/libavcodec/qsvenc_vp9.c
+++ b/libavcodec/qsvenc_vp9.c
@@ -117,6 +117,7 @@ const FFCodec ff_vp9_qsv_encoder = {
AV_PIX_FMT_QSV,
AV_PIX_FMT_XV30,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index a6c167b1dc5..7cbe820f9a7 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -1128,6 +1128,7 @@ const FFCodec ff_roq_encoder = {
.close = roq_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_JPEG,
.p.priv_class = &roq_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
index 8a405b86867..2104ee0a241 100644
--- a/libavcodec/rv10enc.c
+++ b/libavcodec/rv10enc.c
@@ -78,4 +78,5 @@ const FFCodec ff_rv10_encoder = {
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
};
diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c
index dc26877d5e6..d0e24f2f26d 100644
--- a/libavcodec/rv20enc.c
+++ b/libavcodec/rv20enc.c
@@ -75,4 +75,5 @@ const FFCodec ff_rv20_encoder = {
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
};
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 43ca602762d..2d767e1f0ad 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -2143,6 +2143,7 @@ const FFCodec ff_snow_encoder = {
AV_PIX_FMT_GRAY8,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &snowenc_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 5b4ff4c139e..4a871039eab 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -294,6 +294,7 @@ const FFCodec ff_speedhq_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index d71ad07b861..0499b3d3a6e 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -749,5 +749,6 @@ const FFCodec ff_svq1_encoder = {
.close = svq1_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P,
AV_PIX_FMT_NONE },
+ .color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 25539d03dcd..5e65979c79f 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -589,5 +589,6 @@ const FFCodec ff_tiff_encoder = {
AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &tiffenc_class,
};
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index 59e198458b0..7d2572022f0 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -675,5 +675,6 @@ const FFCodec ff_utvideo_encoder = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index e08db5d5d36..5770e87ea10 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -433,6 +433,7 @@ static const FFCodecDefault v4l2_m2m_defaults[] = {
.close = v4l2_encode_close, \
.defaults = v4l2_m2m_defaults, \
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
+ .color_ranges = AVCOL_RANGE_MPEG, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c
index 02a31b894d6..571bf594577 100644
--- a/libavcodec/vaapi_encode_av1.c
+++ b/libavcodec/vaapi_encode_av1.c
@@ -948,6 +948,7 @@ const FFCodec ff_av1_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index bf51df0f51c..12f3048a9b6 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1391,6 +1391,7 @@ const FFCodec ff_h264_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 2777632fb62..174a45dd027 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1508,6 +1508,7 @@ const FFCodec ff_hevc_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index c17747e3a94..e526136fecf 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -583,6 +583,7 @@ const FFCodec ff_mjpeg_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index c9b16fbcfc0..a3da298b0e7 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -706,6 +706,7 @@ const FFCodec ff_mpeg2_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG,
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index 8a557b967e6..d731febb7fb 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -261,6 +261,7 @@ const FFCodec ff_vp8_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.hw_configs = ff_vaapi_encode_hw_configs,
.p.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index c2a8dec71b9..8d07305832b 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -314,6 +314,7 @@ const FFCodec ff_vp9_vaapi_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_vp9_defaults,
+ .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 365d43146db..ee82c067927 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -1238,5 +1238,6 @@ const FFCodec ff_vc2_encoder = {
FF_CODEC_ENCODE_CB(vc2_encode_frame),
.p.priv_class = &vc2enc_class,
.defaults = vc2enc_defaults,
- .p.pix_fmts = allowed_pix_fmts
+ .p.pix_fmts = allowed_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
};
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 42065cbcb3b..656f136d472 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -2958,6 +2958,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = {
AV_CODEC_CAP_HARDWARE,
.priv_data_size = sizeof(VTEncContext),
.p.pix_fmts = hevc_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.init = vtenc_init,
FF_CODEC_ENCODE_CB(vtenc_frame),
.close = vtenc_close,
@@ -2997,6 +2998,7 @@ const FFCodec ff_prores_videotoolbox_encoder = {
AV_CODEC_CAP_HARDWARE,
.priv_data_size = sizeof(VTEncContext),
.p.pix_fmts = prores_pix_fmts,
+ .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.init = vtenc_init,
FF_CODEC_ENCODE_CB(vtenc_frame),
.close = vtenc_close,
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index 13ec2bf6ff7..fded6f0e768 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -249,6 +249,7 @@ const FFCodec ff_wmv2_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .color_ranges = AVCOL_RANGE_MPEG,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
};
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 01/17] avcodec/internal: add FFCodec.color_ranges Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-08-01 1:48 ` Andreas Rheinhardt
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 03/17] avcodec/encode: switch to avcodec_get_supported_config() Niklas Haas
` (14 subsequent siblings)
16 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
This replaces the myriad of existing lists in AVCodec by a unified API
call, allowing us to (ultimately) trim down the sizeof(AVCodec) quite
substantially, while also making this more trivially extensible.
In addition to the already covered lists, add two new entries for color
space and color range, mirroring the newly added negotiable fields in
libavfilter.
I decided to drop the explicit length field from the API proposed by
Andreas Rheinhardt, because having it in place ended up complicating
both the codec side and the client side implementations, while also
being strictly less flexible (it's trivial to recover a length given
a terminator, but requires allocation to add a terminator given
a length). Using a terminator also presents less of a porting challenge
for existing users of the current API.
Once the deprecation period passes for the existing public fields, the
rough plan is to move the commonly used fields (such as
pix_fmt/sample_fmt) into FFCodec, possibly as a union of audio and video
configuration types, and then implement the rarely used fields with
custom callbacks.
---
doc/APIchanges | 5 +++
libavcodec/avcodec.c | 75 +++++++++++++++++++++++++++++++++++++
libavcodec/avcodec.h | 27 +++++++++++++
libavcodec/codec.h | 19 ++++++++--
libavcodec/codec_internal.h | 24 ++++++++++++
libavcodec/version.h | 4 +-
6 files changed, 148 insertions(+), 6 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 0a39b6d7ab8..fdeae67159d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
+2024-04-xx - xxxxxxxxxx - lavc 59.6.100 - avcodec.h
+ Add avcodec_get_supported_config() and enum AVCodecConfig; deprecate
+ AVCodec.pix_fmts, AVCodec.sample_fmts, AVCodec.supported_framerates,
+ AVCodec.supported_samplerates and AVCodec.ch_layouts.
+
2024-04-03 - xxxxxxxxxx - lavu 59.13.100 - pixfmt.h
Add AVCOL_SPC_IPT_C2, AVCOL_SPC_YCGCO_RE and AVCOL_SPC_YCGCO_RO
to map new matrix coefficients defined by H.273 v3.
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 525fe516bd2..96728546d6c 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -700,3 +700,78 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
return ff_decode_receive_frame(avctx, frame);
return ff_encode_receive_frame(avctx, frame);
}
+
+#define WRAP_CONFIG(allowed_type, field) \
+ do { \
+ if (codec->type != (allowed_type)) \
+ return AVERROR(EINVAL); \
+ *out_configs = (field); \
+ return 0; \
+ } while (0)
+
+static const enum AVColorRange color_range_jpeg[] = {
+ AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED
+};
+
+static const enum AVColorRange color_range_mpeg[] = {
+ AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED
+};
+
+static const enum AVColorRange color_range_all[] = {
+ AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED
+};
+
+static const enum AVColorRange *color_range_table[] = {
+ [AVCOL_RANGE_MPEG] = color_range_mpeg,
+ [AVCOL_RANGE_JPEG] = color_range_jpeg,
+ [AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG] = color_range_all,
+};
+
+int ff_default_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags,
+ const void **out_configs)
+{
+ switch (config) {
+FF_DISABLE_DEPRECATION_WARNINGS
+ case AV_CODEC_CONFIG_PIX_FORMAT:
+ WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->pix_fmts);
+ case AV_CODEC_CONFIG_FRAME_RATE:
+ WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->supported_framerates);
+ case AV_CODEC_CONFIG_SAMPLE_RATE:
+ WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->supported_samplerates);
+ case AV_CODEC_CONFIG_SAMPLE_FORMAT:
+ WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->sample_fmts);
+ case AV_CODEC_CONFIG_CHANNEL_LAYOUT:
+ WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->ch_layouts);
+FF_ENABLE_DEPRECATION_WARNINGS
+
+ case AV_CODEC_CONFIG_COLOR_RANGE:
+ if (codec->type != AVMEDIA_TYPE_VIDEO)
+ return AVERROR(EINVAL);
+ *out_configs = color_range_table[ffcodec(codec)->color_ranges];
+ return 0;
+
+ case AV_CODEC_CONFIG_COLOR_SPACE:
+ *out_configs = NULL;
+ return 0;
+ default:
+ return AVERROR(EINVAL);
+ }
+}
+
+int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec,
+ enum AVCodecConfig config, unsigned flags,
+ const void **out)
+{
+ const FFCodec *codec2;
+ if (!codec)
+ codec = avctx->codec;
+ codec2 = ffcodec(codec);
+ if (codec2->get_supported_config) {
+ return codec2->get_supported_config(avctx, codec, config, flags, out);
+ } else {
+ return ff_default_get_supported_config(avctx, codec, config, flags, out);
+ }
+}
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 83dc487251c..64f31375fc6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2690,6 +2690,33 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
enum AVPixelFormat hw_pix_fmt,
AVBufferRef **out_frames_ref);
+enum AVCodecConfig {
+ AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE
+ AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0}
+ AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 0
+ AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE
+ AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}
+ AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED
+ AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED
+};
+
+/**
+ * Retrieve a list of all supported values for a given configuration type.
+ *
+ * @param avctx An optional context to use. Values such as
+ * `strict_std_compliance` may affect the result. If NULL,
+ * default values are used.
+ * @param codec The codec to query, or NULL to use avctx->codec.
+ * @param config The configuration to query.
+ * @param flags Currently unused; should be set to zero.
+ * @param out_configs On success, set to a list of configurations, terminated
+ * by a config-specific terminator, or NULL if all
+ * possible values are supported.
+ */
+int avcodec_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec, enum AVCodecConfig config,
+ unsigned flags, const void **out_configs);
+
/**
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 6f9b42760d7..f7541ffc42b 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -205,10 +205,19 @@ typedef struct AVCodec {
*/
int capabilities;
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
- const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
- const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
- const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
- const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
+
+ /**
+ * Deprecated codec capabilities.
+ */
+ attribute_deprecated
+ const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config()
+ attribute_deprecated
+ const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config()
+ attribute_deprecated
+ const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config()
+ attribute_deprecated
+ const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config()
+
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
@@ -226,7 +235,9 @@ typedef struct AVCodec {
/**
* Array of supported channel layouts, terminated with a zeroed layout.
+ * @deprecated use avcodec_get_supported_config()
*/
+ attribute_deprecated
const AVChannelLayout *ch_layouts;
} AVCodec;
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index 2134f184094..bac3e30ba2c 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include "libavutil/attributes.h"
+#include "avcodec.h"
#include "codec.h"
#include "config.h"
@@ -270,8 +271,31 @@ typedef struct FFCodec {
* List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
*/
const uint32_t *codec_tags;
+
+ /**
+ * Custom callback for avcodec_get_supported_config(). If absent,
+ * ff_default_get_supported_config() will be used.
+ */
+ int (*get_supported_config)(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags,
+ const void **out_configs);
} FFCodec;
+/**
+ * Default implementation for avcodec_get_supported_config(). Will return the
+ * relevant fields from AVCodec if present, or NULL otherwise.
+ *
+ * For AVCODEC_CONFIG_COLOR_RANGE, the output will depend on the bitmask in
+ * FFCodec.color_ranges, with a value of 0 returning NULL.
+ */
+int ff_default_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags,
+ const void **out_configs);
+
#if CONFIG_SMALL
#define CODEC_LONG_NAME(str) .p.long_name = NULL
#else
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 84a1c02ce4a..da54f878874 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 5
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 6
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 03/17] avcodec/encode: switch to avcodec_get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 01/17] avcodec/internal: add FFCodec.color_ranges Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 04/17] avcodec/allcodecs: add backcompat for new config API Niklas Haas
` (13 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
---
libavcodec/encode.c | 88 ++++++++++++++++++++++++++++-----------------
1 file changed, 55 insertions(+), 33 deletions(-)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 34658d13d0c..d0e79379048 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -563,7 +563,8 @@ static int encode_preinit_video(AVCodecContext *avctx)
{
const AVCodec *c = avctx->codec;
const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);
- int i;
+ const enum AVPixelFormat *pix_fmts;
+ int ret, i;
if (!av_get_pix_fmt_name(avctx->pix_fmt)) {
av_log(avctx, AV_LOG_ERROR, "Invalid video pixel format: %d\n",
@@ -571,28 +572,33 @@ static int encode_preinit_video(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- if (c->pix_fmts) {
- for (i = 0; c->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
- if (avctx->pix_fmt == c->pix_fmts[i])
+ ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT,
+ 0, (const void **) &pix_fmts);
+ if (ret < 0)
+ return ret;
+
+ if (pix_fmts) {
+ for (i = 0; pix_fmts[i] != AV_PIX_FMT_NONE; i++)
+ if (avctx->pix_fmt == pix_fmts[i])
break;
- if (c->pix_fmts[i] == AV_PIX_FMT_NONE) {
+ if (pix_fmts[i] == AV_PIX_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR,
"Specified pixel format %s is not supported by the %s encoder.\n",
av_get_pix_fmt_name(avctx->pix_fmt), c->name);
av_log(avctx, AV_LOG_ERROR, "Supported pixel formats:\n");
- for (int p = 0; c->pix_fmts[p] != AV_PIX_FMT_NONE; p++) {
+ for (int p = 0; pix_fmts[p] != AV_PIX_FMT_NONE; p++) {
av_log(avctx, AV_LOG_ERROR, " %s\n",
- av_get_pix_fmt_name(c->pix_fmts[p]));
+ av_get_pix_fmt_name(pix_fmts[p]));
}
return AVERROR(EINVAL);
}
- if (c->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
- c->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
- c->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
- c->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
- c->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
+ if (pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
+ pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
+ pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
+ pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
+ pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
avctx->color_range = AVCOL_RANGE_JPEG;
}
@@ -646,7 +652,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
static int encode_preinit_audio(AVCodecContext *avctx)
{
const AVCodec *c = avctx->codec;
- int i;
+ const enum AVSampleFormat *sample_fmts;
+ const int *supported_samplerates;
+ const AVChannelLayout *ch_layouts;
+ int ret, i;
if (!av_get_sample_fmt_name(avctx->sample_fmt)) {
av_log(avctx, AV_LOG_ERROR, "Invalid audio sample format: %d\n",
@@ -659,53 +668,66 @@ static int encode_preinit_audio(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- if (c->sample_fmts) {
- for (i = 0; c->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
- if (avctx->sample_fmt == c->sample_fmts[i])
+ ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_SAMPLE_FORMAT,
+ 0, (const void **) &sample_fmts);
+ if (ret < 0)
+ return ret;
+ if (sample_fmts) {
+ for (i = 0; sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
+ if (avctx->sample_fmt == sample_fmts[i])
break;
if (avctx->ch_layout.nb_channels == 1 &&
av_get_planar_sample_fmt(avctx->sample_fmt) ==
- av_get_planar_sample_fmt(c->sample_fmts[i])) {
- avctx->sample_fmt = c->sample_fmts[i];
+ av_get_planar_sample_fmt(sample_fmts[i])) {
+ avctx->sample_fmt = sample_fmts[i];
break;
}
}
- if (c->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
+ if (sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR,
"Specified sample format %s is not supported by the %s encoder\n",
av_get_sample_fmt_name(avctx->sample_fmt), c->name);
av_log(avctx, AV_LOG_ERROR, "Supported sample formats:\n");
- for (int p = 0; c->sample_fmts[p] != AV_SAMPLE_FMT_NONE; p++) {
+ for (int p = 0; sample_fmts[p] != AV_SAMPLE_FMT_NONE; p++) {
av_log(avctx, AV_LOG_ERROR, " %s\n",
- av_get_sample_fmt_name(c->sample_fmts[p]));
+ av_get_sample_fmt_name(sample_fmts[p]));
}
return AVERROR(EINVAL);
}
}
- if (c->supported_samplerates) {
- for (i = 0; c->supported_samplerates[i] != 0; i++)
- if (avctx->sample_rate == c->supported_samplerates[i])
+
+ ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_SAMPLE_RATE,
+ 0, (const void **) &supported_samplerates);
+ if (ret < 0)
+ return ret;
+ if (supported_samplerates) {
+ for (i = 0; supported_samplerates[i] != 0; i++)
+ if (avctx->sample_rate == supported_samplerates[i])
break;
- if (c->supported_samplerates[i] == 0) {
+ if (supported_samplerates[i] == 0) {
av_log(avctx, AV_LOG_ERROR,
"Specified sample rate %d is not supported by the %s encoder\n",
avctx->sample_rate, c->name);
av_log(avctx, AV_LOG_ERROR, "Supported sample rates:\n");
- for (int p = 0; c->supported_samplerates[p]; p++)
- av_log(avctx, AV_LOG_ERROR, " %d\n", c->supported_samplerates[p]);
+ for (int p = 0; supported_samplerates[p]; p++)
+ av_log(avctx, AV_LOG_ERROR, " %d\n", supported_samplerates[p]);
return AVERROR(EINVAL);
}
}
- if (c->ch_layouts) {
- for (i = 0; c->ch_layouts[i].nb_channels; i++) {
- if (!av_channel_layout_compare(&avctx->ch_layout, &c->ch_layouts[i]))
+ ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_CHANNEL_LAYOUT,
+ 0, (const void **) &ch_layouts);
+ if (ret < 0)
+ return ret;
+ if (ch_layouts) {
+ for (i = 0; ch_layouts[i].nb_channels; i++) {
+ if (!av_channel_layout_compare(&avctx->ch_layout, &ch_layouts[i]))
break;
}
- if (!c->ch_layouts[i].nb_channels) {
+ if (!ch_layouts[i].nb_channels) {
char buf[512];
int ret = av_channel_layout_describe(&avctx->ch_layout, buf, sizeof(buf));
av_log(avctx, AV_LOG_ERROR,
@@ -713,8 +735,8 @@ static int encode_preinit_audio(AVCodecContext *avctx)
ret > 0 ? buf : "?", c->name);
av_log(avctx, AV_LOG_ERROR, "Supported channel layouts:\n");
- for (int p = 0; c->ch_layouts[p].nb_channels; p++) {
- ret = av_channel_layout_describe(&c->ch_layouts[p], buf, sizeof(buf));
+ for (int p = 0; ch_layouts[p].nb_channels; p++) {
+ ret = av_channel_layout_describe(&ch_layouts[p], buf, sizeof(buf));
av_log(avctx, AV_LOG_ERROR, " %s\n", ret > 0 ? buf : "?");
}
return AVERROR(EINVAL);
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 04/17] avcodec/allcodecs: add backcompat for new config API
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (2 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 03/17] avcodec/encode: switch to avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 05/17] avcodec/libx265: switch to get_supported_config() Niklas Haas
` (12 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
In order to avoid breaking older clients not yet using the new API, we
need to add backwards compatibility for codecs which have switched from
init_static() to get_supported_config().
This function can be removed entirely once the deprecated static fields
are removed.
---
libavcodec/allcodecs.c | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f4705651fb8..a9f1797930a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -916,8 +916,41 @@ static AVOnce av_codec_static_init = AV_ONCE_INIT;
static void av_codec_init_static(void)
{
for (int i = 0; codec_list[i]; i++) {
- if (codec_list[i]->init_static_data)
- codec_list[i]->init_static_data((FFCodec*)codec_list[i]);
+ const FFCodec *codec = codec_list[i];
+ if (codec->init_static_data) {
+ codec->init_static_data((FFCodec*) codec);
+ continue;
+ }
+
+ /* Backward compatibility with deprecated public fields */
+ if (!codec->get_supported_config)
+ continue;
+
+FF_DISABLE_DEPRECATION_WARNINGS
+ switch (codec->p.type) {
+ case AVMEDIA_TYPE_VIDEO:
+ codec->get_supported_config(NULL, &codec->p,
+ AV_CODEC_CONFIG_PIX_FORMAT, 0,
+ (const void **) &codec->p.pix_fmts);
+ codec->get_supported_config(NULL, &codec->p,
+ AV_CODEC_CONFIG_FRAME_RATE, 0,
+ (const void **) &codec->p.supported_framerates);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ codec->get_supported_config(NULL, &codec->p,
+ AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
+ (const void **) &codec->p.sample_fmts);
+ codec->get_supported_config(NULL, &codec->p,
+ AV_CODEC_CONFIG_SAMPLE_RATE, 0,
+ (const void **) &codec->p.supported_samplerates);
+ codec->get_supported_config(NULL, &codec->p,
+ AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
+ (const void **) &codec->p.ch_layouts);
+ break;
+ default:
+ break;
+ }
+FF_ENABLE_DEPRECATION_WARNINGS
}
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 05/17] avcodec/libx265: switch to get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (3 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 04/17] avcodec/allcodecs: add backcompat for new config API Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 06/17] avcodec/libvpxenc: " Niklas Haas
` (11 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
---
libavcodec/libx265.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 3533ac5cc1f..e36a1eb9505 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -892,14 +892,24 @@ static const enum AVPixelFormat x265_csp_twelve[] = {
AV_PIX_FMT_NONE
};
-static av_cold void libx265_encode_init_csp(FFCodec *codec)
+static int libx265_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags, const void **out)
{
- if (x265_api_get(12))
- codec->p.pix_fmts = x265_csp_twelve;
- else if (x265_api_get(10))
- codec->p.pix_fmts = x265_csp_ten;
- else if (x265_api_get(8))
- codec->p.pix_fmts = x265_csp_eight;
+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
+ if (x265_api_get(12))
+ *out = x265_csp_twelve;
+ else if (x265_api_get(10))
+ *out = x265_csp_ten;
+ else if (x265_api_get(8))
+ *out = x265_csp_eight;
+ else
+ return AVERROR_EXTERNAL;
+ return 0;
+ }
+
+ return ff_default_get_supported_config(avctx, codec, config, flags, out);
}
#define OFFSET(x) offsetof(libx265Context, x)
@@ -952,7 +962,7 @@ FFCodec ff_libx265_encoder = {
.p.priv_class = &class,
.p.wrapper_name = "libx265",
.init = libx265_encode_init,
- .init_static_data = libx265_encode_init_csp,
+ .get_supported_config = libx265_get_supported_config,
FF_CODEC_ENCODE_CB(libx265_encode_frame),
.close = libx265_encode_close,
.priv_data_size = sizeof(libx265Context),
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 06/17] avcodec/libvpxenc: switch to get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (4 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 05/17] avcodec/libx265: switch to get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 07/17] avcodec/libaomenc: " Niklas Haas
` (10 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
---
libavcodec/libvpxenc.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index cdb83312614..64dc69f8547 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -2087,13 +2087,21 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
AV_PIX_FMT_NONE
};
-static av_cold void vp9_init_static(FFCodec *codec)
+static int vp9_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags, const void **out)
{
- vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
- if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
- codec->p.pix_fmts = vp9_pix_fmts_highbd;
- else
- codec->p.pix_fmts = vp9_pix_fmts_highcol;
+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
+ vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
+ if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
+ *out = vp9_pix_fmts_highbd;
+ else
+ *out = vp9_pix_fmts_highcol;
+ return 0;
+ }
+
+ return ff_default_get_supported_config(avctx, codec, config, flags, out);
}
static const AVClass class_vp9 = {
@@ -2122,6 +2130,6 @@ FFCodec ff_libvpx_vp9_encoder = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
- .init_static_data = vp9_init_static,
+ .get_supported_config = vp9_get_supported_config,
};
#endif /* CONFIG_LIBVPX_VP9_ENCODER */
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 07/17] avcodec/libaomenc: switch to get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (5 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 06/17] avcodec/libvpxenc: " Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 08/17] avcodec/mjpegenc: " Niklas Haas
` (9 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
---
libavcodec/libaomenc.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 5023d2fda42..0488e5c3c9a 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1398,16 +1398,24 @@ static const enum AVPixelFormat av1_pix_fmts_highbd_with_gray[] = {
AV_PIX_FMT_NONE
};
-static av_cold void av1_init_static(FFCodec *codec)
+static int av1_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags, const void **out)
{
- int supports_monochrome = aom_codec_version() >= 20001;
- aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
- if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
- codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_highbd_with_gray :
- av1_pix_fmts_highbd;
- else
- codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_with_gray :
- av1_pix_fmts;
+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
+ int supports_monochrome = aom_codec_version() >= 20001;
+ aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
+ if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
+ *out = supports_monochrome ? av1_pix_fmts_highbd_with_gray :
+ av1_pix_fmts_highbd;
+ else
+ *out = supports_monochrome ? av1_pix_fmts_with_gray :
+ av1_pix_fmts;
+ return 0;
+ }
+
+ return ff_default_get_supported_config(avctx, codec, config, flags, out);
}
static av_cold int av1_init(AVCodecContext *avctx)
@@ -1529,5 +1537,5 @@ FFCodec ff_libaom_av1_encoder = {
FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
- .init_static_data = av1_init_static,
+ .get_supported_config = av1_get_supported_config,
};
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 08/17] avcodec/mjpegenc: switch to get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (6 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 07/17] avcodec/libaomenc: " Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data() Niklas Haas
` (8 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
This codec's capabilities should be set dynamically based on the value
of strict_std_compliance, when available. This will allow us to finally
get rid of the strictness hack in ffmpeg_filter.c.
---
libavcodec/mjpegenc.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 137b68a98db..0473ad132ba 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -640,7 +640,24 @@ static const AVClass mjpeg_class = {
.version = LIBAVUTIL_VERSION_INT,
};
-const FFCodec ff_mjpeg_encoder = {
+static int mjpeg_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags, const void **out)
+{
+ if (config == AV_CODEC_CONFIG_COLOR_RANGE) {
+ static const enum AVColorRange mjpeg_ranges[] = {
+ AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED,
+ };
+ int strict = avctx ? avctx->strict_std_compliance : 0;
+ *out = &mjpeg_ranges[strict > FF_COMPLIANCE_UNOFFICIAL ? 1 : 0];
+ return 0;
+ }
+
+ return ff_default_get_supported_config(avctx, codec, config, flags, out);
+}
+
+FFCodec ff_mjpeg_encoder = {
.p.name = "mjpeg",
CODEC_LONG_NAME("MJPEG (Motion JPEG)"),
.p.type = AVMEDIA_TYPE_VIDEO,
@@ -657,9 +674,9 @@ const FFCodec ff_mjpeg_encoder = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE
},
- .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
.p.priv_class = &mjpeg_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
+ .get_supported_config = mjpeg_get_supported_config,
};
#endif
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (7 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 08/17] avcodec/mjpegenc: " Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-09 13:00 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 10/17] fftools/opt_common: switch to avcodec_get_supported_config() Niklas Haas
` (7 subsequent siblings)
16 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
All hail get_supported_config()
---
libavcodec/allcodecs.c | 7 +------
libavcodec/codec_internal.h | 8 --------
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index a9f1797930a..1f22e06e710 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -916,13 +916,8 @@ static AVOnce av_codec_static_init = AV_ONCE_INIT;
static void av_codec_init_static(void)
{
for (int i = 0; codec_list[i]; i++) {
- const FFCodec *codec = codec_list[i];
- if (codec->init_static_data) {
- codec->init_static_data((FFCodec*) codec);
- continue;
- }
-
/* Backward compatibility with deprecated public fields */
+ const FFCodec *codec = codec_list[i];
if (!codec->get_supported_config)
continue;
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index bac3e30ba2c..d3033db3375 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -174,14 +174,6 @@ typedef struct FFCodec {
*/
const FFCodecDefault *defaults;
- /**
- * Initialize codec static data, called from av_codec_iterate().
- *
- * This is not intended for time consuming operations as it is
- * run for every codec regardless of that codec being used.
- */
- void (*init_static_data)(struct FFCodec *codec);
-
int (*init)(struct AVCodecContext *);
union {
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 10/17] fftools/opt_common: switch to avcodec_get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (8 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 11/17] fftools: drop unused/hacky macros Niklas Haas
` (6 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
While rewriting this macro, I decided to make it a bit more flexible so
it can work for all of the fields (including future fields) in a more
generic way, and to also print the channel layout using an AVBPrint to
avoid hard-coding the assumption that the length is less than 128
characters.
---
fftools/opt_common.c | 92 +++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 43 deletions(-)
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 947a226d8d1..c4d71fbe3c7 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -262,22 +262,35 @@ int show_buildconf(void *optctx, const char *opt, const char *arg)
return 0;
}
-#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
- if (codec->field) { \
- const type *p = codec->field; \
- \
- printf(" Supported " list_name ":"); \
- while (*p != term) { \
- get_name(*p); \
- printf(" %s", name); \
- p++; \
- } \
- printf("\n"); \
- } \
+#define PRINT_CODEC_SUPPORTED(codec, config, type, name, elem, cond, fmt, ...) \
+ do { \
+ const type *elem = NULL; \
+ avcodec_get_supported_config(NULL, codec, config, 0, \
+ (const void **) &elem); \
+ if (elem) { \
+ printf(" Supported " name ":"); \
+ while (cond) { \
+ printf(" " fmt, __VA_ARGS__); \
+ elem++; \
+ } \
+ printf("\n"); \
+ } \
+ } while (0)
+
+static const char *get_channel_layout_desc(const AVChannelLayout *layout, AVBPrint *bp)
+{
+ int ret;
+ av_bprint_clear(bp);
+ ret = av_channel_layout_describe_bprint(layout, bp);
+ if (!av_bprint_is_complete(bp) || ret < 0)
+ return "unknown/invalid";
+ return bp->str;
+}
static void print_codec(const AVCodec *c)
{
int encoder = av_codec_is_encoder(c);
+ AVBPrint desc;
printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
c->long_name ? c->long_name : "");
@@ -343,35 +356,22 @@ static void print_codec(const AVCodec *c)
printf("\n");
}
- if (c->supported_framerates) {
- const AVRational *fps = c->supported_framerates;
-
- printf(" Supported framerates:");
- while (fps->num) {
- printf(" %d/%d", fps->num, fps->den);
- fps++;
- }
- printf("\n");
- }
- PRINT_CODEC_SUPPORTED(c, pix_fmts, enum AVPixelFormat, "pixel formats",
- AV_PIX_FMT_NONE, GET_PIX_FMT_NAME);
- PRINT_CODEC_SUPPORTED(c, supported_samplerates, int, "sample rates", 0,
- GET_SAMPLE_RATE_NAME);
- PRINT_CODEC_SUPPORTED(c, sample_fmts, enum AVSampleFormat, "sample formats",
- AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME);
-
- if (c->ch_layouts) {
- const AVChannelLayout *p = c->ch_layouts;
-
- printf(" Supported channel layouts:");
- while (p->nb_channels) {
- char name[128];
- av_channel_layout_describe(p, name, sizeof(name));
- printf(" %s", name);
- p++;
- }
- printf("\n");
- }
+ PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_FRAME_RATE, AVRational, "framerates",
+ fps, fps->num, "%d/%d", fps->num, fps->den);
+ PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_PIX_FORMAT, enum AVPixelFormat,
+ "pixel formats", fmt, *fmt != AV_PIX_FMT_NONE,
+ "%s", av_get_pix_fmt_name(*fmt));
+ PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_SAMPLE_RATE, int, "sample rates",
+ rate, *rate != 0, "%d", *rate);
+ PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_SAMPLE_FORMAT, enum AVSampleFormat,
+ "sample formats", fmt, *fmt != AV_SAMPLE_FMT_NONE,
+ "%s", av_get_sample_fmt_name(*fmt));
+
+ av_bprint_init(&desc, 0, AV_BPRINT_SIZE_AUTOMATIC);
+ PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_CHANNEL_LAYOUT, AVChannelLayout,
+ "channel layouts", layout, layout->nb_channels,
+ "%s", get_channel_layout_desc(layout, &desc));
+ av_bprint_finalize(&desc, NULL);
if (c->priv_class) {
show_help_children(c->priv_class,
@@ -566,8 +566,14 @@ static void show_help_bsf(const char *name)
}
printf("Bit stream filter %s\n", bsf->name);
- PRINT_CODEC_SUPPORTED(bsf, codec_ids, enum AVCodecID, "codecs",
- AV_CODEC_ID_NONE, GET_CODEC_NAME);
+ if (bsf->codec_ids) {
+ const enum AVCodecID *id = bsf->codec_ids;
+ printf(" Supported codecs:");
+ while (*id != AV_CODEC_ID_NONE) {
+ printf(" %s", avcodec_descriptor_get(*id)->name);
+ id++;
+ }
+ }
if (bsf->priv_class)
show_help_children(bsf->priv_class, AV_OPT_FLAG_BSF_PARAM);
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 11/17] fftools: drop unused/hacky macros
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (9 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 10/17] fftools/opt_common: switch to avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 12/17] fftools/ffmpeg_mux_init: switch to avcodec_get_supported_config() Niklas Haas
` (5 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
Having macros initialize local variables seems strange to me, and there
are no more current users of these macros. (The one that was commented
out was incorrect anyway, since the macro has changed in the meantime)
---
fftools/cmdutils.h | 13 -------------
fftools/ffmpeg_filter.c | 2 +-
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index d0c773663ba..940541b9eaf 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -465,19 +465,6 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
#define GROW_ARRAY(array, nb_elems)\
grow_array((void**)&array, sizeof(*array), &nb_elems, nb_elems + 1)
-#define GET_PIX_FMT_NAME(pix_fmt)\
- const char *name = av_get_pix_fmt_name(pix_fmt);
-
-#define GET_CODEC_NAME(id)\
- const char *name = avcodec_descriptor_get(id)->name;
-
-#define GET_SAMPLE_FMT_NAME(sample_fmt)\
- const char *name = av_get_sample_fmt_name(sample_fmt)
-
-#define GET_SAMPLE_RATE_NAME(rate)\
- char name[16];\
- snprintf(name, sizeof(name), "%d", rate);
-
double get_rotation(const int32_t *displaymatrix);
/* read file contents into a string */
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 2308abf82af..ac04841a16c 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -401,7 +401,7 @@ static void choose_ ## name (OutputFilterPriv *ofp, AVBPrint *bprint) \
}
//DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, AV_PIX_FMT_NONE,
-// GET_PIX_FMT_NAME)
+// av_get_pix_fmt_name)
DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name)
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 12/17] fftools/ffmpeg_mux_init: switch to avcodec_get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (10 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 11/17] fftools: drop unused/hacky macros Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance Niklas Haas
` (4 subsequent siblings)
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
---
fftools/ffmpeg_mux_init.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index d3d7d022ff6..4f8c81102d3 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -511,13 +511,19 @@ static int fmt_in_list(const int *formats, int format)
}
static enum AVPixelFormat
-choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target)
+choose_pixel_fmt(const AVCodecContext *avctx, enum AVPixelFormat target)
{
- const enum AVPixelFormat *p = codec->pix_fmts;
+ const enum AVPixelFormat *p;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
//FIXME: This should check for AV_PIX_FMT_FLAG_ALPHA after PAL8 pixel format without alpha is implemented
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
+ int ret;
+
+ ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT,
+ 0, (const void **) &p);
+ if (ret < 0)
+ return AV_PIX_FMT_NONE;
for (; *p != AV_PIX_FMT_NONE; p++) {
best = av_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL);
@@ -529,7 +535,7 @@ choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target)
av_log(NULL, AV_LOG_WARNING,
"Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
av_get_pix_fmt_name(target),
- codec->name,
+ avctx->codec->name,
av_get_pix_fmt_name(best));
return best;
}
@@ -538,8 +544,9 @@ choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target)
static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
{
- const enum AVPixelFormat *fmts = ost->enc_ctx->codec->pix_fmts;
+ const enum AVPixelFormat *fmts;
enum AVPixelFormat fmt;
+ int ret;
fmt = av_get_pix_fmt(name);
if (fmt == AV_PIX_FMT_NONE) {
@@ -547,6 +554,11 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
return AV_PIX_FMT_NONE;
}
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT,
+ 0, (const void **) &fmts);
+ if (ret < 0)
+ return AV_PIX_FMT_NONE;
+
/* when the user specified-format is an alias for an endianness-specific
* one (e.g. rgb48 -> rgb48be/le), it gets translated into the native
* endianness by av_get_pix_fmt();
@@ -574,7 +586,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
}
if (fmts && !fmt_in_list(fmts, fmt))
- fmt = choose_pixel_fmt(ost->enc_ctx->codec, fmt);
+ fmt = choose_pixel_fmt(ost->enc_ctx, fmt);
return fmt;
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (11 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 12/17] fftools/ffmpeg_mux_init: switch to avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-09 13:01 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts Niklas Haas
` (3 subsequent siblings)
16 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
For avcodec_get_supported_config(), which requires this value be set on
the actual ost->enc_ctx being queried.
---
fftools/ffmpeg_filter.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index ac04841a16c..9ff064f5f68 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -770,6 +770,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
FilterGraph *fg = ofilter->graph;
FilterGraphPriv *fgp = fgp_from_fg(fg);
const AVCodec *c = ost->enc_ctx->codec;
+ const AVDictionaryEntry *strict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
int ret;
av_assert0(!ofilter->ost);
@@ -780,6 +781,10 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofp->ts_offset = of->start_time == AV_NOPTS_VALUE ? 0 : of->start_time;
ofp->enc_timebase = ost->enc_timebase;
+ /* Ensure this is up-to-date for avcodefc_get_supported_config() */
+ if (strict)
+ av_opt_set(ost->enc_ctx, strict->key, strict->value, 0);
+
switch (ost->enc_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
ofp->width = ost->enc_ctx->width;
@@ -800,16 +805,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
{ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_NONE };
- const AVDictionaryEntry *strict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
- int strict_val = ost->enc_ctx->strict_std_compliance;
-
- if (strict) {
- const AVOption *o = av_opt_find(ost->enc_ctx, strict->key, NULL, 0, 0);
- av_assert0(o);
- av_opt_eval_int(ost->enc_ctx, o, strict->value, &strict_val);
- }
-
- if (strict_val > FF_COMPLIANCE_UNOFFICIAL)
+ if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
ofp->formats = mjpeg_formats;
}
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (12 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-10 1:13 ` Michael Niedermayer
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 15/17] fftools/ffmpeg_filter: switch to avcodec_get_supported_config() Niklas Haas
` (2 subsequent siblings)
16 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
The only meaningful difference between choose_pix_fmts and the default
code was the inclusion of an extra branch for `keep_pix_fmt` being true.
However, in this case, we either:
1. Force the specific `ofp->format` that we inherited from
ofilter_bind_ost, or if no format was set:
2. Print an empty format list
Both of these goals can be accomplished by simply moving the decision
logic to ofilter_bind_ost, to avoid setting any format list when
keep_pix_fmt is enabled. This is arguably cleaner as it moves format
selection logic to a single function. In the case of branch 1, nothing
else needs to be done as we already force the format provided in
ofp->format, if any is set. Add an assertion to verify this assumption
just in case.
(Side note: The "choose_*" family of functions are arguably misnomers,
as they should really be called "print_*" - their current behavior is to
print the relevant format lists to the `vf/af_format` filter arguments)
---
fftools/ffmpeg_filter.c | 49 ++++++++---------------------------------
1 file changed, 9 insertions(+), 40 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 9ff064f5f68..945147d6ca1 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -348,36 +348,6 @@ static void sub2video_update(InputFilterPriv *ifp, int64_t heartbeat_pts,
ifp->sub2video.initialize = 0;
}
-/* *dst may return be set to NULL (no pixel format found), a static string or a
- * string backed by the bprint. Nothing has been written to the AVBPrint in case
- * NULL is returned. The AVBPrint provided should be clean. */
-static int choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint,
- const char **dst)
-{
- OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
- OutputStream *ost = ofilter->ost;
-
- *dst = NULL;
-
- if (ost->keep_pix_fmt || ofp->format != AV_PIX_FMT_NONE) {
- *dst = ofp->format == AV_PIX_FMT_NONE ? NULL :
- av_get_pix_fmt_name(ofp->format);
- } else if (ofp->formats) {
- const enum AVPixelFormat *p = ofp->formats;
-
- for (; *p != AV_PIX_FMT_NONE; p++) {
- const char *name = av_get_pix_fmt_name(*p);
- av_bprintf(bprint, "%s%c", name, p[1] == AV_PIX_FMT_NONE ? '\0' : '|');
- }
- if (!av_bprint_is_complete(bprint))
- return AVERROR(ENOMEM);
-
- *dst = bprint->str;
- }
-
- return 0;
-}
-
/* Define a function for appending a list of allowed formats
* to an AVBPrint. If nonempty, the list will have a header. */
#define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name) \
@@ -400,8 +370,8 @@ static void choose_ ## name (OutputFilterPriv *ofp, AVBPrint *bprint) \
av_bprint_chars(bprint, ':', 1); \
}
-//DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, AV_PIX_FMT_NONE,
-// av_get_pix_fmt_name)
+DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats,
+ AV_PIX_FMT_NONE, "%s", av_get_pix_fmt_name)
DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name)
@@ -791,7 +761,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofp->height = ost->enc_ctx->height;
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
ofp->format = ost->enc_ctx->pix_fmt;
- } else {
+ } else if (!ost->keep_pix_fmt) {
ofp->formats = c->pix_fmts;
// MJPEG encoder exports a full list of supported pixel formats,
@@ -1307,7 +1277,6 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
AVBPrint bprint;
int pad_idx = out->pad_idx;
int ret;
- const char *pix_fmts;
char name[255];
snprintf(name, sizeof(name), "out_%d_%d", ost->file->index, ost->index);
@@ -1342,17 +1311,17 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
pad_idx = 0;
}
+ av_assert0(!ost->keep_pix_fmt || (!ofp->format && !ofp->formats));
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
- ret = choose_pix_fmts(ofilter, &bprint, &pix_fmts);
- if (ret < 0)
- return ret;
-
- if (pix_fmts) {
+ choose_pix_fmts(ofp, &bprint);
+ if (!av_bprint_is_complete(&bprint))
+ return AVERROR(ENOMEM);
+ if (bprint.len) {
AVFilterContext *filter;
ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
- "format", pix_fmts, NULL, graph);
+ "format", bprint.str, NULL, graph);
av_bprint_finalize(&bprint, NULL);
if (ret < 0)
return ret;
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 15/17] fftools/ffmpeg_filter: switch to avcodec_get_supported_config()
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (13 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 17/17] fftools/ffmpeg_filter: remove YUVJ hack Niklas Haas
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
I preserved the no-op condition on `!ch_layouts`, even though I suspect
it's not actually needed.
---
fftools/ffmpeg_filter.c | 59 ++++++++++++++++++++++++++++++++---------
1 file changed, 46 insertions(+), 13 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 945147d6ca1..83259416a68 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -694,7 +694,7 @@ static int ifilter_bind_dec(InputFilterPriv *ifp, Decoder *dec)
static int set_channel_layout(OutputFilterPriv *f, OutputStream *ost)
{
- const AVCodec *c = ost->enc_ctx->codec;
+ const AVChannelLayout *ch_layouts;
int i, err;
if (ost->enc_ctx->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
@@ -705,8 +705,14 @@ static int set_channel_layout(OutputFilterPriv *f, OutputStream *ost)
return 0;
}
+ err = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
+ (const void **) &ch_layouts);
+ if (err < 0)
+ return err;
+
/* Requested layout is of order UNSPEC */
- if (!c->ch_layouts) {
+ if (!ch_layouts) {
/* Use the default native layout for the requested amount of channels when the
encoder doesn't have a list of supported layouts */
av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels);
@@ -714,13 +720,13 @@ static int set_channel_layout(OutputFilterPriv *f, OutputStream *ost)
}
/* Encoder has a list of supported layouts. Pick the first layout in it with the
same amount of channels as the requested layout */
- for (i = 0; c->ch_layouts[i].nb_channels; i++) {
- if (c->ch_layouts[i].nb_channels == ost->enc_ctx->ch_layout.nb_channels)
+ for (i = 0; ch_layouts[i].nb_channels; i++) {
+ if (ch_layouts[i].nb_channels == ost->enc_ctx->ch_layout.nb_channels)
break;
}
- if (c->ch_layouts[i].nb_channels) {
+ if (ch_layouts[i].nb_channels) {
/* Use it if one is found */
- err = av_channel_layout_copy(&f->ch_layout, &c->ch_layouts[i]);
+ err = av_channel_layout_copy(&f->ch_layout, &ch_layouts[i]);
if (err < 0)
return err;
return 0;
@@ -762,7 +768,11 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
ofp->format = ost->enc_ctx->pix_fmt;
} else if (!ost->keep_pix_fmt) {
- ofp->formats = c->pix_fmts;
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_PIX_FORMAT, 0,
+ (const void **) &ofp->formats);
+ if (ret < 0)
+ return ret;
// MJPEG encoder exports a full list of supported pixel formats,
// but the full-range ones are experimental-only.
@@ -788,8 +798,16 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofp->fps.framerate = ost->frame_rate;
ofp->fps.framerate_max = ost->max_frame_rate;
- ofp->fps.framerate_supported = ost->force_fps ?
- NULL : c->supported_framerates;
+
+ if (ost->force_fps) {
+ ofp->fps.framerate_supported = NULL;
+ } else {
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_FRAME_RATE, 0,
+ (const void **) &ofp->fps.framerate_supported);
+ if (ret < 0)
+ return ret;
+ }
// reduce frame rate for mpeg4 to be within the spec limits
if (c->id == AV_CODEC_ID_MPEG4)
@@ -802,19 +820,34 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) {
ofp->format = ost->enc_ctx->sample_fmt;
} else {
- ofp->formats = c->sample_fmts;
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
+ (const void **) &ofp->formats);
+ if (ret < 0)
+ return ret;
}
if (ost->enc_ctx->sample_rate) {
ofp->sample_rate = ost->enc_ctx->sample_rate;
} else {
- ofp->sample_rates = c->supported_samplerates;
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_SAMPLE_RATE, 0,
+ (const void **) &ofp->sample_rates);
+ if (ret < 0)
+ return ret;
}
if (ost->enc_ctx->ch_layout.nb_channels) {
int ret = set_channel_layout(ofp, ost);
if (ret < 0)
return ret;
- } else if (c->ch_layouts) {
- ofp->ch_layouts = c->ch_layouts;
+ } else {
+ const AVChannelLayout *ch_layouts;
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
+ (const void **) &ch_layouts);
+ if (ret < 0)
+ return ret;
+ if (ch_layouts)
+ ofp->ch_layouts = ch_layouts;
}
break;
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (14 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 15/17] fftools/ffmpeg_filter: switch to avcodec_get_supported_config() Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
2024-04-10 1:25 ` Michael Niedermayer
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 17/17] fftools/ffmpeg_filter: remove YUVJ hack Niklas Haas
16 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
To convert between color spaces/ranges, if needed by the codec
properties.
---
fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 83259416a68..a40c6f381f2 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -193,6 +193,8 @@ typedef struct OutputFilterPriv {
int width, height;
int sample_rate;
AVChannelLayout ch_layout;
+ enum AVColorSpace color_space;
+ enum AVColorRange color_range;
// time base in which the output is sent to our downstream
// does not need to match the filtersink's timebase
@@ -208,6 +210,8 @@ typedef struct OutputFilterPriv {
const int *formats;
const AVChannelLayout *ch_layouts;
const int *sample_rates;
+ const enum AVColorSpace *color_spaces;
+ const enum AVColorRange *color_ranges;
AVRational enc_timebase;
// offset for output timestamps, in AV_TIME_BASE_Q
@@ -379,6 +383,12 @@ DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
"%d", )
+DEF_CHOOSE_FORMAT(color_spaces, enum AVColorSpace, color_space, color_spaces,
+ AVCOL_SPC_UNSPECIFIED, "%s", av_color_space_name);
+
+DEF_CHOOSE_FORMAT(color_ranges, enum AVColorRange, color_range, color_ranges,
+ AVCOL_RANGE_UNSPECIFIED, "%s", av_color_range_name);
+
static void choose_channel_layouts(OutputFilterPriv *ofp, AVBPrint *bprint)
{
if (av_channel_layout_check(&ofp->ch_layout)) {
@@ -607,6 +617,8 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg)
ofilter->graph = fg;
ofp->format = -1;
ofp->index = fg->nb_outputs - 1;
+ ofp->color_space = AVCOL_SPC_UNSPECIFIED;
+ ofp->color_range = AVCOL_RANGE_UNSPECIFIED;
return ofilter;
}
@@ -789,6 +801,24 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofp->formats = mjpeg_formats;
}
}
+ if (ost->enc_ctx->colorspace != AVCOL_SPC_UNSPECIFIED) {
+ ofp->color_space = ost->enc_ctx->colorspace;
+ } else {
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_COLOR_SPACE, 0,
+ (const void **) &ofp->color_spaces);
+ if (ret < 0)
+ return ret;
+ }
+ if (ost->enc_ctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
+ ofp->color_range = ost->enc_ctx->color_range;
+ } else {
+ ret = avcodec_get_supported_config(ost->enc_ctx, NULL,
+ AV_CODEC_CONFIG_COLOR_RANGE, 0,
+ (const void **) &ofp->color_ranges);
+ if (ret < 0)
+ return ret;
+ }
fgp->disable_conversions |= ost->keep_pix_fmt;
@@ -1347,6 +1377,8 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
av_assert0(!ost->keep_pix_fmt || (!ofp->format && !ofp->formats));
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
choose_pix_fmts(ofp, &bprint);
+ choose_color_spaces(ofp, &bprint);
+ choose_color_ranges(ofp, &bprint);
if (!av_bprint_is_complete(&bprint))
return AVERROR(ENOMEM);
if (bprint.len) {
@@ -1777,6 +1809,8 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
ofp->width = av_buffersink_get_w(sink);
ofp->height = av_buffersink_get_h(sink);
+ ofp->color_space = av_buffersink_get_colorspace(sink);
+ ofp->color_range = av_buffersink_get_color_range(sink);
// If the timing parameters are not locked yet, get the tentative values
// here but don't lock them. They will only be used if no output frames
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* [FFmpeg-devel] [PATCH v2 17/17] fftools/ffmpeg_filter: remove YUVJ hack
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
` (15 preceding siblings ...)
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters Niklas Haas
@ 2024-04-08 12:57 ` Niklas Haas
16 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-08 12:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
This is no longer needed, since we now correctly negotiate the required
range from the mjpeg encoder via avcodec_get_supported_config().
---
fftools/ffmpeg_filter.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index a40c6f381f2..461f2b86065 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -785,21 +785,6 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
(const void **) &ofp->formats);
if (ret < 0)
return ret;
-
- // MJPEG encoder exports a full list of supported pixel formats,
- // but the full-range ones are experimental-only.
- // Restrict the auto-conversion list unless -strict experimental
- // has been specified.
- if (!strcmp(c->name, "mjpeg")) {
- // FIXME: YUV420P etc. are actually supported with full color range,
- // yet the latter information isn't available here.
- static const enum AVPixelFormat mjpeg_formats[] =
- { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
- AV_PIX_FMT_NONE };
-
- if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
- ofp->formats = mjpeg_formats;
- }
}
if (ost->enc_ctx->colorspace != AVCOL_SPC_UNSPECIFIED) {
ofp->color_space = ost->enc_ctx->colorspace;
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data()
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data() Niklas Haas
@ 2024-04-09 13:00 ` Niklas Haas
0 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-09 13:00 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
On Mon, 08 Apr 2024 14:57:13 +0200 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> From: Niklas Haas <git@haasn.dev>
>
> All hail get_supported_config()
> ---
> libavcodec/allcodecs.c | 7 +------
> libavcodec/codec_internal.h | 8 --------
> 2 files changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index a9f1797930a..1f22e06e710 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -916,13 +916,8 @@ static AVOnce av_codec_static_init = AV_ONCE_INIT;
> static void av_codec_init_static(void)
> {
> for (int i = 0; codec_list[i]; i++) {
> - const FFCodec *codec = codec_list[i];
> - if (codec->init_static_data) {
> - codec->init_static_data((FFCodec*) codec);
> - continue;
> - }
> -
> /* Backward compatibility with deprecated public fields */
> + const FFCodec *codec = codec_list[i];
> if (!codec->get_supported_config)
> continue;
>
> diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
> index bac3e30ba2c..d3033db3375 100644
> --- a/libavcodec/codec_internal.h
> +++ b/libavcodec/codec_internal.h
> @@ -174,14 +174,6 @@ typedef struct FFCodec {
> */
> const FFCodecDefault *defaults;
>
> - /**
> - * Initialize codec static data, called from av_codec_iterate().
> - *
> - * This is not intended for time consuming operations as it is
> - * run for every codec regardless of that codec being used.
> - */
> - void (*init_static_data)(struct FFCodec *codec);
> -
> int (*init)(struct AVCodecContext *);
>
> union {
> --
> 2.44.0
>
Note: This depends on my other series for dropping init_static_data from
libx264.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance Niklas Haas
@ 2024-04-09 13:01 ` Niklas Haas
0 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-09 13:01 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
On Mon, 08 Apr 2024 14:57:17 +0200 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> From: Niklas Haas <git@haasn.dev>
>
> For avcodec_get_supported_config(), which requires this value be set on
> the actual ost->enc_ctx being queried.
> ---
> fftools/ffmpeg_filter.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index ac04841a16c..9ff064f5f68 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -770,6 +770,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
> FilterGraph *fg = ofilter->graph;
> FilterGraphPriv *fgp = fgp_from_fg(fg);
> const AVCodec *c = ost->enc_ctx->codec;
> + const AVDictionaryEntry *strict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
> int ret;
>
> av_assert0(!ofilter->ost);
> @@ -780,6 +781,10 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
> ofp->ts_offset = of->start_time == AV_NOPTS_VALUE ? 0 : of->start_time;
> ofp->enc_timebase = ost->enc_timebase;
>
> + /* Ensure this is up-to-date for avcodefc_get_supported_config() */
> + if (strict)
> + av_opt_set(ost->enc_ctx, strict->key, strict->value, 0);
> +
> switch (ost->enc_ctx->codec_type) {
> case AVMEDIA_TYPE_VIDEO:
> ofp->width = ost->enc_ctx->width;
> @@ -800,16 +805,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
> { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
> AV_PIX_FMT_NONE };
>
> - const AVDictionaryEntry *strict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
> - int strict_val = ost->enc_ctx->strict_std_compliance;
> -
> - if (strict) {
> - const AVOption *o = av_opt_find(ost->enc_ctx, strict->key, NULL, 0, 0);
> - av_assert0(o);
> - av_opt_eval_int(ost->enc_ctx, o, strict->value, &strict_val);
> - }
> -
> - if (strict_val > FF_COMPLIANCE_UNOFFICIAL)
> + if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
> ofp->formats = mjpeg_formats;
> }
> }
> --
> 2.44.0
>
Note: Will be no longer needed if elenril's encoder_opts series is
merged first, so that would be preferred as this is sort of a hack.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts Niklas Haas
@ 2024-04-10 1:13 ` Michael Niedermayer
2024-04-10 11:23 ` Niklas Haas
0 siblings, 1 reply; 30+ messages in thread
From: Michael Niedermayer @ 2024-04-10 1:13 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1843 bytes --]
On Mon, Apr 08, 2024 at 02:57:18PM +0200, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
>
> The only meaningful difference between choose_pix_fmts and the default
> code was the inclusion of an extra branch for `keep_pix_fmt` being true.
>
> However, in this case, we either:
> 1. Force the specific `ofp->format` that we inherited from
> ofilter_bind_ost, or if no format was set:
> 2. Print an empty format list
>
> Both of these goals can be accomplished by simply moving the decision
> logic to ofilter_bind_ost, to avoid setting any format list when
> keep_pix_fmt is enabled. This is arguably cleaner as it moves format
> selection logic to a single function. In the case of branch 1, nothing
> else needs to be done as we already force the format provided in
> ofp->format, if any is set. Add an assertion to verify this assumption
> just in case.
>
> (Side note: The "choose_*" family of functions are arguably misnomers,
> as they should really be called "print_*" - their current behavior is to
> print the relevant format lists to the `vf/af_format` filter arguments)
> ---
> fftools/ffmpeg_filter.c | 49 ++++++++---------------------------------
> 1 file changed, 9 insertions(+), 40 deletions(-)
breaks:
./ffmpeg -y -i fate-suite/lena.pnm -pix_fmt +yuv444p -vf scale -strict -1 -bitexact -threads 2 -thread_type slice /tmp/file-2s-444.jpg
Press [q] to stop, [?] for help
Assertion !ost->keep_pix_fmt || (!ofp->format && !ofp->formats) failed at fftools/ffmpeg_filter.c:1314
Aborted (core dumped)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters Niklas Haas
@ 2024-04-10 1:25 ` Michael Niedermayer
2024-04-10 10:29 ` Niklas Haas
0 siblings, 1 reply; 30+ messages in thread
From: Michael Niedermayer @ 2024-04-10 1:25 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 824 bytes --]
On Mon, Apr 08, 2024 at 02:57:20PM +0200, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
>
> To convert between color spaces/ranges, if needed by the codec
> properties.
> ---
> fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
I presume this is intended to change some cases
iam asking because it does
for example, this one
-i aletrek.mkv -t 1 -bitexact /tmp/file-aletrek-palette.mkv
has the output file change slightly
https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
also given fate does not change, it would make sense to add a testcase
to fate that does cover this
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
What does censorship reveal? It reveals fear. -- Julian Assange
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 1:25 ` Michael Niedermayer
@ 2024-04-10 10:29 ` Niklas Haas
2024-04-10 10:31 ` Niklas Haas
2024-04-10 12:59 ` Michael Niedermayer
0 siblings, 2 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-10 10:29 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 10 Apr 2024 03:25:45 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Mon, Apr 08, 2024 at 02:57:20PM +0200, Niklas Haas wrote:
> > From: Niklas Haas <git@haasn.dev>
> >
> > To convert between color spaces/ranges, if needed by the codec
> > properties.
> > ---
> > fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 34 insertions(+)
>
> I presume this is intended to change some cases
> iam asking because it does
> for example, this one
> -i aletrek.mkv -t 1 -bitexact /tmp/file-aletrek-palette.mkv
> has the output file change slightly
>
> https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
>
> also given fate does not change, it would make sense to add a testcase
> to fate that does cover this
Two notes:
1. The only difference between the `master` behavior and the new
behavior is that the file is marked as limited range instead of as
unspecified. However, this is the correct tagging, as the actual
output *is* limited range.
2. While not *broken* per se, this is actually still a bug - in this
case, since the input is basically full range, we should actually try
and output full range by default.
The reason it doesn't output full range here is because a consequence of
the fact that format reduction happens *before* the logic in
pick_format() fixes all non-YUV links to be tagged as PC/RGB-only. So
the format reduction logic just sees that vf_scale can output any range
in this scenario (true) and picks TV range output as the default,
resulting in a conversion from the PC range input to a TV range output.
The easiest solution would be to not blindly pick the first here, but to
instead try and pick a colorspace and range matching the input (if one
exists). But this may still break in more complicated scenarios where
the dependence on the forced format spans several filters.
The more correct solution would probably be to explicitly reduce only
the format first (going through all the steps) and then negotiate
everything that depends on the format in an entirely separate step.
I'll see if I can do something about this situation, though it's
ultimately not a high priority as it's not a regression compared to the
status quo - just something that we could definitely improve.
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> What does censorship reveal? It reveals fear. -- Julian Assange
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 10:29 ` Niklas Haas
@ 2024-04-10 10:31 ` Niklas Haas
2024-04-10 12:59 ` Michael Niedermayer
1 sibling, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-10 10:31 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 10 Apr 2024 12:29:06 +0200 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> On Wed, 10 Apr 2024 03:25:45 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> > On Mon, Apr 08, 2024 at 02:57:20PM +0200, Niklas Haas wrote:
> > > From: Niklas Haas <git@haasn.dev>
> > >
> > > To convert between color spaces/ranges, if needed by the codec
> > > properties.
> > > ---
> > > fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
> > > 1 file changed, 34 insertions(+)
> >
> > I presume this is intended to change some cases
> > iam asking because it does
> > for example, this one
> > -i aletrek.mkv -t 1 -bitexact /tmp/file-aletrek-palette.mkv
> > has the output file change slightly
> >
> > https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
> >
> > also given fate does not change, it would make sense to add a testcase
> > to fate that does cover this
>
> Two notes:
>
> 1. The only difference between the `master` behavior and the new
> behavior is that the file is marked as limited range instead of as
> unspecified. However, this is the correct tagging, as the actual
> output *is* limited range.
>
> 2. While not *broken* per se, this is actually still a bug - in this
> case, since the input is basically full range, we should actually try
> and output full range by default.
>
> The reason it doesn't output full range here is because a consequence of
> the fact that format reduction happens *before* the logic in
> pick_format() fixes all non-YUV links to be tagged as PC/RGB-only. So
> the format reduction logic just sees that vf_scale can output any range
> in this scenario (true) and picks TV range output as the default,
> resulting in a conversion from the PC range input to a TV range output.
>
> The easiest solution would be to not blindly pick the first here, but to
> instead try and pick a colorspace and range matching the input (if one
> exists). But this may still break in more complicated scenarios where
> the dependence on the forced format spans several filters.
>
> The more correct solution would probably be to explicitly reduce only
> the format first (going through all the steps) and then negotiate
> everything that depends on the format in an entirely separate step.
>
> I'll see if I can do something about this situation, though it's
> ultimately not a high priority as it's not a regression compared to the
> status quo - just something that we could definitely improve.
Alternatively, a third simple fix would be to make buffersrc explicitly
request PC range in this scenario (e.g. RGB/PAL8 input), but that feels
like a sort of a hack.
>
> >
> > thx
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > What does censorship reveal? It reveals fear. -- Julian Assange
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts
2024-04-10 1:13 ` Michael Niedermayer
@ 2024-04-10 11:23 ` Niklas Haas
0 siblings, 0 replies; 30+ messages in thread
From: Niklas Haas @ 2024-04-10 11:23 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 10 Apr 2024 03:13:02 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Mon, Apr 08, 2024 at 02:57:18PM +0200, Niklas Haas wrote:
> > From: Niklas Haas <git@haasn.dev>
> >
> > The only meaningful difference between choose_pix_fmts and the default
> > code was the inclusion of an extra branch for `keep_pix_fmt` being true.
> >
> > However, in this case, we either:
> > 1. Force the specific `ofp->format` that we inherited from
> > ofilter_bind_ost, or if no format was set:
> > 2. Print an empty format list
> >
> > Both of these goals can be accomplished by simply moving the decision
> > logic to ofilter_bind_ost, to avoid setting any format list when
> > keep_pix_fmt is enabled. This is arguably cleaner as it moves format
> > selection logic to a single function. In the case of branch 1, nothing
> > else needs to be done as we already force the format provided in
> > ofp->format, if any is set. Add an assertion to verify this assumption
> > just in case.
> >
> > (Side note: The "choose_*" family of functions are arguably misnomers,
> > as they should really be called "print_*" - their current behavior is to
> > print the relevant format lists to the `vf/af_format` filter arguments)
> > ---
> > fftools/ffmpeg_filter.c | 49 ++++++++---------------------------------
> > 1 file changed, 9 insertions(+), 40 deletions(-)
>
> breaks:
> ./ffmpeg -y -i fate-suite/lena.pnm -pix_fmt +yuv444p -vf scale -strict -1 -bitexact -threads 2 -thread_type slice /tmp/file-2s-444.jpg
>
> Press [q] to stop, [?] for help
> Assertion !ost->keep_pix_fmt || (!ofp->format && !ofp->formats) failed at fftools/ffmpeg_filter.c:1314
> Aborted (core dumped)
My bad, I cherry-picked the wrong version of this commit.
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 2
> "100% positive feedback" - "All either got their money back or didnt complain"
> "Best seller ever, very honest" - "Seller refunded buyer after failed scam"
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 10:29 ` Niklas Haas
2024-04-10 10:31 ` Niklas Haas
@ 2024-04-10 12:59 ` Michael Niedermayer
2024-04-10 13:10 ` Niklas Haas
1 sibling, 1 reply; 30+ messages in thread
From: Michael Niedermayer @ 2024-04-10 12:59 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 3953 bytes --]
On Wed, Apr 10, 2024 at 12:29:06PM +0200, Niklas Haas wrote:
> On Wed, 10 Apr 2024 03:25:45 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> > On Mon, Apr 08, 2024 at 02:57:20PM +0200, Niklas Haas wrote:
> > > From: Niklas Haas <git@haasn.dev>
> > >
> > > To convert between color spaces/ranges, if needed by the codec
> > > properties.
> > > ---
> > > fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
> > > 1 file changed, 34 insertions(+)
> >
> > I presume this is intended to change some cases
> > iam asking because it does
> > for example, this one
> > -i aletrek.mkv -t 1 -bitexact /tmp/file-aletrek-palette.mkv
> > has the output file change slightly
> >
> > https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
> >
> > also given fate does not change, it would make sense to add a testcase
> > to fate that does cover this
>
> Two notes:
>
> 1. The only difference between the `master` behavior and the new
> behavior is that the file is marked as limited range instead of as
> unspecified. However, this is the correct tagging, as the actual
> output *is* limited range.
>
> 2. While not *broken* per se, this is actually still a bug - in this
> case, since the input is basically full range, we should actually try
> and output full range by default.
>
> The reason it doesn't output full range here is because a consequence of
> the fact that format reduction happens *before* the logic in
> pick_format() fixes all non-YUV links to be tagged as PC/RGB-only. So
> the format reduction logic just sees that vf_scale can output any range
> in this scenario (true) and picks TV range output as the default,
> resulting in a conversion from the PC range input to a TV range output.
>
> The easiest solution would be to not blindly pick the first here, but to
> instead try and pick a colorspace and range matching the input (if one
> exists). But this may still break in more complicated scenarios where
> the dependence on the forced format spans several filters.
>
> The more correct solution would probably be to explicitly reduce only
> the format first (going through all the steps) and then negotiate
> everything that depends on the format in an entirely separate step.
>
> I'll see if I can do something about this situation, though it's
> ultimately not a high priority as it's not a regression compared to the
> status quo - just something that we could definitely improve.
I have the feeling the colorspace negotiation has become a bit messy
IIRC The way it was intended to work originally was to have a
arbitrary filtergraph and then randomly simplify/merge bits of the
filtergraph before picking "colorspaces" for each part.
Then repeat this whole process a few times starting from the unsimplified
graph. Then pick the best and that would be within a constant factor
of the optimal solution for any arbitrary complex graph.
Somehow this was never implemented as things worked okesich with just
doing a single pass instead of multiple and then picking the best.
I dont know how much this applies here now but i thought bringing
up the original intended design was a good idea. Because it seems
every problem in the negotiation is solved by adjusting the single pass
steps or its orders while really it should have been multiple randomized
passes.
Maybe we never have to deal with complex enough filtergraphs where a single
pass cant be made to work well and surely this here is not a complex one
at all.
But wanted to bring this up anyway because i think many people forgot
or didnt even know the original idea was to do multiple passes so as to
handle any arbitrary complex graph well.
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 12:59 ` Michael Niedermayer
@ 2024-04-10 13:10 ` Niklas Haas
2024-04-10 13:12 ` Nicolas George
0 siblings, 1 reply; 30+ messages in thread
From: Niklas Haas @ 2024-04-10 13:10 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 10 Apr 2024 14:59:15 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Wed, Apr 10, 2024 at 12:29:06PM +0200, Niklas Haas wrote:
> > On Wed, 10 Apr 2024 03:25:45 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> > > On Mon, Apr 08, 2024 at 02:57:20PM +0200, Niklas Haas wrote:
> > > > From: Niklas Haas <git@haasn.dev>
> > > >
> > > > To convert between color spaces/ranges, if needed by the codec
> > > > properties.
> > > > ---
> > > > fftools/ffmpeg_filter.c | 34 ++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 34 insertions(+)
> > >
> > > I presume this is intended to change some cases
> > > iam asking because it does
> > > for example, this one
> > > -i aletrek.mkv -t 1 -bitexact /tmp/file-aletrek-palette.mkv
> > > has the output file change slightly
> > >
> > > https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
> > >
> > > also given fate does not change, it would make sense to add a testcase
> > > to fate that does cover this
> >
> > Two notes:
> >
> > 1. The only difference between the `master` behavior and the new
> > behavior is that the file is marked as limited range instead of as
> > unspecified. However, this is the correct tagging, as the actual
> > output *is* limited range.
> >
> > 2. While not *broken* per se, this is actually still a bug - in this
> > case, since the input is basically full range, we should actually try
> > and output full range by default.
> >
> > The reason it doesn't output full range here is because a consequence of
> > the fact that format reduction happens *before* the logic in
> > pick_format() fixes all non-YUV links to be tagged as PC/RGB-only. So
> > the format reduction logic just sees that vf_scale can output any range
> > in this scenario (true) and picks TV range output as the default,
> > resulting in a conversion from the PC range input to a TV range output.
> >
> > The easiest solution would be to not blindly pick the first here, but to
> > instead try and pick a colorspace and range matching the input (if one
> > exists). But this may still break in more complicated scenarios where
> > the dependence on the forced format spans several filters.
> >
> > The more correct solution would probably be to explicitly reduce only
> > the format first (going through all the steps) and then negotiate
> > everything that depends on the format in an entirely separate step.
> >
> > I'll see if I can do something about this situation, though it's
> > ultimately not a high priority as it's not a regression compared to the
> > status quo - just something that we could definitely improve.
>
> I have the feeling the colorspace negotiation has become a bit messy
> IIRC The way it was intended to work originally was to have a
> arbitrary filtergraph and then randomly simplify/merge bits of the
> filtergraph before picking "colorspaces" for each part.
> Then repeat this whole process a few times starting from the unsimplified
> graph. Then pick the best and that would be within a constant factor
> of the optimal solution for any arbitrary complex graph.
>
> Somehow this was never implemented as things worked okesich with just
> doing a single pass instead of multiple and then picking the best.
>
> I dont know how much this applies here now but i thought bringing
> up the original intended design was a good idea. Because it seems
> every problem in the negotiation is solved by adjusting the single pass
> steps or its orders while really it should have been multiple randomized
> passes.
> Maybe we never have to deal with complex enough filtergraphs where a single
> pass cant be made to work well and surely this here is not a complex one
> at all.
> But wanted to bring this up anyway because i think many people forgot
> or didnt even know the original idea was to do multiple passes so as to
> handle any arbitrary complex graph well.
I think a greedy algorithm (not requiring juggling multiple random
passes) can still work, just that we need to change the logic from:
do
// step 1
while (progress)
do
// step 2
while (progress)
...
to:
do {
// step 1
// step 2
...
} while (any_progress)
In any case, the realization is clear that we can no longer rely on
negotiating everything at the same time, as we now have a fundamental
interdependency of one negotiated component on another. (And I can
easily see more such dependencies being added in the future)
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you think the mosad wants you dead since a long time then you are either
> wrong or dead since a long time.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 13:10 ` Niklas Haas
@ 2024-04-10 13:12 ` Nicolas George
2024-04-11 7:45 ` Paul B Mahol
0 siblings, 1 reply; 30+ messages in thread
From: Nicolas George @ 2024-04-10 13:12 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Niklas Haas (12024-04-10):
> I think a greedy algorithm (not requiring juggling multiple random
> passes) can still work,
It does not work for audio. Have you studied what works for audio? It is
quite subtle and full of pitfalls.
Regards,
--
Nicolas George
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters
2024-04-10 13:12 ` Nicolas George
@ 2024-04-11 7:45 ` Paul B Mahol
0 siblings, 0 replies; 30+ messages in thread
From: Paul B Mahol @ 2024-04-11 7:45 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Apr 10, 2024 at 3:12 PM Nicolas George <george@nsup.org> wrote:
> Niklas Haas (12024-04-10):
> > I think a greedy algorithm (not requiring juggling multiple random
> > passes) can still work,
>
> It does not work for audio. Have you studied what works for audio? It is
> quite subtle and full of pitfalls.
>
This is ultra-vague. And needs further explanations.
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config()
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config() Niklas Haas
@ 2024-08-01 1:48 ` Andreas Rheinhardt
0 siblings, 0 replies; 30+ messages in thread
From: Andreas Rheinhardt @ 2024-08-01 1:48 UTC (permalink / raw)
To: ffmpeg-devel
Niklas Haas:
> From: Niklas Haas <git@haasn.dev>
>
> This replaces the myriad of existing lists in AVCodec by a unified API
> call, allowing us to (ultimately) trim down the sizeof(AVCodec) quite
> substantially, while also making this more trivially extensible.
>
> In addition to the already covered lists, add two new entries for color
> space and color range, mirroring the newly added negotiable fields in
> libavfilter.
>
> I decided to drop the explicit length field from the API proposed by
> Andreas Rheinhardt, because having it in place ended up complicating
> both the codec side and the client side implementations, while also
> being strictly less flexible (it's trivial to recover a length given
> a terminator, but requires allocation to add a terminator given
> a length). Using a terminator also presents less of a porting challenge
> for existing users of the current API.
>
> Once the deprecation period passes for the existing public fields, the
> rough plan is to move the commonly used fields (such as
> pix_fmt/sample_fmt) into FFCodec, possibly as a union of audio and video
> configuration types, and then implement the rarely used fields with
> custom callbacks.
> ---
> doc/APIchanges | 5 +++
> libavcodec/avcodec.c | 75 +++++++++++++++++++++++++++++++++++++
> libavcodec/avcodec.h | 27 +++++++++++++
> libavcodec/codec.h | 19 ++++++++--
> libavcodec/codec_internal.h | 24 ++++++++++++
> libavcodec/version.h | 4 +-
> 6 files changed, 148 insertions(+), 6 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 0a39b6d7ab8..fdeae67159d 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07
>
> API changes, most recent first:
>
> +2024-04-xx - xxxxxxxxxx - lavc 59.6.100 - avcodec.h
> + Add avcodec_get_supported_config() and enum AVCodecConfig; deprecate
> + AVCodec.pix_fmts, AVCodec.sample_fmts, AVCodec.supported_framerates,
> + AVCodec.supported_samplerates and AVCodec.ch_layouts.
> +
> 2024-04-03 - xxxxxxxxxx - lavu 59.13.100 - pixfmt.h
> Add AVCOL_SPC_IPT_C2, AVCOL_SPC_YCGCO_RE and AVCOL_SPC_YCGCO_RO
> to map new matrix coefficients defined by H.273 v3.
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index 525fe516bd2..96728546d6c 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -700,3 +700,78 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
> return ff_decode_receive_frame(avctx, frame);
> return ff_encode_receive_frame(avctx, frame);
> }
> +
> +#define WRAP_CONFIG(allowed_type, field) \
> + do { \
> + if (codec->type != (allowed_type)) \
> + return AVERROR(EINVAL); \
> + *out_configs = (field); \
> + return 0; \
> + } while (0)
> +
> +static const enum AVColorRange color_range_jpeg[] = {
> + AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED
> +};
> +
> +static const enum AVColorRange color_range_mpeg[] = {
> + AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED
> +};
> +
> +static const enum AVColorRange color_range_all[] = {
> + AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED
> +};
> +
> +static const enum AVColorRange *color_range_table[] = {
> + [AVCOL_RANGE_MPEG] = color_range_mpeg,
> + [AVCOL_RANGE_JPEG] = color_range_jpeg,
> + [AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG] = color_range_all,
> +};
> +
> +int ff_default_get_supported_config(const AVCodecContext *avctx,
> + const AVCodec *codec,
> + enum AVCodecConfig config,
> + unsigned flags,
> + const void **out_configs)
> +{
> + switch (config) {
> +FF_DISABLE_DEPRECATION_WARNINGS
> + case AV_CODEC_CONFIG_PIX_FORMAT:
> + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->pix_fmts);
> + case AV_CODEC_CONFIG_FRAME_RATE:
> + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->supported_framerates);
> + case AV_CODEC_CONFIG_SAMPLE_RATE:
> + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->supported_samplerates);
> + case AV_CODEC_CONFIG_SAMPLE_FORMAT:
> + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->sample_fmts);
> + case AV_CODEC_CONFIG_CHANNEL_LAYOUT:
> + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->ch_layouts);
> +FF_ENABLE_DEPRECATION_WARNINGS
> +
> + case AV_CODEC_CONFIG_COLOR_RANGE:
> + if (codec->type != AVMEDIA_TYPE_VIDEO)
> + return AVERROR(EINVAL);
> + *out_configs = color_range_table[ffcodec(codec)->color_ranges];
> + return 0;
> +
> + case AV_CODEC_CONFIG_COLOR_SPACE:
> + *out_configs = NULL;
> + return 0;
> + default:
> + return AVERROR(EINVAL);
> + }
> +}
> +
> +int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec,
> + enum AVCodecConfig config, unsigned flags,
> + const void **out)
> +{
> + const FFCodec *codec2;
> + if (!codec)
> + codec = avctx->codec;
> + codec2 = ffcodec(codec);
> + if (codec2->get_supported_config) {
> + return codec2->get_supported_config(avctx, codec, config, flags, out);
> + } else {
> + return ff_default_get_supported_config(avctx, codec, config, flags, out);
> + }
> +}
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 83dc487251c..64f31375fc6 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2690,6 +2690,33 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
> enum AVPixelFormat hw_pix_fmt,
> AVBufferRef **out_frames_ref);
>
> +enum AVCodecConfig {
> + AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE
> + AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0}
> + AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 0
> + AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE
> + AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}
> + AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED
> + AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED
> +};
> +
> +/**
> + * Retrieve a list of all supported values for a given configuration type.
> + *
> + * @param avctx An optional context to use. Values such as
> + * `strict_std_compliance` may affect the result. If NULL,
> + * default values are used.
> + * @param codec The codec to query, or NULL to use avctx->codec.
> + * @param config The configuration to query.
> + * @param flags Currently unused; should be set to zero.
> + * @param out_configs On success, set to a list of configurations, terminated
> + * by a config-specific terminator, or NULL if all
> + * possible values are supported.
> + */
> +int avcodec_get_supported_config(const AVCodecContext *avctx,
> + const AVCodec *codec, enum AVCodecConfig config,
> + unsigned flags, const void **out_configs);
1. This approach constrains us in several ways, most notably it forces
us to always have static lists for every possible combination. E.g. take
a look at the wavpack encoder: It accepts certain native channel layouts
or certain unspecified channel counts within a range (the encoder
accepts up to 255, the format allows up to 4096). It makes no sense to
have a static list of 4096 unspecified channel layouts. Getting rid of
this requirement seems good, even if it causes allocations.
2. A length field is not "strictly less flexible", to the contrary: It
allows to keep our options open. The length field should be optional and
for the convenience of the user (meaning the list would still be
terminated by a sentinel). But it would allow to e.g. add a flag in the
future that says that *out_configs is already set to some array whose
length is given by the length field which would allow to avoid the
allocation that I just proposed in 1. (e.g. the number of sample formats
is very small and can be put into a stack array; the number of pixel
formats is also small and can be queried at runtime, so that an array of
maximum size can be allocated once to query multiple codecs).
> +
>
>
> /**
> diff --git a/libavcodec/codec.h b/libavcodec/codec.h
> index 6f9b42760d7..f7541ffc42b 100644
> --- a/libavcodec/codec.h
> +++ b/libavcodec/codec.h
> @@ -205,10 +205,19 @@ typedef struct AVCodec {
> */
> int capabilities;
> uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
> - const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
> - const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
> - const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
> - const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
> +
> + /**
> + * Deprecated codec capabilities.
> + */
> + attribute_deprecated
> + const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config()
> + attribute_deprecated
> + const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config()
> + attribute_deprecated
> + const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config()
> + attribute_deprecated
> + const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config()
> +
> const AVClass *priv_class; ///< AVClass for the private context
> const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
>
> @@ -226,7 +235,9 @@ typedef struct AVCodec {
>
> /**
> * Array of supported channel layouts, terminated with a zeroed layout.
> + * @deprecated use avcodec_get_supported_config()
> */
> + attribute_deprecated
> const AVChannelLayout *ch_layouts;
> } AVCodec;
>
> diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
> index 2134f184094..bac3e30ba2c 100644
> --- a/libavcodec/codec_internal.h
> +++ b/libavcodec/codec_internal.h
> @@ -22,6 +22,7 @@
> #include <stdint.h>
>
> #include "libavutil/attributes.h"
> +#include "avcodec.h"
> #include "codec.h"
> #include "config.h"
>
> @@ -270,8 +271,31 @@ typedef struct FFCodec {
> * List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
> */
> const uint32_t *codec_tags;
> +
> + /**
> + * Custom callback for avcodec_get_supported_config(). If absent,
> + * ff_default_get_supported_config() will be used.
> + */
> + int (*get_supported_config)(const AVCodecContext *avctx,
> + const AVCodec *codec,
> + enum AVCodecConfig config,
> + unsigned flags,
> + const void **out_configs);
> } FFCodec;
>
> +/**
> + * Default implementation for avcodec_get_supported_config(). Will return the
> + * relevant fields from AVCodec if present, or NULL otherwise.
> + *
> + * For AVCODEC_CONFIG_COLOR_RANGE, the output will depend on the bitmask in
> + * FFCodec.color_ranges, with a value of 0 returning NULL.
> + */
> +int ff_default_get_supported_config(const AVCodecContext *avctx,
> + const AVCodec *codec,
> + enum AVCodecConfig config,
> + unsigned flags,
> + const void **out_configs);
> +
> #if CONFIG_SMALL
> #define CODEC_LONG_NAME(str) .p.long_name = NULL
> #else
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 84a1c02ce4a..da54f878874 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,8 +29,8 @@
>
> #include "version_major.h"
>
> -#define LIBAVCODEC_VERSION_MINOR 5
> -#define LIBAVCODEC_VERSION_MICRO 101
> +#define LIBAVCODEC_VERSION_MINOR 6
> +#define LIBAVCODEC_VERSION_MICRO 100
>
> #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> LIBAVCODEC_VERSION_MINOR, \
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2024-08-01 1:48 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 12:57 [FFmpeg-devel] [PATCH v2 00/17] Add avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 01/17] avcodec/internal: add FFCodec.color_ranges Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 02/17] avcodec: add avcodec_get_supported_config() Niklas Haas
2024-08-01 1:48 ` Andreas Rheinhardt
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 03/17] avcodec/encode: switch to avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 04/17] avcodec/allcodecs: add backcompat for new config API Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 05/17] avcodec/libx265: switch to get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 06/17] avcodec/libvpxenc: " Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 07/17] avcodec/libaomenc: " Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 08/17] avcodec/mjpegenc: " Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 09/17] avcodec/codec_internal: nuke init_static_data() Niklas Haas
2024-04-09 13:00 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 10/17] fftools/opt_common: switch to avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 11/17] fftools: drop unused/hacky macros Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 12/17] fftools/ffmpeg_mux_init: switch to avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 13/17] fftools/ffmpeg_filter: set strict_std_compliance Niklas Haas
2024-04-09 13:01 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 14/17] fftools/ffmpeg_filter: simplify choose_pix_fmts Niklas Haas
2024-04-10 1:13 ` Michael Niedermayer
2024-04-10 11:23 ` Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 15/17] fftools/ffmpeg_filter: switch to avcodec_get_supported_config() Niklas Haas
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 16/17] fftools/ffmpeg_filter: propagate codec yuv metadata to filters Niklas Haas
2024-04-10 1:25 ` Michael Niedermayer
2024-04-10 10:29 ` Niklas Haas
2024-04-10 10:31 ` Niklas Haas
2024-04-10 12:59 ` Michael Niedermayer
2024-04-10 13:10 ` Niklas Haas
2024-04-10 13:12 ` Nicolas George
2024-04-11 7:45 ` Paul B Mahol
2024-04-08 12:57 ` [FFmpeg-devel] [PATCH v2 17/17] fftools/ffmpeg_filter: remove YUVJ hack Niklas Haas
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git