Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/3] avfilter/vf_uspp: Support any codec
Date: Thu, 16 Mar 2023 00:34:44 +0100
Message-ID: <20230315233445.5282-2-michael@niedermayer.cc> (raw)
In-Reply-To: <20230315233445.5282-1-michael@niedermayer.cc>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 doc/filters.texi      |  3 +++
 libavfilter/vf_uspp.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 77b594f69c..d634924bfb 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -23364,6 +23364,9 @@ that value the speed drops by a factor of approximately 2.  Default value is
 @item qp
 Force a constant quantization parameter. If not set, the filter will use the QP
 from the video stream (if available).
+
+@item codec
+Use specified codec instead of snow.
 @end table
 
 @section v360
diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index 43114e1b50..a7bf8e3087 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -46,6 +46,7 @@ typedef struct USPPContext {
     int log2_count;
     int hsub, vsub;
     int qp;
+    char *codec_name;
     enum AVVideoEncParamsType qscale_type;
     int temp_stride[3];
     uint8_t *src[3];
@@ -68,6 +69,7 @@ static const AVOption uspp_options[] = {
     { "quality",       "set quality",                          OFFSET(log2_count),    AV_OPT_TYPE_INT, {.i64 = 3}, 0, MAX_LEVEL, FLAGS },
     { "qp",            "force a constant quantizer parameter", OFFSET(qp),            AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63,        FLAGS },
     { "use_bframe_qp", "use B-frames' QP",                     OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL,{.i64 = 0}, 0, 1,         FLAGS },
+    { "codec",         "Codec name",                           OFFSET(codec_name),    AV_OPT_TYPE_STRING, {.str = "snow"}, 0, 0, FLAGS },
     { NULL }
 };
 
@@ -327,15 +329,14 @@ static int config_input(AVFilterLink *inlink)
     const int width  = inlink->w;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     int i;
-
-    const AVCodec *enc = avcodec_find_encoder(AV_CODEC_ID_SNOW);
-    const AVCodec *dec = avcodec_find_decoder(AV_CODEC_ID_SNOW);
+    const AVCodec *enc = avcodec_find_encoder_by_name(uspp->codec_name);
+    const AVCodec *dec = avcodec_find_decoder_by_name(uspp->codec_name);
     if (!enc) {
-        av_log(ctx, AV_LOG_ERROR, "SNOW encoder not found.\n");
+        av_log(ctx, AV_LOG_ERROR, "encoder %s not found.\n", uspp->codec_name);
         return AVERROR(EINVAL);
     }
     if (!dec) {
-        av_log(ctx, AV_LOG_ERROR, "SNOW decoder not found.\n");
+        av_log(ctx, AV_LOG_ERROR, "decoder %s not found.\n", uspp->codec_name);
         return AVERROR(EINVAL);
     }
 
-- 
2.17.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".

  reply	other threads:[~2023-03-15 23:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 23:34 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_uspp: update to new APIs Michael Niedermayer
2023-03-15 23:34 ` Michael Niedermayer [this message]
2023-03-15 23:34 ` [FFmpeg-devel] [PATCH 3/3] avfilter/vf_uspp: 1000% faster with threads Michael Niedermayer
2023-03-16  7:47   ` Nicolas George
2023-03-16 21:26     ` Michael Niedermayer
2023-03-16 16:13 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_uspp: update to new APIs James Almer
2023-03-16 21:15   ` Michael Niedermayer
2023-03-18 12:31     ` Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315233445.5282-2-michael@niedermayer.cc \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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