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 <[email protected]> >From dc615af929b9e6ce3c2f10f8dacf467bee08f680 Mon Sep 17 00:00:00 2001 From: Jamaika1 <[email protected]> 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 <[email protected]> --- 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 -- [email protected] To unsubscribe send an email to [email protected]
