[x265] [PATCH] Fix Avg I Slice QP value issue in zonefile
Mahesh Pittala
mahesh at multicorewareinc.com
Mon May 8 09:47:03 UTC 2023
pushed to master and Release_3.5 branches
On Fri, May 5, 2023 at 9:29 PM Karam Singh <karam.singh at multicorewareinc.com>
wrote:
> From 0a9a9bb09d0c214cabaecccf69725034366e6938 Mon Sep 17 00:00:00 2001
> From: Karam Singh <karam.singh at multicorewareinc.com>
> Date: Fri, 5 May 2023 12:55:22 +0530
> Subject: [PATCH] Fix Avg I Slice QP value issue in zonefile
>
> ---
> source/CMakeLists.txt | 2 +-
> source/common/param.cpp | 1 +
> source/encoder/ratecontrol.cpp | 3 ++-
> source/x265.h | 4 ++++
> source/x265cli.cpp | 2 ++
> source/x265cli.h | 1 +
> 6 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> index 4150eb9c6..ca6a2ceee 100644
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)
> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
> # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 207)
> +set(X265_BUILD 208)
> configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
> configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff --git a/source/common/param.cpp b/source/common/param.cpp
> index e9ca077d7..6af9f8184 100644
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -2587,6 +2587,7 @@ void x265_copy_params(x265_param* dst, x265_param*
> src)
> dst->rc.zonefileCount = src->rc.zonefileCount;
> dst->reconfigWindowSize = src->reconfigWindowSize;
> dst->bResetZoneConfig = src->bResetZoneConfig;
> + dst->bNoResetZoneConfig = src->bNoResetZoneConfig;
> dst->decoderVbvMaxRate = src->decoderVbvMaxRate;
>
> if (src->rc.zonefileCount && src->rc.zones && src->bResetZoneConfig)
> diff --git a/source/encoder/ratecontrol.cpp
> b/source/encoder/ratecontrol.cpp
> index a275fca42..08327c52d 100644
> --- a/source/encoder/ratecontrol.cpp
> +++ b/source/encoder/ratecontrol.cpp
> @@ -1306,7 +1306,8 @@ int RateControl::rateControlStart(Frame* curFrame,
> RateControlEntry* rce, Encode
> {
> m_param = m_param->rc.zones[i].zoneParam;
> reconfigureRC();
> - init(*m_curSlice->m_sps);
> + if (!m_param->bNoResetZoneConfig)
> + init(*m_curSlice->m_sps);
> }
> }
> }
> diff --git a/source/x265.h b/source/x265.h
> index d621e4394..7bf25c368 100644
> --- a/source/x265.h
> +++ b/source/x265.h
> @@ -1928,6 +1928,10 @@ typedef struct x265_param
> Default 1 (Enabled). API only. */
> int bResetZoneConfig;
>
> + /*Flag to indicate rate-control history has not to be reset during
> zone reconfiguration.
> + Default 0 (Disabled) */
> + int bNoResetZoneConfig;
> +
> /* It reduces the bits spent on the inter-frames within the
> scenecutWindow before and / or after a scenecut
> * by increasing their QP in ratecontrol pass2 algorithm without any
> deterioration in visual quality.
> * 0 - Disabled (default).
> diff --git a/source/x265cli.cpp b/source/x265cli.cpp
> index 120a6706d..612c0891f 100755
> --- a/source/x265cli.cpp
> +++ b/source/x265cli.cpp
> @@ -284,6 +284,7 @@ namespace X265_NS {
> H1(" q=<integer> (force
> QP)\n");
> H1(" or b=<float> (bitrate
> multiplier)\n");
> H0(" --zonefile <filename> Zone file containing the
> zone boundaries and the parameters to be reconfigured.\n");
> + H0(" --no-zonefile-rc-init This allow to use
> rate-control history across zones in zonefile.\n");
> H1(" --lambda-file <string> Specify a file containing
> replacement values for the lambda tables\n");
> H1(" MAX_MAX_QP+1 floats for
> lambda table, then again for lambda2 table\n");
> H1(" Blank lines and lines
> starting with hash(#) are ignored\n");
> @@ -733,6 +734,7 @@ namespace X265_NS {
> if (!this->zoneFile)
> x265_log_file(param, X265_LOG_ERROR, "%s zone
> file not found or error in opening zone file\n", optarg);
> }
> + OPT("no-zonefile-rc-init")
> this->param->bNoResetZoneConfig = true;
> OPT("fullhelp")
> {
> param->logLevel = X265_LOG_FULL;
> diff --git a/source/x265cli.h b/source/x265cli.h
> index 8683ce481..462745a0a 100644
> --- a/source/x265cli.h
> +++ b/source/x265cli.h
> @@ -274,6 +274,7 @@ static const struct option long_options[] =
> { "zones", required_argument, NULL, 0 },
> { "qpfile", required_argument, NULL, 0 },
> { "zonefile", required_argument, NULL, 0 },
> + { "no-zonefile-rc-init", no_argument, NULL, 0 },
> { "lambda-file", required_argument, NULL, 0 },
> { "b-intra", no_argument, NULL, 0 },
> { "no-b-intra", no_argument, NULL, 0 },
> --
> 2.36.0.windows.1
>
>
>
> Karam Singh
> Senior Video Codec Engineer
> MulticoreWare, India
> _______________________________________________
> 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/20230508/462d0aec/attachment.htm>
More information about the x265-devel
mailing list