[x265] [PATCH] Fix issue in non scalable flow & increased NAL unit size for scalable feature

Anusuya Kumarasamy anusuya.kumarasamy at multicorewareinc.com
Mon Sep 9 08:51:34 UTC 2024


>From aaff52c8a1d2f1c48800dac864fab2bad79307cd Mon Sep 17 00:00:00 2001
From: AnusuyaKumarasamy <anusuya.kumarasamy at multicorewareinc.com>
Date: Fri, 6 Sep 2024 17:21:20 +0530
Subject: [PATCH 7/7] Fix issue in non scalable flow & increased NAL unit
size
 for scalable feature

---
 source/common/param.cpp         | 2 ++
 source/common/slice.h           | 2 +-
 source/encoder/encoder.cpp      | 5 ++++-
 source/encoder/frameencoder.cpp | 4 ++--
 source/encoder/nal.h            | 4 ++++
 source/x265cli.cpp              | 6 +++---
 6 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/source/common/param.cpp b/source/common/param.cpp
index 72561a9cf..d08bb604e 100755
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1959,11 +1959,13 @@ int x265_check_params(x265_param* param)
     if (param->bEnableAlpha)
     {
         CHECK((param->internalCsp != X265_CSP_I420), "Alpha encode
supported only with i420a colorspace");
+        CHECK((param->analysisMultiPassDistortion ||
param->analysisMultiPassRefine), "Alpha encode doesnot support multipass
feature");
     }
 #endif
 #if ENABLE_MULTIVIEW
     CHECK((param->numViews > 2), "Multi-View Encoding currently support
only 2 views");
     CHECK((param->numViews > 1) && (param->internalBitDepth != 8),
"BitDepthConstraint must be 8 for Multiview main profile");
+    CHECK((param->numViews > 1) && (param->analysisMultiPassDistortion ||
param->analysisMultiPassRefine), "Multiview encode doesnot support
multipass feature");
 #endif
 #if ENABLE_SCC_EXT
     CHECK(!!param->bEnableSCC&& param->rdLevel != 6, "Enabling scc
extension in x265 requires rdlevel of 6 ");
diff --git a/source/common/slice.h b/source/common/slice.h
index 022ce4d75..041bc451e 100644
--- a/source/common/slice.h
+++ b/source/common/slice.h
@@ -173,7 +173,7 @@ struct VPS
     int              scalabilityTypes;
     uint8_t          m_dimensionIdLen[MAX_VPS_NUM_SCALABILITY_TYPES];
     uint8_t
 m_dimensionId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_NUM_SCALABILITY_TYPES];
-    bool              m_nuhLayerIdPresentFlag;
+    bool             m_nuhLayerIdPresentFlag;
     uint8_t          m_layerIdInNuh[MAX_VPS_LAYER_ID_PLUS1];
     uint8_t          m_layerIdInVps[MAX_VPS_LAYER_ID_PLUS1];
     int              m_viewIdLen;
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 5d718392f..65c247aba 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -3670,7 +3670,10 @@ void Encoder::initSPS(SPS *sps)
     }
 #endif

-    sps->sps_extension_flag = m_param->bEnableSCC ? true : false;
+#if ENABLE_SCC_EXT
+    if(m_param->bEnableSCC)
+        sps->sps_extension_flag = true;
+#endif

 }

diff --git a/source/encoder/frameencoder.cpp
b/source/encoder/frameencoder.cpp
index 09ed0b9f7..b1c6f333b 100644
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -2338,8 +2338,8 @@ void
FrameEncoder::readModel(FilmGrainCharacteristics* m_filmGrain, FILE* filmgr
 #if ENABLE_LIBVMAF
 void FrameEncoder::vmafFrameLevelScore()
 {
-    PicYuv *fenc = m_frame->m_fencPic;
-    PicYuv *recon = m_frame->m_reconPic[0];
+    PicYuv *fenc = m_frame[0]->m_fencPic;
+    PicYuv *recon = m_frame[0]->m_reconPic[0];

     x265_vmaf_framedata *vmafframedata =
(x265_vmaf_framedata*)x265_malloc(sizeof(x265_vmaf_framedata));
     if (!vmafframedata)
diff --git a/source/encoder/nal.h b/source/encoder/nal.h
index 03752cdd6..15d3205d9 100644
--- a/source/encoder/nal.h
+++ b/source/encoder/nal.h
@@ -35,7 +35,11 @@ class Bitstream;
 class NALList
 {
 public:
+#if ENABLE_MULTIVIEW || ENABLE_ALPHA
+    static const int MAX_NAL_UNITS = 32;
+#else
     static const int MAX_NAL_UNITS = 16;
+#endif

 public:

diff --git a/source/x265cli.cpp b/source/x265cli.cpp
index d4fe886cc..89852c701 100755
--- a/source/x265cli.cpp
+++ b/source/x265cli.cpp
@@ -1009,7 +1009,7 @@ namespace X265_NS {
             x265_log(param, X265_LOG_ERROR, "recon file must be specified
to get VMAF score, try --help for help\n");
             return true;
         }
-        const char *str = strrchr(info.filename, '.');
+        const char *str = strrchr(info[0].filename, '.');

         if (!strcmp(str, ".y4m"))
         {
@@ -1018,8 +1018,8 @@ namespace X265_NS {
         }
         if (param->internalCsp == X265_CSP_I420 || param->internalCsp ==
X265_CSP_I422 || param->internalCsp == X265_CSP_I444)
         {
-            vmafData->reference_file = x265_fopen(inputfn, "rb");
-            vmafData->distorted_file = x265_fopen(reconfn, "rb");
+            vmafData->reference_file = x265_fopen(inputfn[0], "rb");
+            vmafData->distorted_file = x265_fopen(reconfn[0], "rb");
         }
         else
         {
-- 
2.36.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240909/c7f34ade/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Fix-issue-in-non-scalable-flow-increased-NAL-unit-si.patch
Type: application/octet-stream
Size: 4740 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240909/c7f34ade/attachment-0001.obj>


More information about the x265-devel mailing list