[x265] [PATCH] Changed stride as width for the cases stride!=width

Anusuya Kumarasamy anusuya.kumarasamy at multicorewareinc.com
Mon Sep 9 08:50:14 UTC 2024


>From 1b0b22dc087e43c89b4bd1bb8aac75182bcd1fb9 Mon Sep 17 00:00:00 2001
From: AnusuyaKumarasamy <anusuya.kumarasamy at multicorewareinc.com>
Date: Wed, 4 Sep 2024 21:04:09 +0530
Subject: [PATCH 6/7] Changed stride as width for the cases stride!=width

---
 source/common/picyuv.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/source/common/picyuv.cpp b/source/common/picyuv.cpp
index e4911b19a..a0190acc3 100644
--- a/source/common/picyuv.cpp
+++ b/source/common/picyuv.cpp
@@ -325,7 +325,7 @@ void PicYuv::copyFromPicture(const x265_picture& pic,
const x265_param& param, i
             {
                 int offsetX, offsetY;
                 offsetX = (!isBase && pic.format == 1 ? width : 0);
-                offsetY = (!isBase && pic.format == 2 ? width * height :
0);
+                offsetY = (!isBase && pic.format == 2 ? pic.stride[0] *
height : 0);
                 pixel *yPixel = m_picOrg[0];
                 uint8_t* yChar = (uint8_t*)pic.planes[0] + offsetX +
offsetY;

@@ -340,13 +340,14 @@ void PicYuv::copyFromPicture(const x265_picture& pic,
const x265_param& param, i
                 if (param.internalCsp != X265_CSP_I400)
                 {
                     offsetX = offsetX >> m_hChromaShift;
-                    offsetY = offsetY >> (m_hChromaShift * 2);
+                    int offsetYU = (!isBase && pic.format == 2 ?
pic.stride[1] * (height >> m_vChromaShift) : 0);
+                    int offsetYV = (!isBase && pic.format == 2 ?
pic.stride[2] * (height >> m_vChromaShift) : 0);

                     pixel *uPixel = m_picOrg[1];
                     pixel *vPixel = m_picOrg[2];

-                    uint8_t* uChar = (uint8_t*)pic.planes[1] + offsetX +
offsetY;
-                    uint8_t* vChar = (uint8_t*)pic.planes[2] + offsetX +
offsetY;
+                    uint8_t* uChar = (uint8_t*)pic.planes[1] + offsetX +
offsetYU;
+                    uint8_t* vChar = (uint8_t*)pic.planes[2] + offsetX +
offsetYV;

                     for (int r = 0; r < height >> m_vChromaShift; r++)
                     {
-- 
2.36.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240909/12a19c0f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Changed-stride-as-width-for-the-cases-stride-width.patch
Type: application/octet-stream
Size: 2106 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240909/12a19c0f/attachment.obj>


More information about the x265-devel mailing list