diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx
new file mode 100644
index 0000000..7bb6126
--- /dev/null
+++ b/common/rfb/TightJPEGEncoder.cxx
@@ -0,0 +1,168 @@
+/* Copyright (C) 2000-2003 Constantin Kaplinsky.  All Rights Reserved.
+ * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
+ * Copyright 2014 Pierre Ossman for Cendio AB
+ * 
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+#include <rdr/OutStream.h>
+#include <rfb/encodings.h>
+#include <rfb/SConnection.h>
+#include <rfb/PixelBuffer.h>
+#include <rfb/TightJPEGEncoder.h>
+#include <rfb/TightConstants.h>
+
+using namespace rfb;
+
+struct TightJPEGConfiguration {
+    int quality;
+    int subsampling;
+};
+
+// NOTE:  The JPEG quality and subsampling levels below were obtained
+// experimentally by the VirtualGL Project.  They represent the approximate
+// average compression ratios listed below, as measured across the set of
+// every 10th frame in the SPECviewperf 9 benchmark suite.
+//
+// 9 = JPEG quality 100, no subsampling (ratio ~= 10:1)
+//     [this should be lossless, except for round-off error]
+// 8 = JPEG quality 92,  no subsampling (ratio ~= 20:1)
+//     [this should be perceptually lossless, based on current research]
+// 7 = JPEG quality 86,  no subsampling (ratio ~= 25:1)
+// 6 = JPEG quality 79,  no subsampling (ratio ~= 30:1)
+// 5 = JPEG quality 77,  4:2:2 subsampling (ratio ~= 40:1)
+// 4 = JPEG quality 62,  4:2:2 subsampling (ratio ~= 50:1)
+// 3 = JPEG quality 42,  4:2:2 subsampling (ratio ~= 60:1)
+// 2 = JPEG quality 41,  4:2:0 subsampling (ratio ~= 70:1)
+// 1 = JPEG quality 29,  4:2:0 subsampling (ratio ~= 80:1)
+// 0 = JPEG quality 15,  4:2:0 subsampling (ratio ~= 100:1)
+
+static const struct TightJPEGConfiguration conf[10] = {
+  {  15, subsample4X }, // 0
+  {  29, subsample4X }, // 1
+  {  41, subsample4X }, // 2
+  {  42, subsample2X }, // 3
+  {  62, subsample2X }, // 4
+  {  77, subsample2X }, // 5
+  {  79, subsampleNone }, // 6
+  {  86, subsampleNone }, // 7
+  {  92, subsampleNone }, // 8
+  { 100, subsampleNone }  // 9
+};
+
+
+TightJPEGEncoder::TightJPEGEncoder(SConnection* conn) :
+  Encoder(conn, encodingTight, EncoderUseNativePF, -1),
+  qualityLevel(-1), fineQuality(-1), fineSubsampling(subsampleUndefined)
+{
+}
+
+TightJPEGEncoder::~TightJPEGEncoder()
+{
+}
+
+bool TightJPEGEncoder::isSupported()
+{
+  if (!conn->cp.supportsEncoding(encodingTight))
+    return false;
+
+  // Any one of these indicates support for JPEG
+  if (conn->cp.qualityLevel != -1)
+    return true;
+  if (conn->cp.fineQualityLevel != -1)
+    return true;
+  if (conn->cp.subsampling != -1)
+    return true;
+
+  // Tight support, but not JPEG
+  return false;
+}
+
+void TightJPEGEncoder::setQualityLevel(int level)
+{
+  qualityLevel = level;
+}
+
+void TightJPEGEncoder::setFineQualityLevel(int quality, int subsampling)
+{
+  fineQuality = quality;
+  fineSubsampling = subsampling;
+}
+
+void TightJPEGEncoder::writeRect(const PixelBuffer* pb, const Palette& palette)
+{
+  const rdr::U8* buffer;
+  int stride;
+
+  int quality, subsampling;
+
+  rdr::OutStream* os;
+
+  buffer = pb->getBuffer(pb->getRect(), &stride);
+
+  if (qualityLevel >= 0 && qualityLevel <= 9) {
+    quality = conf[qualityLevel].quality;
+    subsampling = conf[qualityLevel].subsampling;
+  } else {
+    quality = -1;
+    subsampling = subsampleUndefined;
+  }
+
+  // Fine settings trump level
+  if (fineQuality != -1)
+    quality = fineQuality;
+  if (fineSubsampling != subsampleUndefined)
+    subsampling = fineSubsampling;
+
+  jc.clear();
+  jc.compress(buffer, stride, pb->getRect(),
+              pb->getPF(), quality, subsampling);
+
+  os = conn->getOutStream();
+
+  os->writeU8(tightJpeg << 4);
+
+  writeCompact(jc.length(), os);
+  os->writeBytes(jc.data(), jc.length());
+}
+
+void TightJPEGEncoder::writeSolidRect(int width, int height,
+                                      const PixelFormat& pf,
+                                      const rdr::U8* colour)
+{
+  // FIXME: Add a shortcut in the JPEG compressor to handle this case
+  //        without having to use the default fallback which is very slow.
+  Encoder::writeSolidRect(width, height, pf, colour);
+}
+
+void TightJPEGEncoder::writeCompact(rdr::U32 value, rdr::OutStream* os)
+{
+  // Copied from TightEncoder as it's overkill to inherit just for this
+  rdr::U8 b;
+
+  b = value & 0x7F;
+  if (value <= 0x7F) {
+    os->writeU8(b);
+  } else {
+    os->writeU8(b | 0x80);
+    b = value >> 7 & 0x7F;
+    if (value <= 0x3FFF) {
+      os->writeU8(b);
+    } else {
+      os->writeU8(b | 0x80);
+      os->writeU8(value >> 14 & 0xFF);
+    }
+  }
+}
