[x265] [PATCH] Decouple Abr-ladder and multiview flow
Pavan Tarun Chakka Venkata
pavan.tarun at multicorewareinc.com
Thu Nov 21 10:13:17 UTC 2024
>From a64a8603f8f5efb63be2e9c8d64dae02ab25acb4 Mon Sep 17 00:00:00 2001
From: AnusuyaKumarasamy <anusuya.kumarasamy at multicorewareinc.com>
Date: Thu, 14 Nov 2024 22:15:22 -0800
Subject: [PATCH] Decouple Abr-ladder and multiview flow
---
source/abrEncApp.cpp | 68 +++++++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 30 deletions(-)
diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp
index 1907e0bfb..66787ff11 100644
--- a/source/abrEncApp.cpp
+++ b/source/abrEncApp.cpp
@@ -78,10 +78,11 @@ namespace X265_NS {
bool AbrEncoder::allocBuffers()
{
#if ENABLE_MULTIVIEW
- m_inputPicBuffer = X265_MALLOC(x265_picture**, MAX_VIEWS);
-#else
- m_inputPicBuffer = X265_MALLOC(x265_picture**, m_numEncodes);
+ if(m_numInputViews > 1)
+ m_inputPicBuffer = X265_MALLOC(x265_picture**, MAX_VIEWS);
+ else
#endif
+ m_inputPicBuffer = X265_MALLOC(x265_picture**, m_numEncodes);
m_analysisBuffer = X265_MALLOC(x265_analysis_data*, m_numEncodes);
m_picWriteCnt = new ThreadSafeInteger[m_numEncodes];
@@ -145,17 +146,42 @@ namespace X265_NS {
{
x265_cleanup(); /* Free library singletons */
#if ENABLE_MULTIVIEW
- for (uint8_t pass = 0; pass < m_numInputViews; pass++)
+ if(m_numInputViews > 1)
{
- for (uint32_t index = 0; index < m_queueSize; index++)
+ for (uint8_t pass = 0; pass < m_numInputViews; pass++)
{
- X265_FREE(m_inputPicBuffer[pass][index]->planes[0]);
- x265_picture_free(m_inputPicBuffer[pass][index]);
- }
- X265_FREE(m_inputPicBuffer[pass]);
+ for (uint32_t index = 0; index < m_queueSize; index++)
+ {
+ X265_FREE(m_inputPicBuffer[pass][index]->planes[0]);
+ x265_picture_free(m_inputPicBuffer[pass][index]);
+ }
+ X265_FREE(m_inputPicBuffer[pass]);
- if (pass == 0)
+ if (pass == 0)
+ {
+ X265_FREE(m_analysisBuffer[pass]);
+ X265_FREE(m_readFlag[pass]);
+ delete[] m_picIdxReadCnt[pass];
+ delete[] m_analysisWrite[pass];
+ delete[] m_analysisRead[pass];
+ m_passEnc[pass]->destroy();
+ delete m_passEnc[pass];
+ }
+ }
+ }
+ else
+ {
+#endif
+ for (uint8_t pass = 0; pass < m_numEncodes; pass++)
{
+ for (uint32_t index = 0; index < m_queueSize; index++)
+ {
+ X265_FREE(m_inputPicBuffer[pass][index]->planes[0]);
+ x265_picture_free(m_inputPicBuffer[pass][index]);
+ X265_FREE(m_analysisBuffer[pass][index].wt);
+ }
+ X265_FREE(m_inputPicBuffer[pass]);
+
X265_FREE(m_analysisBuffer[pass]);
X265_FREE(m_readFlag[pass]);
delete[] m_picIdxReadCnt[pass];
@@ -164,25 +190,7 @@ namespace X265_NS {
m_passEnc[pass]->destroy();
delete m_passEnc[pass];
}
- }
-#else
- for (uint8_t pass = 0; pass < m_numEncodes; pass++)
- {
- for (uint32_t index = 0; index < m_queueSize; index++)
- {
- X265_FREE(m_inputPicBuffer[pass][index]->planes[0]);
- x265_picture_free(m_inputPicBuffer[pass][index]);
- X265_FREE(m_analysisBuffer[pass][index].wt);
- }
- X265_FREE(m_inputPicBuffer[pass]);
-
- X265_FREE(m_analysisBuffer[pass]);
- X265_FREE(m_readFlag[pass]);
- delete[] m_picIdxReadCnt[pass];
- delete[] m_analysisWrite[pass];
- delete[] m_analysisRead[pass];
- m_passEnc[pass]->destroy();
- delete m_passEnc[pass];
+#if ENABLE_MULTIVIEW
}
#endif
X265_FREE(m_inputPicBuffer);
@@ -1158,7 +1166,7 @@ ret:
for (int view = 0; view < m_parentEnc->m_param->numViews -
!!m_parentEnc->m_param->format; view++)
{
- x265_picture* dest =
m_parentEnc->m_parent->m_inputPicBuffer[view][writeIdx];
+ x265_picture* dest = (m_parentEnc->m_param->numViews > 1)
? m_parentEnc->m_parent->m_inputPicBuffer[view][writeIdx] :
m_parentEnc->m_parent->m_inputPicBuffer[m_id][writeIdx];
src->format = m_parentEnc->m_param->format;
if (m_input[view]->readPicture(*src))
{
--
2.36.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241121/996b04c8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Decouple-Abr-ladder-and-multiview-flow.patch
Type: application/octet-stream
Size: 4670 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241121/996b04c8/attachment-0001.obj>
More information about the x265-devel
mailing list