[x265] [PATCH] Support for VBV-End feature

Yaswanth Sastry yaswanth.sastry at multicorewareinc.com
Thu Oct 3 12:38:37 UTC 2024


>From 876a66a23aa4e6e8ed055073b774039ac9bd447a Mon Sep 17 00:00:00 2001
From: yaswanthsastry <yaswanth.sastry at multicorewareinc.com>
Date: Thu, 3 Oct 2024 16:24:50 +0530
Subject: [PATCH] Fix Initialization of VBV-End Flag error with multiple
layers

---
 source/encoder/encoder.cpp     | 2 +-
 source/encoder/ratecontrol.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index f890cff10..ff3f2f8e5 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1713,7 +1713,7 @@ int Encoder::encode(const x265_picture* pic_in,
x265_picture** pic_out)
             inFrame[layer]->m_poc = (!layer) ? (++m_pocLast) : m_pocLast;
             inFrame[layer]->m_userData = inputPic[0]->userData;
             inFrame[layer]->m_pts = inputPic[0]->pts;
-              inFrame[layer]->vbvEndFlag = inputPic[layer]->vbvEndFlag;
+            inFrame[layer]->vbvEndFlag = inputPic[0]->vbvEndFlag;

             if ((m_param->bEnableSceneCutAwareQp & BACKWARD) &&
m_param->rc.bStatRead)
             {
diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
index fc79e88ab..d031e8d99 100644
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -1466,7 +1466,7 @@ int RateControl::rateControlStart(Frame* curFrame,
RateControlEntry* rce, Encode
          if (m_param->vbvBufferEnd && ((curFrame->vbvEndFlag) ||
((m_param->totalFrames) && (rce->encodeOrder >= (m_param->vbvEndFrameAdjust
* m_param->totalFrames)))))
          {
               if (m_totalFrames == -1)
-                   m_totalFrames = curFrame->vbvEndFlag ? (1 /
m_param->vbvEndFrameAdjust) * rce->encodeOrder : m_param->totalFrames;
+ m_totalFrames = curFrame->vbvEndFlag ? static_cast<int>((1 /
m_param->vbvEndFrameAdjust) * rce->encodeOrder) : m_param->totalFrames;
               rce->remainingVbvEndFrames = ((m_totalFrames) -
(rce->encodeOrder));
               rce->vbvEndAdj = true;
               rce->targetFill = 0;
-- 
2.37.3.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/600e68c2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_to_fix_vbvend_initialisation_error.diff
Type: application/octet-stream
Size: 2047 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/600e68c2/attachment.obj>


More information about the x265-devel mailing list