Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Jamaika1 via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Jamaika1 <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] libkvazaar for 4:4:4 or 4:2:2 (PR #21389)
Date: Tue, 06 Jan 2026 10:26:45 -0000
Message-ID: <176769520574.25.12895672947578382135@4457048688e7> (raw)

PR #21389 opened by Jamaika1
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21389
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21389.patch

https://github.com/ultravideo/kvazaar/commits/444-format-revive/

Signed-off-by: Jamaika1 <lukaszcz18@wp.pl>


>From dc615af929b9e6ce3c2f10f8dacf467bee08f680 Mon Sep 17 00:00:00 2001
From: Jamaika1 <lukaszcz18@wp.pl>
Date: Tue, 6 Jan 2026 10:26:11 +0000
Subject: [PATCH] libkvazaar for 4:4:4 or 4:2:2

https://github.com/ultravideo/kvazaar/commits/444-format-revive/

Signed-off-by: Jamaika1 <lukaszcz18@wp.pl>
---
 libavcodec/libkvazaar.c | 76 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 69 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 908c7a0383..21f999467f 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -87,6 +87,27 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
         cfg->framerate_denom = avctx->time_base.num;
     }
     cfg->target_bitrate = avctx->bit_rate;
+    if (avctx->pix_fmt == AV_PIX_FMT_YUV420P
+#if KVZ_BIT_DEPTH == 10
+        || avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE
+#endif
+        ) {
+        cfg->input_format   = KVZ_FORMAT_P420;
+    } else if (avctx->pix_fmt == AV_PIX_FMT_YUV422P
+#if KVZ_BIT_DEPTH == 10
+               || avctx->pix_fmt == AV_PIX_FMT_YUV422P10LE
+#endif
+               ) {
+        cfg->input_format   = KVZ_FORMAT_P422;
+    } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P
+#if KVZ_BIT_DEPTH == 10
+               || avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE
+#endif
+               ) {
+        cfg->input_format   = KVZ_FORMAT_P444;
+    } else {
+        return -1;
+    }
     cfg->vui.sar_width  = avctx->sample_aspect_ratio.num;
     cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
     if (avctx->bit_rate) {
@@ -213,15 +234,49 @@ static int libkvazaar_encode(AVCodecContext *avctx,
                 input_pic->data[2],
                 NULL,
             };
-            int dst_linesizes[4] = {
-              frame->width,
-              frame->width / 2,
-              frame->width / 2,
-              0
-            };
-            av_image_copy2(dst, dst_linesizes,
+            if (avctx->pix_fmt == AV_PIX_FMT_YUV420P
+#if KVZ_BIT_DEPTH == 10
+                || avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE
+#endif
+                ) {
+                int dst_linesizes[4] = {
+                    frame->width,
+                    frame->width / 2,
+                    frame->width / 2,
+                    0
+                };
+                av_image_copy2(dst, dst_linesizes,
                            frame->data, frame->linesize,
                            frame->format, frame->width, frame->height);
+            } else if (avctx->pix_fmt == AV_PIX_FMT_YUV422P
+#if KVZ_BIT_DEPTH == 10
+                       || avctx->pix_fmt == AV_PIX_FMT_YUV422P10LE
+#endif
+                       ) {
+                int dst_linesizes[4] = {
+                    frame->width,
+                    frame->width / 2,
+                    frame->width,
+                    0
+                };
+                av_image_copy2(dst, dst_linesizes,
+                           frame->data, frame->linesize,
+                           frame->format, frame->width, frame->height);
+            } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P
+#if KVZ_BIT_DEPTH == 10
+                       || avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE
+#endif
+                       ) {
+                int dst_linesizes[4] = {
+                    frame->width,
+                    frame->width,
+                    frame->width,
+                    0
+                };
+                av_image_copy2(dst, dst_linesizes,
+                           frame->data, frame->linesize,
+                           frame->format, frame->width, frame->height);
+            }
         }
 
         input_pic->pts = frame->pts;
@@ -294,6 +349,13 @@ done:
 }
 
 static const enum AVPixelFormat pix_fmts[] = {
+#if KVZ_BIT_DEPTH == 10
+    AV_PIX_FMT_YUV444P10LE
+    AV_PIX_FMT_YUV422P10LE
+    AV_PIX_FMT_YUV420P10LE
+#endif
+    AV_PIX_FMT_YUV444P,
+    AV_PIX_FMT_YUV422P,
     AV_PIX_FMT_YUV420P,
     AV_PIX_FMT_NONE
 };
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-01-06 10:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=176769520574.25.12895672947578382135@4457048688e7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@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