[x265] [PATCH] Fix broken lookahead configuration with Qp file
Karam Singh
karam.singh at multicorewareinc.com
Mon Apr 1 09:20:17 UTC 2024
Patch pushed to master branch.
Karam Singh
Senior Software (Video Codec) Engineer
MulticoreWare, India
On Thu, Mar 28, 2024 at 12:53 PM Kirithika Kalirathnam <
kirithika at multicorewareinc.com> wrote:
> From 416d9fe5c6dc905fb6e6204fd268682ef1760964 Mon Sep 17 00:00:00 2001
> From: Kirithika <kirithika at multicorewareinc.com>
> Date: Thu, 14 Dec 2023 17:17:02 +0530
> Subject: [PATCH] Fix broken lookahead configuration with Qp file
>
> ---
> source/common/lowres.h | 1 +
> source/encoder/encoder.cpp | 3 ++-
> source/encoder/slicetype.cpp | 2 ++
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/source/common/lowres.h b/source/common/lowres.h
> index 60fb40286..4d29ab695 100644
> --- a/source/common/lowres.h
> +++ b/source/common/lowres.h
> @@ -171,6 +171,7 @@ struct Lowres : public ReferencePlanes
>
> int frameNum; // Presentation frame number
> int sliceType; // Slice type decided by lookahead
> + int sliceTypeReq; // Slice type required as per the QP file
> int width; // width of lowres frame in pixels
> int lines; // height of lowres frame in pixel lines
> int leadingBframes; // number of leading B frames for P or I
> diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
> index c516e1a2c..880b4f16d 100644
> --- a/source/encoder/encoder.cpp
> +++ b/source/encoder/encoder.cpp
> @@ -2191,7 +2191,8 @@ int Encoder::encode(const x265_picture* pic_in,
> x265_picture* pic_out, x265_pict
> }
>
> /* Use the frame types from the first pass, if available */
> - int sliceType = (m_param->rc.bStatRead) ?
> m_rateControl->rateControlSliceType(inFrame->m_poc) : inputPic->sliceType;
> + int sliceType = (m_param->rc.bStatRead) ?
> m_rateControl->rateControlSliceType(inFrame->m_poc) : X265_TYPE_AUTO;
> + inFrame->m_lowres.sliceTypeReq = inputPic->sliceType;
>
> /* In analysisSave mode, x265_analysis_data is allocated in
> inputPic and inFrame points to this */
> /* Load analysis data before lookahead->addPicture, since
> sliceType has been decided */
> diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp
> index 1e8f339a2..74d7d040c 100644
> --- a/source/encoder/slicetype.cpp
> +++ b/source/encoder/slicetype.cpp
> @@ -1583,6 +1583,8 @@ void Lookahead::slicetypeDecide()
> {
> Lowres& frm = list[bframes]->m_lowres;
>
> + if (frm.sliceTypeReq != X265_TYPE_AUTO && frm.sliceTypeReq !=
> frm.sliceType)
> + frm.sliceType = frm.sliceTypeReq;
> if (frm.sliceType == X265_TYPE_BREF && !m_param->bBPyramid &&
> brefs == m_param->bBPyramid)
> {
> frm.sliceType = X265_TYPE_B;
> --
> 2.28.0.windows.1
>
> *Thanks,*
> *Kirithika*
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240401/d82fbc53/attachment.htm>
More information about the x265-devel
mailing list