aboutsummaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver/PollingManager.cxx
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2007-12-25 11:25:07 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2007-12-25 11:25:07 +0000
commitbb56377fedf3058d2051764ab16b2b57419cca60 (patch)
tree0dd9971ca7220e86e3abb04596e441394201a7dd /unix/x0vncserver/PollingManager.cxx
parent1b73858423cc697aa3e927d1d65371a394f5eff2 (diff)
downloadtigervnc-bb56377fedf3058d2051764ab16b2b57419cca60.tar.gz
tigervnc-bb56377fedf3058d2051764ab16b2b57419cca60.zip
Making sure that both height and width of the video area are always multiples of 32. This is important for hardware JPEG encoders.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2378 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/x0vncserver/PollingManager.cxx')
-rw-r--r--unix/x0vncserver/PollingManager.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx
index b506bb4f..5cd611bd 100644
--- a/unix/x0vncserver/PollingManager.cxx
+++ b/unix/x0vncserver/PollingManager.cxx
@@ -280,10 +280,22 @@ PollingManager::detectVideo()
const int VIDEO_THRESHOLD_0 = 3;
const int VIDEO_THRESHOLD_1 = 5;
+ // In m_rateMatrix, clear counters corresponding to non-32x32 tiles.
+ // This will guarantee that the size of the video area is always a
+ // multiple of 32 pixels. This is important for hardware JPEG encoders.
+ int numTiles = m_heightTiles * m_widthTiles;
+ if (m_width % 32 != 0) {
+ for (int n = m_widthTiles - 1; n < numTiles; n += m_widthTiles)
+ m_rateMatrix[n] = 0;
+ }
+ if (m_height % 32 != 0) {
+ for (int n = numTiles - m_widthTiles; n < numTiles; n++)
+ m_rateMatrix[n] = 0;
+ }
+
// First, detect candidate region that looks like video. In other
// words, find a region that consists of continuously changing
// pixels. Save the result in m_videoFlags[].
- int numTiles = m_heightTiles * m_widthTiles;
for (int i = 0; i < numTiles; i++) {
if (m_rateMatrix[i] <= VIDEO_THRESHOLD_0) {
m_videoFlags[i] = 0;