[x265] [PATCH] fix VBV hash mistake on re-encode mode
Min Chen
chenm003 at 163.com
Wed Feb 17 05:39:51 CET 2016
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1455683982 -28800
# Node ID 07986e2a495a915d3ffe86fae29298b46724b5fa
# Parent 425b583f25dbb57af86fc5c128548038954baf31
fix VBV hash mistake on re-encode mode
---
source/encoder/frameencoder.cpp | 64 ++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 30 deletions(-)
diff -r 425b583f25db -r 07986e2a495a source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Thu Feb 11 13:15:03 2016 +0530
+++ b/source/encoder/frameencoder.cpp Wed Feb 17 12:39:42 2016 +0800
@@ -969,44 +969,48 @@
/* Deblock with idle threading */
if (m_param->bEnableLoopFilter | m_param->bEnableSAO)
{
- // TODO: Multiple Threading
- // Delay ONE row to avoid Intra Prediction Conflict
- if (m_pool && (row >= 1))
+ // NOTE: in VBV mode, we may reencode anytime, so we can't do Deblock stage-Horizon and SAO
+ if (!bIsVbv)
{
- // Waitting last threading finish
- m_frameFilter.m_parallelFilter[row - 1].waitForExit();
+ // TODO: Multiple Threading
+ // Delay ONE row to avoid Intra Prediction Conflict
+ if (m_pool && (row >= 1))
+ {
+ // Waitting last threading finish
+ m_frameFilter.m_parallelFilter[row - 1].waitForExit();
- // Processing new group
- int allowCol = col;
+ // Processing new group
+ int allowCol = col;
- // avoid race condition on last column
- if (row >= 2)
+ // avoid race condition on last column
+ if (row >= 2)
+ {
+ allowCol = X265_MIN(((col == numCols - 1) ? m_frameFilter.m_parallelFilter[row - 2].m_lastDeblocked.get()
+ : m_frameFilter.m_parallelFilter[row - 2].m_lastCol.get()), (int)col);
+ }
+ m_frameFilter.m_parallelFilter[row - 1].m_allowedCol.set(allowCol);
+ m_frameFilter.m_parallelFilter[row - 1].tryBondPeers(*this, 1);
+ }
+
+ // Last Row may start early
+ if (m_pool && (row == m_numRows - 1))
{
- allowCol = X265_MIN(((col == numCols - 1) ? m_frameFilter.m_parallelFilter[row - 2].m_lastDeblocked.get()
- : m_frameFilter.m_parallelFilter[row - 2].m_lastCol.get()), (int)col);
+ // Waiting for the last thread to finish
+ m_frameFilter.m_parallelFilter[row].waitForExit();
+
+ // Deblocking last row
+ int allowCol = col;
+
+ // avoid race condition on last column
+ if (row >= 2)
+ {
+ allowCol = X265_MIN(((col == numCols - 1) ? m_frameFilter.m_parallelFilter[row - 1].m_lastDeblocked.get()
+ : m_frameFilter.m_parallelFilter[row - 1].m_lastCol.get()), (int)col);
+ }
+ m_frameFilter.m_parallelFilter[row].m_allowedCol.set(allowCol);
+ m_frameFilter.m_parallelFilter[row].tryBondPeers(*this, 1);
}
- m_frameFilter.m_parallelFilter[row - 1].m_allowedCol.set(allowCol);
- m_frameFilter.m_parallelFilter[row - 1].tryBondPeers(*this, 1);
- }
-
- // Last Row may start early
- if (m_pool && (row == m_numRows - 1))
- {
- // Waiting for the last thread to finish
- m_frameFilter.m_parallelFilter[row].waitForExit();
-
- // Deblocking last row
- int allowCol = col;
-
- // avoid race condition on last column
- if (row >= 2)
- {
- allowCol = X265_MIN(((col == numCols - 1) ? m_frameFilter.m_parallelFilter[row - 1].m_lastDeblocked.get()
- : m_frameFilter.m_parallelFilter[row - 1].m_lastCol.get()), (int)col);
- }
- m_frameFilter.m_parallelFilter[row].m_allowedCol.set(allowCol);
- m_frameFilter.m_parallelFilter[row].tryBondPeers(*this, 1);
- }
+ } // end of !bIsVbv
}
// Both Loopfilter and SAO Disabled
else
More information about the x265-devel
mailing list