* [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled @ 2024-03-31 5:30 Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 02/10] avcodec/tiff: Don't cast const away via bsearch Andreas Rheinhardt ` (10 more replies) 0 siblings, 11 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:30 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/libvpxenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 635cdf7a0e..bcbdc4981e 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -49,6 +49,9 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) + /** * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. * One encoded frame returned from the library. @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, FrameData fd = { .pts = frame->pts }; int ret; -#if CONFIG_LIBVPX_VP9_ENCODER - if (avctx->codec_id == AV_CODEC_ID_VP9 && + if (IS_VP9(avctx) && // Keep HDR10+ if it has bit depth higher than 8 and // it has PQ trc (SMPTE2084). enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) { @@ -372,7 +374,6 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, return AVERROR(ENOMEM); } } -#endif fd.duration = frame->duration; fd.frame_opaque = frame->opaque; -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 02/10] avcodec/tiff: Don't cast const away via bsearch 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 03/10] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible Andreas Rheinhardt ` (9 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 1b934457b5..19301d9e49 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -176,7 +176,7 @@ static int cmp_id_key(const void *id, const void *k) static const char *search_keyval(const TiffGeoTagKeyName *keys, int n, int id) { - TiffGeoTagKeyName *r = bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key); + const TiffGeoTagKeyName *r = bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key); if(r) return r->name; -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 03/10] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 02/10] avcodec/tiff: Don't cast const away via bsearch Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 04/10] avfilter/avfilter: Honour the short options documentation Andreas Rheinhardt ` (8 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/avfilter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 856862a393..508fe1b26b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -844,6 +844,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, while (*args) { const char *shorthand = NULL; + int additional_flags = 0; if (priv_class) o = av_opt_next(&priv_class, o); @@ -869,7 +870,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, args++; if (parsed_key) { key = parsed_key; - + additional_flags = AV_DICT_DONT_STRDUP_KEY; /* discard all remaining shorthand */ if (priv_class) while ((o = av_opt_next(&priv_class, o))); @@ -879,10 +880,8 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, av_log(logctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value); - av_dict_set(options, key, value, AV_DICT_MULTIKEY); - - av_free(value); - av_free(parsed_key); + av_dict_set(options, key, value, + additional_flags | AV_DICT_DONT_STRDUP_VAL | AV_DICT_MULTIKEY); } return 0; -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 04/10] avfilter/avfilter: Honour the short options documentation 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 02/10] avcodec/tiff: Don't cast const away via bsearch Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 03/10] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 05/10] avfilter/vf_swapuv: Remove empty options and AVClass Andreas Rheinhardt ` (7 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt The documentation for filter arguments states that short options must precede long options (i.e. those of the form key=value). Yet if process_options() encounters arguments not abiding by this, it simply treats short options after a long option as if it were parsing short options for the first time. In particular, it overwrites options already set earlier, possibly via other short options. This is not how it is intended (as a comment in the code indicates). This commit modifies the code to reject further shorthand options after a long option has been encountered. After all, avfilter_init_str() errors out upon unrecognized options, so it is intended to be picky. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/avfilter.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 508fe1b26b..21d6832deb 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -846,9 +846,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, const char *shorthand = NULL; int additional_flags = 0; - if (priv_class) - o = av_opt_next(&priv_class, o); - if (o) { + if (priv_class && (o = av_opt_next(&priv_class, o))) { if (o->type == AV_OPT_TYPE_CONST || o->offset == offset) continue; offset = o->offset; @@ -871,9 +869,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, if (parsed_key) { key = parsed_key; additional_flags = AV_DICT_DONT_STRDUP_KEY; - /* discard all remaining shorthand */ - if (priv_class) - while ((o = av_opt_next(&priv_class, o))); + priv_class = NULL; /* reject all remaining shorthand */ } else { key = shorthand; } -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 05/10] avfilter/vf_swapuv: Remove empty options and AVClass 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (2 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 04/10] avfilter/avfilter: Honour the short options documentation Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 06/10] avfilter/vf_vflip: " Andreas Rheinhardt ` (6 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/vf_swapuv.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c index df04631d20..7965dc5dd1 100644 --- a/libavfilter/vf_swapuv.c +++ b/libavfilter/vf_swapuv.c @@ -23,23 +23,12 @@ * swap UV filter */ -#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" #include "formats.h" #include "internal.h" #include "video.h" -typedef struct SwapUVContext { - const AVClass *class; -} SwapUVContext; - -static const AVOption swapuv_options[] = { - { NULL } -}; - -AVFILTER_DEFINE_CLASS(swapuv); - static void do_swap(AVFrame *frame) { FFSWAP(uint8_t*, frame->data[1], frame->data[2]); @@ -104,8 +93,6 @@ static const AVFilterPad swapuv_inputs[] = { const AVFilter ff_vf_swapuv = { .name = "swapuv", .description = NULL_IF_CONFIG_SMALL("Swap U and V components."), - .priv_size = sizeof(SwapUVContext), - .priv_class = &swapuv_class, FILTER_INPUTS(swapuv_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_QUERY_FUNC(query_formats), -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 06/10] avfilter/vf_vflip: Remove empty options and AVClass 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (3 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 05/10] avfilter/vf_swapuv: Remove empty options and AVClass Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 07/10] avfilter/vf_hflip: " Andreas Rheinhardt ` (5 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/vf_vflip.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index 8d6724ed37..d72605bef0 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -24,24 +24,16 @@ */ #include "libavutil/internal.h" -#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" #include "internal.h" #include "video.h" typedef struct FlipContext { - const AVClass *class; int vsub; ///< vertical chroma subsampling int bayer; } FlipContext; -static const AVOption vflip_options[] = { - { NULL } -}; - -AVFILTER_DEFINE_CLASS(vflip); - static int config_input(AVFilterLink *link) { FlipContext *flip = link->dst->priv; @@ -139,7 +131,6 @@ const AVFilter ff_vf_vflip = { .name = "vflip", .description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."), .priv_size = sizeof(FlipContext), - .priv_class = &vflip_class, FILTER_INPUTS(avfilter_vf_vflip_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 07/10] avfilter/vf_hflip: Remove empty options and AVClass 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (4 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 06/10] avfilter/vf_vflip: " Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 08/10] avfilter/vf_grayworld: " Andreas Rheinhardt ` (4 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/hflip.h | 3 +-- libavfilter/vf_hflip.c | 8 -------- libavfilter/vf_hflip_init.h | 1 + 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h index 8532dc0f46..0d8b1025f3 100644 --- a/libavfilter/hflip.h +++ b/libavfilter/hflip.h @@ -22,10 +22,9 @@ #ifndef AVFILTER_HFLIP_H #define AVFILTER_HFLIP_H -#include "avfilter.h" +#include <stdint.h> typedef struct FlipContext { - const AVClass *class; int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes int bayer_plus1; ///< 1 .. not a Bayer input format, 2 .. Bayer input format int planewidth[4]; ///< width of each plane diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 09f4e08ea3..9f5958a392 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -26,7 +26,6 @@ #include <string.h> -#include "libavutil/opt.h" #include "avfilter.h" #include "formats.h" #include "hflip.h" @@ -38,12 +37,6 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" -static const AVOption hflip_options[] = { - { NULL } -}; - -AVFILTER_DEFINE_CLASS(hflip); - static int query_formats(AVFilterContext *ctx) { AVFilterFormats *pix_fmts = NULL; @@ -155,7 +148,6 @@ const AVFilter ff_vf_hflip = { .name = "hflip", .description = NULL_IF_CONFIG_SMALL("Horizontally flip the input video."), .priv_size = sizeof(FlipContext), - .priv_class = &hflip_class, FILTER_INPUTS(avfilter_vf_hflip_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h index d0319f463d..5c1d69b2b6 100644 --- a/libavfilter/vf_hflip_init.h +++ b/libavfilter/vf_hflip_init.h @@ -26,6 +26,7 @@ #include "config.h" #include "libavutil/attributes.h" +#include "libavutil/error.h" #include "libavutil/intreadwrite.h" #include "hflip.h" -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 08/10] avfilter/vf_grayworld: Remove empty options and AVClass 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (5 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 07/10] avfilter/vf_hflip: " Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 09/10] avfilter/avfilter: Don't use av_uninit Andreas Rheinhardt ` (3 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/vf_grayworld.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libavfilter/vf_grayworld.c b/libavfilter/vf_grayworld.c index 61ed832253..0b6d673168 100644 --- a/libavfilter/vf_grayworld.c +++ b/libavfilter/vf_grayworld.c @@ -27,7 +27,6 @@ #include "libavutil/imgutils.h" #include "libavutil/mem.h" -#include "libavutil/opt.h" #include "avfilter.h" #include "internal.h" @@ -41,20 +40,11 @@ typedef struct ThreadData { } ThreadData; typedef struct GrayWorldContext { - const AVClass *class; float *tmpplab; int *line_count_pels; float *line_sum; } GrayWorldContext; -#define OFFSET(x) offsetof(GrayWorldContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_RUNTIME_PARAM -static const AVOption grayworld_options[] = { - { NULL } -}; - -AVFILTER_DEFINE_CLASS(grayworld); - static void apply_matrix(const float matrix[3][3], const float input[3], float output[3]) { output[0] = matrix[0][0] * input[0] + matrix[0][1] * input[1] + matrix[0][2] * input[2]; @@ -311,7 +301,6 @@ const AVFilter ff_vf_grayworld = { .name = "grayworld", .description = NULL_IF_CONFIG_SMALL("Adjust white balance using LAB gray world algorithm"), .priv_size = sizeof(GrayWorldContext), - .priv_class = &grayworld_class, FILTER_INPUTS(grayworld_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_PIXFMTS(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32), -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 09/10] avfilter/avfilter: Don't use av_uninit 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (6 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 08/10] avfilter/vf_grayworld: " Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 10/10] all: " Andreas Rheinhardt ` (2 subsequent siblings) 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt GCC 9-13 do not emit warnings for this at all optimization levels even when -Wmaybe-uninitialized is not disabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/avfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 21d6832deb..7f94e71fbc 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -835,14 +835,14 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, { const AVOption *o = NULL; int ret; - char *av_uninit(parsed_key), *av_uninit(value); - const char *key; int offset= -1; if (!args) return 0; while (*args) { + char *parsed_key, *value; + const char *key; const char *shorthand = NULL; int additional_flags = 0; -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* [FFmpeg-devel] [PATCH 10/10] all: Don't use av_uninit 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (7 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 09/10] avfilter/avfilter: Don't use av_uninit Andreas Rheinhardt @ 2024-03-31 5:31 ` Andreas Rheinhardt 2024-04-01 18:21 ` [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled James Zern via ffmpeg-devel 2024-04-03 8:36 ` Anton Khirnov 10 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-03-31 5:31 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt It is unnecessary, because we use -Wno-maybe-unitialized with GCC nowadays. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/ac3enc.c | 4 ++-- libavcodec/ac3enc_template.c | 4 ++-- libavcodec/bfi.c | 2 +- libavcodec/dvdsubenc.c | 2 +- libavcodec/eamad.c | 2 +- libavcodec/ffv1enc_template.c | 2 +- libavcodec/flacdec.c | 2 +- libavcodec/lpc.c | 2 +- libavcodec/mpeg4videodec.c | 2 +- libavcodec/msmpeg4dec.c | 2 +- libavcodec/ppc/mpegaudiodsp_altivec.c | 2 +- libavcodec/qtrleenc.c | 2 +- libavcodec/ra144enc.c | 4 ++-- libavcodec/vp8.c | 2 +- libavcodec/wmavoice.c | 4 ++-- libavfilter/af_aecho.c | 2 +- libavfilter/af_compand.c | 2 +- libavfilter/vsrc_mandelbrot.c | 2 +- libavformat/electronicarts.c | 2 +- libavformat/flvdec.c | 4 ++-- libavformat/srtp.c | 4 ++-- libavformat/tests/seek.c | 2 +- libavformat/wavdec.c | 2 +- libpostproc/postprocess_altivec_template.c | 4 ++-- libswscale/yuv2rgb.c | 2 +- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 7a6bcf7900..4d3049f012 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1482,7 +1482,7 @@ static void ac3_output_frame_header(AC3EncodeContext *s) */ static void output_audio_block(AC3EncodeContext *s, int blk) { - int ch, i, baie, bnd, got_cpl, av_uninit(ch0); + int ch, i, baie, bnd, got_cpl, ch0; AC3Block *block = &s->blocks[blk]; /* block switching */ @@ -2383,7 +2383,7 @@ static av_cold int validate_options(AC3EncodeContext *s) */ static av_cold void set_bandwidth(AC3EncodeContext *s) { - int blk, ch, av_uninit(cpl_start); + int blk, ch, cpl_start; if (s->cutoff) { /* calculate bandwidth based on user-specified cutoff frequency */ diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 45dbc98804..ea0402fac4 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -117,7 +117,7 @@ static void apply_channel_coupling(AC3EncodeContext *s) #else int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords; #endif - int av_uninit(blk), ch, bnd, i, j; + int blk, ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int cpl_start, num_cpl_coefs; @@ -231,7 +231,7 @@ static void apply_channel_coupling(AC3EncodeContext *s) for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { blk = 0; while (blk < s->num_blocks) { - int av_uninit(blk1); + int blk1; AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) { diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index 58158f6eee..ef5dd0ce85 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -103,7 +103,7 @@ FF_ENABLE_DEPRECATION_WARNINGS while (dst != frame_end) { static const uint8_t lentab[4] = { 0, 2, 0, 1 }; - unsigned int byte = bytestream2_get_byte(&g), av_uninit(offset); + unsigned int byte = bytestream2_get_byte(&g), offset; unsigned int code = byte >> 6; unsigned int length = byte & ~0xC0; diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index c6110c29ff..c312da8afc 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -123,7 +123,7 @@ static void count_colors(AVCodecContext *avctx, unsigned hits[33], unsigned count[256] = { 0 }; uint32_t *palette = (uint32_t *)r->data[1]; uint32_t color; - int x, y, i, j, match, d, best_d, av_uninit(best_j); + int x, y, i, j, match, d, best_d, best_j; uint8_t *p = r->data[0]; for (y = 0; y < r->h; y++) { diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 1c3f97653c..12a0f50124 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -205,7 +205,7 @@ static int decode_motion(GetBitContext *gb) static int decode_mb(MadContext *s, AVFrame *frame, int inter) { int mv_map = 0; - int av_uninit(mv_x), av_uninit(mv_y); + int mv_x, mv_y; int j; if (inter) { diff --git a/libavcodec/ffv1enc_template.c b/libavcodec/ffv1enc_template.c index 8953dbe07c..e8350d4862 100644 --- a/libavcodec/ffv1enc_template.c +++ b/libavcodec/ffv1enc_template.c @@ -148,7 +148,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[4], sample[p][i]= RENAME(s->sample_buffer) + p*ring_size*(w+6) + ((h+i-y)%ring_size)*(w+6) + 3; for (x = 0; x < w; x++) { - int b, g, r, av_uninit(a); + int b, g, r, a; if (lbd) { unsigned v = *((const uint32_t*)(src[0] + x*4 + stride[0]*y)); b = v & 0xFF; diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 91bbdc657d..9d2f390647 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -303,7 +303,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded, int pred_order, int bps) { const int blocksize = s->blocksize; - unsigned av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d); + unsigned a, b, c, d; int i; int ret; diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 8305cc0596..f07cb0e039 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -279,7 +279,7 @@ int ff_lpc_calc_coefs(LPCContext *s, if (lpc_type == FF_LPC_TYPE_CHOLESKY) { LLSModel *m = s->lls_models; LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]); - double av_uninit(weight); + double weight; memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var)); for(j=0; j<max_order; j++) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 07de5d6d91..113d79bd5e 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1291,7 +1291,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, { MpegEncContext *s = &ctx->m; int level, i, last, run, qmul, qadd; - int av_uninit(dc_pred_dir); + int dc_pred_dir; RLTable *rl; RL_VLC_ELEM *rl_vlc; const uint8_t *scan_table; diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index bf1e4877bd..7370251e09 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -626,7 +626,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, int n, int coded, const uint8_t *scan_table) { int level, i, last, run, run_diff; - int av_uninit(dc_pred_dir); + int dc_pred_dir; RLTable *rl; RL_VLC_ELEM *rl_vlc; int qmul, qadd; diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c b/libavcodec/ppc/mpegaudiodsp_altivec.c index b065203c4e..bb962fba23 100644 --- a/libavcodec/ppc/mpegaudiodsp_altivec.c +++ b/libavcodec/ppc/mpegaudiodsp_altivec.c @@ -55,7 +55,7 @@ static void apply_window(const float *buf, const float *win1, const vector float *bufa = (const vector float *) buf; vector float *sum1a = (vector float *) sum1; vector float *sum2a = (vector float *) sum2; - vector float av_uninit(v0), av_uninit(v4); + vector float v0, v4; vector float v1, v2, v3; len = len >> 2; diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index 71d57d7eb8..c1273af30b 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -145,7 +145,7 @@ static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, ui unsigned int skipcount; /* This will be the number of consecutive equal pixels in the current * frame, starting from the ith one also */ - unsigned int av_uninit(repeatcount); + unsigned int repeatcount; /* The cost of the three different possibilities */ int total_skip_cost; diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 92c35ac12c..1b22113dd3 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -192,8 +192,8 @@ static void create_adapt_vect(float *vect, const int16_t *cb, int lag) static int adaptive_cb_search(const int16_t *adapt_cb, float *work, const float *coefs, float *data) { - int i, av_uninit(best_vect); - float score, gain, best_score, av_uninit(best_gain); + int i, best_vect; + float score, gain, best_score, best_gain; float exc[BLOCKSIZE]; gain = best_score = 0; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 539b5c5395..0b76a60d16 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2656,7 +2656,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; - VP8Frame *av_uninit(curframe), *prev_frame; + VP8Frame *curframe, *prev_frame; if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 258c71330c..f693afd8de 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1500,8 +1500,8 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx, float *excitation, float *synth) { WMAVoiceContext *s = ctx->priv_data; - int n, n_blocks_x2, log_n_blocks_x2, av_uninit(cur_pitch_val); - int pitch[MAX_BLOCKS], av_uninit(last_block_pitch); + int n, n_blocks_x2, log_n_blocks_x2, cur_pitch_val; + int pitch[MAX_BLOCKS], last_block_pitch; /* Parse frame type ("frame header"), see frame_descs */ int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc, 6, 3)], block_nsamples; diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c index 68fa5aaf7b..7df149df94 100644 --- a/libavfilter/af_aecho.c +++ b/libavfilter/af_aecho.c @@ -165,7 +165,7 @@ static void echo_samples_## name ##p(AudioEchoContext *ctx, \ const double in_gain = ctx->in_gain; \ const int nb_echoes = ctx->nb_echoes; \ const int max_samples = ctx->max_samples; \ - int i, j, chan, av_uninit(index); \ + int i, j, chan, index; \ \ av_assert1(channels > 0); /* would corrupt delay_index */ \ \ diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 880ee6241a..ad09db34df 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -195,7 +195,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame) AVFilterLink *inlink = ctx->inputs[0]; const int channels = inlink->ch_layout.nb_channels; const int nb_samples = frame->nb_samples; - int chan, i, av_uninit(dindex), oindex, av_uninit(count); + int chan, i, dindex, oindex, count; AVFrame *out_frame = NULL; int err; diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 982ef71814..cc42e22ddf 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -255,7 +255,7 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, } for(x=0; x<s->w; x++){ - float av_uninit(epsilon); + float epsilon; const double cr=s->start_x+scale*(x-s->w/2); double zr=cr; double zi=ci; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index f7f6fd4cab..e5cb8abbfa 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -588,7 +588,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) int hit_end = 0; unsigned int chunk_type, chunk_size; int ret = 0, packet_read = 0, key = 0, vp6a; - int av_uninit(num_samples); + int num_samples; while ((!packet_read && !hit_end) || partial_packet) { chunk_type = avio_rl32(pb); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 22a9b9e4a7..08d244b39d 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -1197,8 +1197,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int stream_type=-1; int64_t next, pos, meta_pos; int64_t dts, pts = AV_NOPTS_VALUE; - int av_uninit(channels); - int av_uninit(sample_rate); + int channels; + int sample_rate; AVStream *st = NULL; int last = -1; int orig_size; diff --git a/libavformat/srtp.c b/libavformat/srtp.c index 7e5a42e327..174cac7a82 100644 --- a/libavformat/srtp.c +++ b/libavformat/srtp.c @@ -128,8 +128,8 @@ int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr) { uint8_t iv[16] = { 0 }, hmac[20]; int len = *lenptr; - int av_uninit(seq_largest); - uint32_t ssrc, av_uninit(roc); + int seq_largest; + uint32_t ssrc, roc; uint64_t index; int rtcp, hmac_size; diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c index 94a72d9422..cb8dcbb9fb 100644 --- a/libavformat/tests/seek.c +++ b/libavformat/tests/seek.c @@ -118,7 +118,7 @@ int main(int argc, char **argv) } for(i=0; ; i++){ AVPacket pkt = { 0 }; - AVStream *av_uninit(st); + AVStream *st; char ts_buf[60]; if(ret>=0){ diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 00856a5eca..5f01c89745 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -350,7 +350,7 @@ static const AVMetadataConv wav_metadata_conv[] = { /* wav input */ static int wav_read_header(AVFormatContext *s) { - int64_t size, av_uninit(data_size); + int64_t size, data_size; int64_t sample_count = 0; int rf64 = 0, bw64 = 0; uint32_t tag; diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c index a9d4cd29a3..54e1546bf9 100644 --- a/libpostproc/postprocess_altivec_template.c +++ b/libpostproc/postprocess_altivec_template.c @@ -227,8 +227,8 @@ static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) DECLARE_ALIGNED(16, short, qp)[8] = {c->QP}; vector signed short vqp = vec_ld(0, qp); vector signed short vb0, vb1, vb2, vb3, vb4, vb5, vb6, vb7, vb8, vb9; - vector unsigned char vbA0, av_uninit(vbA1), av_uninit(vbA2), av_uninit(vbA3), av_uninit(vbA4), av_uninit(vbA5), av_uninit(vbA6), av_uninit(vbA7), av_uninit(vbA8), vbA9; - vector unsigned char vbB0, av_uninit(vbB1), av_uninit(vbB2), av_uninit(vbB3), av_uninit(vbB4), av_uninit(vbB5), av_uninit(vbB6), av_uninit(vbB7), av_uninit(vbB8), vbB9; + vector unsigned char vbA0, vbA1, vbA2, vbA3, vbA4, vbA5, vbA6, vbA7, vbA8, vbA9; + vector unsigned char vbB0, vbB1, vbB2, vbB3, vbB4, vbB5, vbB6, vbB7, vbB8, vbB9; vector unsigned char vbT0, vbT1, vbT2, vbT3, vbT4, vbT5, vbT6, vbT7, vbT8, vbT9; vector unsigned char perml0, perml1, perml2, perml3, perml4, perml5, perml6, perml7, perml8, perml9; diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 2b2358d2cc..3689f95856 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -803,7 +803,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], uint8_t *y_table; uint16_t *y_table16; uint32_t *y_table32; - int i, base, rbase, gbase, bbase, av_uninit(abase), needAlpha; + int i, base, rbase, gbase, bbase, abase, needAlpha; const int yoffs = (fullRange ? 384 : 326) + YUVRGB_TABLE_LUMA_HEADROOM; const int table_plane_size = 1024 + 2*YUVRGB_TABLE_LUMA_HEADROOM; -- 2.40.1 _______________________________________________ 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] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (8 preceding siblings ...) 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 10/10] all: " Andreas Rheinhardt @ 2024-04-01 18:21 ` James Zern via ffmpeg-devel 2024-04-01 18:28 ` Andreas Rheinhardt 2024-04-03 8:36 ` Anton Khirnov 10 siblings, 1 reply; 15+ messages in thread From: James Zern via ffmpeg-devel @ 2024-04-01 18:21 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: James Zern On Sat, Mar 30, 2024 at 10:30 PM Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/libvpxenc.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > index 635cdf7a0e..bcbdc4981e 100644 > --- a/libavcodec/libvpxenc.c > +++ b/libavcodec/libvpxenc.c > @@ -49,6 +49,9 @@ > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > > +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) > +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) > + > /** > * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. > * One encoded frame returned from the library. > @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, > FrameData fd = { .pts = frame->pts }; > int ret; > > -#if CONFIG_LIBVPX_VP9_ENCODER > - if (avctx->codec_id == AV_CODEC_ID_VP9 && > + if (IS_VP9(avctx) && This works and I think the style is largely prevalent in other code. Given the current structure you could move the enccfg declaration to this block as an alternative. > // Keep HDR10+ if it has bit depth higher than 8 and > // it has PQ trc (SMPTE2084). > enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) { > @@ -372,7 +374,6 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, > return AVERROR(ENOMEM); > } > } > -#endif > > fd.duration = frame->duration; > fd.frame_opaque = frame->opaque; > -- > 2.40.1 > _______________________________________________ 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] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled 2024-04-01 18:21 ` [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled James Zern via ffmpeg-devel @ 2024-04-01 18:28 ` Andreas Rheinhardt 2024-04-02 18:32 ` James Zern via ffmpeg-devel 0 siblings, 1 reply; 15+ messages in thread From: Andreas Rheinhardt @ 2024-04-01 18:28 UTC (permalink / raw) To: ffmpeg-devel James Zern via ffmpeg-devel: > On Sat, Mar 30, 2024 at 10:30 PM Andreas Rheinhardt > <andreas.rheinhardt@outlook.com> wrote: >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> >> --- >> libavcodec/libvpxenc.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c >> index 635cdf7a0e..bcbdc4981e 100644 >> --- a/libavcodec/libvpxenc.c >> +++ b/libavcodec/libvpxenc.c >> @@ -49,6 +49,9 @@ >> #include "libavutil/opt.h" >> #include "libavutil/pixdesc.h" >> >> +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) >> +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) >> + >> /** >> * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. >> * One encoded frame returned from the library. >> @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, >> FrameData fd = { .pts = frame->pts }; >> int ret; >> >> -#if CONFIG_LIBVPX_VP9_ENCODER >> - if (avctx->codec_id == AV_CODEC_ID_VP9 && >> + if (IS_VP9(avctx) && > > This works and I think the style is largely prevalent in other code. > Given the current structure you could move the enccfg declaration to > this block as an alternative. The latter would entail either opening a new block for the #if part or hoping (due to -Wdeclaration-after-statement) that this #if block stays at the start of this function. I prefer my approach above to either of these alternatives (a third alternative would be to avoid the enccfg variable altogether and to check ctx->encoder.config.enc->g_bit_depth instead; another alternative is av_unused). Just tell me which alternative you prefer. > >> // Keep HDR10+ if it has bit depth higher than 8 and >> // it has PQ trc (SMPTE2084). >> enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) { >> @@ -372,7 +374,6 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, >> return AVERROR(ENOMEM); >> } >> } >> -#endif >> >> fd.duration = frame->duration; >> fd.frame_opaque = frame->opaque; >> -- >> 2.40.1 _______________________________________________ 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] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled 2024-04-01 18:28 ` Andreas Rheinhardt @ 2024-04-02 18:32 ` James Zern via ffmpeg-devel 0 siblings, 0 replies; 15+ messages in thread From: James Zern via ffmpeg-devel @ 2024-04-02 18:32 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: James Zern On Mon, Apr 1, 2024 at 11:29 AM Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > James Zern via ffmpeg-devel: > > On Sat, Mar 30, 2024 at 10:30 PM Andreas Rheinhardt > > <andreas.rheinhardt@outlook.com> wrote: > >> > >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > >> --- > >> libavcodec/libvpxenc.c | 7 ++++--- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > >> index 635cdf7a0e..bcbdc4981e 100644 > >> --- a/libavcodec/libvpxenc.c > >> +++ b/libavcodec/libvpxenc.c > >> @@ -49,6 +49,9 @@ > >> #include "libavutil/opt.h" > >> #include "libavutil/pixdesc.h" > >> > >> +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) > >> +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) > >> + > >> /** > >> * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. > >> * One encoded frame returned from the library. > >> @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, > >> FrameData fd = { .pts = frame->pts }; > >> int ret; > >> > >> -#if CONFIG_LIBVPX_VP9_ENCODER > >> - if (avctx->codec_id == AV_CODEC_ID_VP9 && > >> + if (IS_VP9(avctx) && > > > > This works and I think the style is largely prevalent in other code. > > Given the current structure you could move the enccfg declaration to > > this block as an alternative. > > The latter would entail either opening a new block for the #if part or > hoping (due to -Wdeclaration-after-statement) that this #if block stays > at the start of this function. I prefer my approach above to either of > these alternatives (a third alternative would be to avoid the enccfg > variable altogether and to check ctx->encoder.config.enc->g_bit_depth > instead; another alternative is av_unused). Just tell me which > alternative you prefer. > I only made the comment because I didn't think it would need a new block as it is, but you're right, code moves around. This is fine and simpler than having a debate about the warning given the adoption of other C99/C11 features. _______________________________________________ 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] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt ` (9 preceding siblings ...) 2024-04-01 18:21 ` [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled James Zern via ffmpeg-devel @ 2024-04-03 8:36 ` Anton Khirnov 2024-04-03 15:28 ` Andreas Rheinhardt 10 siblings, 1 reply; 15+ messages in thread From: Anton Khirnov @ 2024-04-03 8:36 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: Andreas Rheinhardt Quoting Andreas Rheinhardt (2024-03-31 07:30:26) > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/libvpxenc.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > index 635cdf7a0e..bcbdc4981e 100644 > --- a/libavcodec/libvpxenc.c > +++ b/libavcodec/libvpxenc.c > @@ -49,6 +49,9 @@ > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > > +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) > +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) > + > /** > * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. > * One encoded frame returned from the library. > @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, > FrameData fd = { .pts = frame->pts }; > int ret; > > -#if CONFIG_LIBVPX_VP9_ENCODER > - if (avctx->codec_id == AV_CODEC_ID_VP9 && > + if (IS_VP9(avctx) && Weren't we moving towards getting rid of our dependency on DCE? I recall some discussions about this in recent years, though I don't remember if there was a consensus. -- Anton Khirnov _______________________________________________ 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] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled 2024-04-03 8:36 ` Anton Khirnov @ 2024-04-03 15:28 ` Andreas Rheinhardt 0 siblings, 0 replies; 15+ messages in thread From: Andreas Rheinhardt @ 2024-04-03 15:28 UTC (permalink / raw) To: FFmpeg development discussions and patches Anton Khirnov: > Quoting Andreas Rheinhardt (2024-03-31 07:30:26) >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> >> --- >> libavcodec/libvpxenc.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c >> index 635cdf7a0e..bcbdc4981e 100644 >> --- a/libavcodec/libvpxenc.c >> +++ b/libavcodec/libvpxenc.c >> @@ -49,6 +49,9 @@ >> #include "libavutil/opt.h" >> #include "libavutil/pixdesc.h" >> >> +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) >> +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) >> + >> /** >> * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. >> * One encoded frame returned from the library. >> @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, >> FrameData fd = { .pts = frame->pts }; >> int ret; >> >> -#if CONFIG_LIBVPX_VP9_ENCODER >> - if (avctx->codec_id == AV_CODEC_ID_VP9 && >> + if (IS_VP9(avctx) && > > Weren't we moving towards getting rid of our dependency on DCE? > I recall some discussions about this in recent years, though I don't > remember if there was a consensus. > This patch does not add any dependency on DCE, because the code block currently #if'ed away does not contain anything that would cause a linking failure with a compiler not performing DCE. - Andreas _______________________________________________ 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] 15+ messages in thread
end of thread, other threads:[~2024-04-03 15:28 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-03-31 5:30 [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 02/10] avcodec/tiff: Don't cast const away via bsearch Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 03/10] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 04/10] avfilter/avfilter: Honour the short options documentation Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 05/10] avfilter/vf_swapuv: Remove empty options and AVClass Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 06/10] avfilter/vf_vflip: " Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 07/10] avfilter/vf_hflip: " Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 08/10] avfilter/vf_grayworld: " Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 09/10] avfilter/avfilter: Don't use av_uninit Andreas Rheinhardt 2024-03-31 5:31 ` [FFmpeg-devel] [PATCH 10/10] all: " Andreas Rheinhardt 2024-04-01 18:21 ` [FFmpeg-devel] [PATCH 01/10] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled James Zern via ffmpeg-devel 2024-04-01 18:28 ` Andreas Rheinhardt 2024-04-02 18:32 ` James Zern via ffmpeg-devel 2024-04-03 8:36 ` Anton Khirnov 2024-04-03 15:28 ` Andreas Rheinhardt
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