Commit 896ca203 authored by Joel Martin's avatar Joel Martin Committed by Christian Beier

tightPng: Add initial tightPng encoding support.

http://wiki.qemu.org/VNC_Tight_PNGSigned-off-by: 's avatarJoel Martin <github@martintribe.org>
Signed-off-by: 's avatarChristian Beier <dontmind@freeshell.org>
parent 17ce0c56
...@@ -15,6 +15,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/ ...@@ -15,6 +15,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/
find_package(ZLIB) find_package(ZLIB)
find_package(JPEG) find_package(JPEG)
find_package(PNG)
find_package(SDL) find_package(SDL)
find_package(GnuTLS) find_package(GnuTLS)
find_package(Threads) find_package(Threads)
...@@ -30,6 +31,9 @@ endif(ZLIB_FOUND) ...@@ -30,6 +31,9 @@ endif(ZLIB_FOUND)
if(JPEG_FOUND) if(JPEG_FOUND)
set(LIBVNCSERVER_HAVE_LIBJPEG 1) set(LIBVNCSERVER_HAVE_LIBJPEG 1)
endif(JPEG_FOUND) endif(JPEG_FOUND)
if(PNG_FOUND)
set(LIBVNCSERVER_HAVE_LIBPNG 1)
endif(PNG_FOUND)
option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON) option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON)
if(GNUTLS_FOUND) if(GNUTLS_FOUND)
set(LIBVNCSERVER_WITH_CLIENT_TLS 1) set(LIBVNCSERVER_WITH_CLIENT_TLS 1)
...@@ -142,12 +146,21 @@ endif(ZLIB_FOUND) ...@@ -142,12 +146,21 @@ endif(ZLIB_FOUND)
if(JPEG_FOUND) if(JPEG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG) add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
include_directories(${JPEG_INCLUDE_DIR}) include_directories(${JPEG_INCLUDE_DIR})
set(LIBVNCSERVER_SOURCES set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c)
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/tight.c
)
endif(JPEG_FOUND) endif(JPEG_FOUND)
if(PNG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBPNG)
include_directories(${PNG_INCLUDE_DIR})
set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c)
endif(PNG_FOUND)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${TIGHT_C}
)
if(TIGHTVNC_FILETRANSFER) if(TIGHTVNC_FILETRANSFER)
set(LIBVNCSERVER_SOURCES set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES} ${LIBVNCSERVER_SOURCES}
...@@ -174,6 +187,7 @@ target_link_libraries(vncserver ...@@ -174,6 +187,7 @@ target_link_libraries(vncserver
${ADDITIONAL_LIBS} ${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${JPEG_LIBRARIES} ${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${SDL_LIBRARY} ${SDL_LIBRARY}
) )
......
...@@ -578,6 +578,60 @@ ftp://ftp.uu.net/graphics/jpeg/ ...@@ -578,6 +578,60 @@ ftp://ftp.uu.net/graphics/jpeg/
fi fi
fi fi
AC_ARG_WITH(png,
[ --without-png disable support for png]
[ --with-png=DIR use png include/library files in DIR],,)
# At this point:
# no png on command line with_png=""
# -with-png with_png="yes"
# -without-png with_png="no"
# -with-png=/foo/dir with_png="/foo/dir"
if test "x$with_png" != "xno"; then
if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
# add user supplied directory to flags:
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS -I$with_png/include"
LDFLAGS="$LDFLAGS -L$with_png/lib"
if test "x$ld_minus_R" = "xno"; then
:
elif test "x$GCC" = "xyes"; then
# this is not complete... in general a rat's nest.
LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib"
else
LDFLAGS="$LDFLAGS -R$with_png/lib"
fi
fi
AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true")
if test "x$HAVE_PNGLIB_H" = "xtrue"; then
AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="")
fi
if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
if test "x$HAVE_PNGLIB_H" != "xtrue"; then
# restore old flags on failure:
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
fi
fi
if test "$build_x11vnc" = "yes"; then
if test "x$HAVE_PNGLIB_H" != "xtrue"; then
AC_MSG_WARN([
==========================================================================
*** The libpng compression library was not found. ***
This may lead to reduced performance, especially over slow links.
If libpng is in a non-standard location use --with-png=DIR to
indicate the header file is in DIR/include/png.h and the library
in DIR/lib/libpng.a. A copy of libpng may be obtained from:
http://www.libpng.org/pub/png/libpng.html
==========================================================================
])
sleep 5
fi
fi
fi
AC_ARG_WITH(libz, AC_ARG_WITH(libz,
[ --without-libz disable support for deflate],,) [ --without-libz disable support for deflate],,)
AC_ARG_WITH(zlib, AC_ARG_WITH(zlib,
...@@ -654,6 +708,7 @@ AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = ...@@ -654,6 +708,7 @@ AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" =
AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H") AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H") AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H")
SDLCONFIG="sdl-config" SDLCONFIG="sdl-config"
......
...@@ -29,7 +29,11 @@ EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \ ...@@ -29,7 +29,11 @@ EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \
if HAVE_LIBZ if HAVE_LIBZ
ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c
if HAVE_LIBJPEG if HAVE_LIBJPEG
JPEGSRCS = tight.c TIGHTSRCS = tight.c
else
if HAVE_LIBPNG
TIGHTSRCS = tight.c
endif
endif endif
endif endif
...@@ -37,7 +41,7 @@ LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c \ ...@@ -37,7 +41,7 @@ LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c \
stats.c corre.c hextile.c rre.c translate.c cutpaste.c \ stats.c corre.c hextile.c rre.c translate.c cutpaste.c \
httpd.c cursor.c font.c \ httpd.c cursor.c font.c \
draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \ draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \
$(ZLIBSRCS) $(JPEGSRCS) $(TIGHTVNCFILETRANSFERSRCS) $(ZLIBSRCS) $(TIGHTSRCS) $(TIGHTVNCFILETRANSFERSRCS)
libvncserver_la_SOURCES=$(LIB_SRCS) libvncserver_la_SOURCES=$(LIB_SRCS)
......
...@@ -358,10 +358,12 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen, ...@@ -358,10 +358,12 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
rfbScreen->clientHead = cl; rfbScreen->clientHead = cl;
UNLOCK(rfbClientListMutex); UNLOCK(rfbClientListMutex);
#ifdef LIBVNCSERVER_HAVE_LIBZ #if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
cl->tightQualityLevel = -1; cl->tightQualityLevel = -1;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG)
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
#endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -917,6 +919,9 @@ rfbSendSupportedEncodings(rfbClientPtr cl) ...@@ -917,6 +919,9 @@ rfbSendSupportedEncodings(rfbClientPtr cl)
#endif #endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
rfbEncodingTight, rfbEncodingTight,
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPNG
rfbEncodingTightPng,
#endif #endif
rfbEncodingUltra, rfbEncodingUltra,
rfbEncodingUltraZip, rfbEncodingUltraZip,
...@@ -1937,6 +1942,9 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -1937,6 +1942,9 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
case rfbEncodingTight: case rfbEncodingTight:
#endif #endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPNG
case rfbEncodingTightPng:
#endif #endif
/* The first supported encoding is the 'preferred' encoding */ /* The first supported encoding is the 'preferred' encoding */
if (cl->preferredEncoding == -1) if (cl->preferredEncoding == -1)
...@@ -2026,11 +2034,11 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -2026,11 +2034,11 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
} }
break; break;
default: default:
#ifdef LIBVNCSERVER_HAVE_LIBZ #if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
if ( enc >= (uint32_t)rfbEncodingCompressLevel0 && if ( enc >= (uint32_t)rfbEncodingCompressLevel0 &&
enc <= (uint32_t)rfbEncodingCompressLevel9 ) { enc <= (uint32_t)rfbEncodingCompressLevel9 ) {
cl->zlibCompressLevel = enc & 0x0F; cl->zlibCompressLevel = enc & 0x0F;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG)
cl->tightCompressLevel = enc & 0x0F; cl->tightCompressLevel = enc & 0x0F;
rfbLog("Using compression level %d for client %s\n", rfbLog("Using compression level %d for client %s\n",
cl->tightCompressLevel, cl->host); cl->tightCompressLevel, cl->host);
...@@ -2754,6 +2762,28 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2754,6 +2762,28 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
} }
sraRgnReleaseIterator(i); i=NULL; sraRgnReleaseIterator(i); i=NULL;
#endif #endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPNG
} else if (cl->preferredEncoding == rfbEncodingTightPng) {
nUpdateRegionRects = 0;
for(i = sraRgnGetIterator(updateRegion); sraRgnIteratorNext(i,&rect);){
int x = rect.x1;
int y = rect.y1;
int w = rect.x2 - x;
int h = rect.y2 - y;
int n;
/* We need to count the number of rects in the scaled screen */
if (cl->screen!=cl->scaledScreen)
rfbScaledCorrection(cl->screen, cl->scaledScreen, &x, &y, &w, &h, "rfbSendFramebufferUpdate");
n = rfbNumCodedRectsTight(cl, x, y, w, h);
if (n == 0) {
nUpdateRegionRects = 0xFFFF;
break;
}
nUpdateRegionRects += n;
}
sraRgnReleaseIterator(i); i=NULL;
#endif #endif
} else { } else {
nUpdateRegionRects = sraRgnCountRects(updateRegion); nUpdateRegionRects = sraRgnCountRects(updateRegion);
...@@ -2773,6 +2803,10 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2773,6 +2803,10 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
/* Tight encoding counts the rectangles differently */ /* Tight encoding counts the rectangles differently */
&& cl->preferredEncoding != rfbEncodingTight && cl->preferredEncoding != rfbEncodingTight
#endif #endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPNG
/* Tight encoding counts the rectangles differently */
&& cl->preferredEncoding != rfbEncodingTightPng
#endif #endif
&& nUpdateRegionRects>cl->screen->maxRectsPerUpdate) { && nUpdateRegionRects>cl->screen->maxRectsPerUpdate) {
sraRegion* newUpdateRegion = sraRgnBBox(updateRegion); sraRegion* newUpdateRegion = sraRgnBBox(updateRegion);
...@@ -2868,6 +2902,13 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2868,6 +2902,13 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
break; break;
#endif #endif
#endif #endif
#ifdef LIBVNCSERVER_HAVE_LIBPNG
case rfbEncodingTightPng:
/* TODO */
if (!rfbSendRectEncodingTightPng(cl, x, y, w, h))
goto updateFailed;
break;
#endif
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
case rfbEncodingZRLE: case rfbEncodingZRLE:
case rfbEncodingZYWRLE: case rfbEncodingZYWRLE:
......
...@@ -100,6 +100,7 @@ char *encodingName(uint32_t type, char *buf, int len) { ...@@ -100,6 +100,7 @@ char *encodingName(uint32_t type, char *buf, int len) {
case rfbEncodingHextile: snprintf(buf, len, "hextile"); break; case rfbEncodingHextile: snprintf(buf, len, "hextile"); break;
case rfbEncodingZlib: snprintf(buf, len, "zlib"); break; case rfbEncodingZlib: snprintf(buf, len, "zlib"); break;
case rfbEncodingTight: snprintf(buf, len, "tight"); break; case rfbEncodingTight: snprintf(buf, len, "tight"); break;
case rfbEncodingTightPng: snprintf(buf, len, "tightPng"); break;
case rfbEncodingZlibHex: snprintf(buf, len, "zlibhex"); break; case rfbEncodingZlibHex: snprintf(buf, len, "zlibhex"); break;
case rfbEncodingUltra: snprintf(buf, len, "ultra"); break; case rfbEncodingUltra: snprintf(buf, len, "ultra"); break;
case rfbEncodingZRLE: snprintf(buf, len, "ZRLE"); break; case rfbEncodingZRLE: snprintf(buf, len, "ZRLE"); break;
......
This diff is collapsed.
...@@ -542,7 +542,9 @@ typedef struct _rfbClientRec { ...@@ -542,7 +542,9 @@ typedef struct _rfbClientRec {
struct z_stream_s compStream; struct z_stream_s compStream;
rfbBool compStreamInited; rfbBool compStreamInited;
uint32_t zlibCompressLevel; uint32_t zlibCompressLevel;
/** the quality level is also used by ZYWRLE */ #endif
#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
/** the quality level is also used by ZYWRLE and TightPng */
int tightQualityLevel; int tightQualityLevel;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
...@@ -550,6 +552,8 @@ typedef struct _rfbClientRec { ...@@ -550,6 +552,8 @@ typedef struct _rfbClientRec {
z_stream zsStruct[4]; z_stream zsStruct[4];
rfbBool zsActive[4]; rfbBool zsActive[4];
int zsLevel[4]; int zsLevel[4];
#endif
#if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG)
int tightCompressLevel; int tightCompressLevel;
#endif #endif
#endif #endif
...@@ -624,6 +628,9 @@ typedef struct _rfbClientRec { ...@@ -624,6 +628,9 @@ typedef struct _rfbClientRec {
char *afterEncBuf; char *afterEncBuf;
int afterEncBufSize; int afterEncBufSize;
int afterEncBufLen; int afterEncBufLen;
#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */
#endif
} rfbClientRec, *rfbClientPtr; } rfbClientRec, *rfbClientPtr;
/** /**
...@@ -800,7 +807,7 @@ extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h ...@@ -800,7 +807,7 @@ extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h
extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
int h); int h);
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG)
/* tight.c */ /* tight.c */
#define TIGHT_DEFAULT_COMPRESSION 6 #define TIGHT_DEFAULT_COMPRESSION 6
...@@ -808,7 +815,13 @@ extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, ...@@ -808,7 +815,13 @@ extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
extern rfbBool rfbTightDisableGradient; extern rfbBool rfbTightDisableGradient;
extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
#if defined(LIBVNCSERVER_HAVE_LIBJPEG)
extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h); extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
#endif
#if defined(LIBVNCSERVER_HAVE_LIBPNG)
extern rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x,int y,int w,int h);
#endif
#endif #endif
#endif #endif
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
/* Define to 1 if you have the `jpeg' library (-ljpeg). */ /* Define to 1 if you have the `jpeg' library (-ljpeg). */
#cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1 #cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1
/* Define if you have the `png' library (-lpng). */
#cmakedefine LIBVNCSERVER_HAVE_LIBPNG 1
/* Define to 1 if you have the `pthread' library (-lpthread). */ /* Define to 1 if you have the `pthread' library (-lpthread). */
#cmakedefine LIBVNCSERVER_HAVE_LIBPTHREAD 1 #cmakedefine LIBVNCSERVER_HAVE_LIBPTHREAD 1
......
...@@ -434,6 +434,7 @@ typedef struct { ...@@ -434,6 +434,7 @@ typedef struct {
#define rfbEncodingHextile 5 #define rfbEncodingHextile 5
#define rfbEncodingZlib 6 #define rfbEncodingZlib 6
#define rfbEncodingTight 7 #define rfbEncodingTight 7
#define rfbEncodingTightPng 0xFFFFFEFC /* -260 */
#define rfbEncodingZlibHex 8 #define rfbEncodingZlibHex 8
#define rfbEncodingUltra 9 #define rfbEncodingUltra 9
#define rfbEncodingZRLE 16 #define rfbEncodingZRLE 16
...@@ -704,7 +705,10 @@ typedef struct { ...@@ -704,7 +705,10 @@ typedef struct {
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Tight Encoding. * Tight and TightPng Encoding.
*
*-- TightPng is like Tight but basic compression is not used, instead PNG
* data is sent.
* *
*-- The first byte of each Tight-encoded rectangle is a "compression control *-- The first byte of each Tight-encoded rectangle is a "compression control
* byte". Its format is as follows (bit 0 is the least significant one): * byte". Its format is as follows (bit 0 is the least significant one):
...@@ -715,8 +719,9 @@ typedef struct { ...@@ -715,8 +719,9 @@ typedef struct {
* bit 3: if 1, then compression stream 3 should be reset; * bit 3: if 1, then compression stream 3 should be reset;
* bits 7-4: if 1000 (0x08), then the compression type is "fill", * bits 7-4: if 1000 (0x08), then the compression type is "fill",
* if 1001 (0x09), then the compression type is "jpeg", * if 1001 (0x09), then the compression type is "jpeg",
* if 1001 (0x0A), then the compression type is "png",
* if 0xxx, then the compression type is "basic", * if 0xxx, then the compression type is "basic",
* values greater than 1001 are not valid. * values greater than 1010 are not valid.
* *
* If the compression type is "basic", then bits 6..4 of the * If the compression type is "basic", then bits 6..4 of the
* compression control byte (those xxx in 0xxx) specify the following: * compression control byte (those xxx in 0xxx) specify the following:
...@@ -726,17 +731,17 @@ typedef struct { ...@@ -726,17 +731,17 @@ typedef struct {
* bit 6: if 1, then a "filter id" byte is following this byte. * bit 6: if 1, then a "filter id" byte is following this byte.
* *
*-- The data that follows after the compression control byte described *-- The data that follows after the compression control byte described
* above depends on the compression type ("fill", "jpeg" or "basic"). * above depends on the compression type ("fill", "jpeg", "png" or "basic").
* *
*-- If the compression type is "fill", then the only pixel value follows, in *-- If the compression type is "fill", then the only pixel value follows, in
* client pixel format (see NOTE 1). This value applies to all pixels of the * client pixel format (see NOTE 1). This value applies to all pixels of the
* rectangle. * rectangle.
* *
*-- If the compression type is "jpeg", the following data stream looks like *-- If the compression type is "jpeg" or "png", the following data stream
* this: * looks like this:
* *
* 1..3 bytes: data size (N) in compact representation; * 1..3 bytes: data size (N) in compact representation;
* N bytes: JPEG image. * N bytes: JPEG or PNG image.
* *
* Data size is compactly represented in one, two or three bytes, according * Data size is compactly represented in one, two or three bytes, according
* to the following scheme: * to the following scheme:
...@@ -817,7 +822,7 @@ typedef struct { ...@@ -817,7 +822,7 @@ typedef struct {
*-- NOTE 2. The decoder must reset compression streams' states before *-- NOTE 2. The decoder must reset compression streams' states before
* decoding the rectangle, if some of bits 0,1,2,3 in the compression control * decoding the rectangle, if some of bits 0,1,2,3 in the compression control
* byte are set to 1. Note that the decoder must reset zlib streams even if * byte are set to 1. Note that the decoder must reset zlib streams even if
* the compression type is "fill" or "jpeg". * the compression type is "fill", "jpeg" or "png".
* *
*-- NOTE 3. The "gradient" filter and "jpeg" compression may be used only *-- NOTE 3. The "gradient" filter and "jpeg" compression may be used only
* when bits-per-pixel value is either 16 or 32, not 8. * when bits-per-pixel value is either 16 or 32, not 8.
...@@ -831,7 +836,8 @@ typedef struct { ...@@ -831,7 +836,8 @@ typedef struct {
#define rfbTightExplicitFilter 0x04 #define rfbTightExplicitFilter 0x04
#define rfbTightFill 0x08 #define rfbTightFill 0x08
#define rfbTightJpeg 0x09 #define rfbTightJpeg 0x09
#define rfbTightMaxSubencoding 0x09 #define rfbTightPng 0x0A
#define rfbTightMaxSubencoding 0x0A
/* Filters to improve compression efficiency */ /* Filters to improve compression efficiency */
#define rfbTightFilterCopy 0x00 #define rfbTightFilterCopy 0x00
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment