From 1b73858423cc697aa3e927d1d65371a394f5eff2 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Thu, 20 Dec 2007 15:30:20 +0000 Subject: [PATCH] IrixDMJpegCompressor is now preferred to IrixCLJpegCompressor. Debugging behavior was either removed or made dependent on the DEBUG_FORCE_CL define. This define allows testing of Irix CL software-only JPEG compressor which normally would not be used. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2377 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/IrixCLJpegCompressor.cxx | 19 ++++------------- common/rfb/JpegEncoder.cxx | 33 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/common/rfb/IrixCLJpegCompressor.cxx b/common/rfb/IrixCLJpegCompressor.cxx index 3e33a0c1..5fef1660 100644 --- a/common/rfb/IrixCLJpegCompressor.cxx +++ b/common/rfb/IrixCLJpegCompressor.cxx @@ -45,16 +45,15 @@ IrixCLJpegCompressor::IrixCLJpegCompressor() return; } - // DEBUG: Uncomment to test without hardware compressor. - /* - vlog.debug("Trying Irix software JPEG compressor (debug mode!)"); +#ifdef DEBUG_FORCE_CL + vlog.debug("DEBUG: Trying Irix software JPEG compressor"); r = clOpenCompressor(CL_JPEG_SOFTWARE, &m_clHandle); if (r == SUCCESS) { - vlog.debug("Using Irix software JPEG compressor (debug mode!)"); + vlog.debug("DEBUG: Using Irix software JPEG compressor"); m_clHandleValid = true; return; } - */ +#endif vlog.error("Ho hardware JPEG available via Irix CL library"); } @@ -129,16 +128,6 @@ IrixCLJpegCompressor::compress(const rdr::U32 *buf, // Determine buffer size required. int newBufferSize = clGetParam(m_clHandle, CL_COMPRESSED_BUFFER_SIZE); - /* DEBUG: - int arr[200]; - int nn = clQueryParams(m_clHandle, arr, 200); - vlog.debug("Params:"); - for (int ii = 0; ii < nn; ii += 2) { - int id = clGetParamID(m_clHandle, (char *)arr[ii]); - vlog.debug(" %s = %d", (char*)arr[ii], clGetParam(m_clHandle, id)); - } - */ - // (Re)allocate destination buffer if necessary. if (newBufferSize > m_dstBufferSize) { if (m_compressedData) diff --git a/common/rfb/JpegEncoder.cxx b/common/rfb/JpegEncoder.cxx index 1d9b3c79..f3dbdeed 100644 --- a/common/rfb/JpegEncoder.cxx +++ b/common/rfb/JpegEncoder.cxx @@ -45,21 +45,10 @@ const int JpegEncoder::qualityMap[10] = { JpegEncoder::JpegEncoder(SMsgWriter* writer_) : writer(writer_), jcomp(0) { - // FIXME: DM should be preferred over CL. -#ifdef HAVE_CL - if (!jcomp && useHardwareJPEG) { - vlog.debug("trying IRIX CL JPEG compressor"); - IrixCLJpegCompressor *clComp = new IrixCLJpegCompressor; - if (clComp->isValid()) { - vlog.debug("initialized IRIX CL JPEG compressor successfully"); - jcomp = clComp; - } else { - vlog.error("warning: could not create IRIX CL JPEG compressor"); - delete clComp; - } - } -#endif #ifdef HAVE_DMEDIA +#ifdef DEBUG_FORCE_CL + vlog.debug("DEBUG: skipping IRIX DM JPEG compressor"); +#else if (!jcomp && useHardwareJPEG) { vlog.debug("trying IRIX DM JPEG compressor"); IrixDMJpegCompressor *dmComp = new IrixDMJpegCompressor; @@ -72,6 +61,22 @@ JpegEncoder::JpegEncoder(SMsgWriter* writer_) : writer(writer_), jcomp(0) } } #endif +#endif + +#ifdef HAVE_CL + if (!jcomp && useHardwareJPEG) { + vlog.debug("trying IRIX CL JPEG compressor"); + IrixCLJpegCompressor *clComp = new IrixCLJpegCompressor; + if (clComp->isValid()) { + vlog.debug("initialized IRIX CL JPEG compressor successfully"); + jcomp = clComp; + } else { + vlog.error("warning: could not create IRIX CL JPEG compressor"); + delete clComp; + } + } +#endif + if (!jcomp) { if (useHardwareJPEG) { vlog.info("no hardware JPEG compressor available"); -- 2.39.5