diff options
Diffstat (limited to 'video/image_writer.c')
-rw-r--r-- | video/image_writer.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/video/image_writer.c b/video/image_writer.c index 3c2d57a80f..d91e1e7b2c 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -75,12 +75,8 @@ const struct m_opt_choice_alternatives mp_image_writer_formats[] = { {"jpeg", AV_CODEC_ID_MJPEG}, {"png", AV_CODEC_ID_PNG}, {"webp", AV_CODEC_ID_WEBP}, -#if HAVE_JPEGXL {"jxl", AV_CODEC_ID_JPEGXL}, -#endif -#if HAVE_AVIF_MUXER {"avif", AV_CODEC_ID_AV1}, -#endif {0} }; @@ -95,15 +91,11 @@ const struct m_option image_writer_opts[] = { {"webp-lossless", OPT_BOOL(webp_lossless)}, {"webp-quality", OPT_INT(webp_quality), M_RANGE(0, 100)}, {"webp-compression", OPT_INT(webp_compression), M_RANGE(0, 6)}, -#if HAVE_JPEGXL {"jxl-distance", OPT_DOUBLE(jxl_distance), M_RANGE(0.0, 15.0)}, {"jxl-effort", OPT_INT(jxl_effort), M_RANGE(1, 9)}, -#endif -#if HAVE_AVIF_MUXER {"avif-encoder", OPT_STRING(avif_encoder)}, {"avif-opts", OPT_KEYVALUELIST(avif_opts)}, {"avif-pixfmt", OPT_STRING(avif_pixfmt)}, -#endif {"high-bit-depth", OPT_BOOL(high_bit_depth)}, {"tag-colorspace", OPT_BOOL(tag_csp)}, {0}, @@ -210,13 +202,11 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp AV_OPT_SEARCH_CHILDREN); av_opt_set_int(avctx, "quality", ctx->opts->webp_quality, AV_OPT_SEARCH_CHILDREN); -#if HAVE_JPEGXL } else if (codec->id == AV_CODEC_ID_JPEGXL) { av_opt_set_double(avctx, "distance", ctx->opts->jxl_distance, AV_OPT_SEARCH_CHILDREN); av_opt_set_int(avctx, "effort", ctx->opts->jxl_effort, AV_OPT_SEARCH_CHILDREN); -#endif } if (avcodec_open2(avctx, codec, NULL) < 0) { @@ -320,8 +310,6 @@ static bool write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp #endif -#if HAVE_AVIF_MUXER - static void log_side_data(struct image_writer_ctx *ctx, AVPacketSideData *data, size_t size) { @@ -500,8 +488,6 @@ free_data: return success; } -#endif - static int get_encoder_format(const AVCodec *codec, int srcfmt, bool highdepth) { const enum AVPixelFormat *pix_fmts = codec->pix_fmts; @@ -562,31 +548,17 @@ const char *image_writer_file_ext(const struct image_writer_opts *opts) bool image_writer_high_depth(const struct image_writer_opts *opts) { return opts->format == AV_CODEC_ID_PNG -#if HAVE_JPEGXL || opts->format == AV_CODEC_ID_JPEGXL -#endif -#if HAVE_AVIF_MUXER - || opts->format == AV_CODEC_ID_AV1 -#endif - ; + || opts->format == AV_CODEC_ID_AV1; } bool image_writer_flexible_csp(const struct image_writer_opts *opts) { if (!opts->tag_csp) return false; - return false -#if HAVE_JPEGXL - || opts->format == AV_CODEC_ID_JPEGXL -#endif -#if HAVE_AVIF_MUXER + return opts->format == AV_CODEC_ID_JPEGXL || opts->format == AV_CODEC_ID_AV1 -#endif -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 58, 100) - // This version added support for cICP tag writing - || opts->format == AV_CODEC_ID_PNG -#endif - ; + || opts->format == AV_CODEC_ID_PNG; } int image_writer_format_from_ext(const char *ext) @@ -700,14 +672,11 @@ bool write_image(struct mp_image *image, const struct image_writer_opts *opts, destfmt = IMGFMT_RGB24; } #endif -#if HAVE_AVIF_MUXER if (opts->format == AV_CODEC_ID_AV1) { write = write_avif; if (opts->avif_pixfmt && opts->avif_pixfmt[0]) destfmt = mp_imgfmt_from_name(bstr0(opts->avif_pixfmt)); - } -#endif - if (opts->format == AV_CODEC_ID_WEBP && !opts->webp_lossless) { + } else if (opts->format == AV_CODEC_ID_WEBP && !opts->webp_lossless) { // For lossy images, libwebp has its own RGB->YUV conversion. // We don't want that, so force YUV/YUVA here. int alpha = image->fmt.flags & MP_IMGFLAG_ALPHA; |