Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] libkvazaar for 4:4:4 or 4:2:2 (PR #21389)
@ 2026-01-06 10:26 Jamaika1 via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Jamaika1 via ffmpeg-devel @ 2026-01-06 10:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Jamaika1

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-06 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-06 10:26 [FFmpeg-devel] [PR] libkvazaar for 4:4:4 or 4:2:2 (PR #21389) Jamaika1 via ffmpeg-devel

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