Data Structures | Defines | Functions

libvncserver/tight.c File Reference

#include <rfb/rfb.h>
#include "private.h"
#include "turbojpeg.h"
Include dependency graph for tight.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TIGHT_CONF
struct  COLOR_LIST
struct  PALETTE_ENTRY
struct  PALETTE

Defines

#define TIGHT_MIN_TO_COMPRESS   12
#define MIN_SPLIT_RECT_SIZE   4096
#define MIN_SOLID_SUBRECT_SIZE   2048
#define MAX_SPLIT_TILE_SIZE   16
#define DEFINE_CHECK_SOLID_FUNCTION(bpp)
#define DEFINE_FILL_PALETTE_FUNCTION(bpp)
#define DEFINE_FAST_FILL_PALETTE_FUNCTION(bpp)
#define HASH_FUNC16(rgb)   ((int)((((rgb) >> 8) + (rgb)) & 0xFF))
#define HASH_FUNC32(rgb)   ((int)((((rgb) >> 16) + ((rgb) >> 8)) & 0xFF))
#define DEFINE_IDX_ENCODE_FUNCTION(bpp)
#define DEFINE_MONO_ENCODE_FUNCTION(bpp)
#define DEFINE_JPEG_GET_ROW_FUNCTION(bpp)

Functions

void rfbTightCleanup (rfbScreenInfoPtr screen)
int rfbNumCodedRectsTight (rfbClientPtr cl, int x, int y, int w, int h)
rfbBool rfbSendRectEncodingTight (rfbClientPtr cl, int x, int y, int w, int h)
rfbBool rfbSendRectEncodingTightPng (rfbClientPtr cl, int x, int y, int w, int h)

Define Documentation

#define DEFINE_CHECK_SOLID_FUNCTION (   bpp  ) 
Value:
\
static rfbBool                                                                \
CheckSolidTile##bpp(rfbClientPtr cl, int x, int y, int w, int h,              \
                uint32_t* colorPtr, rfbBool needSameColor)                    \
{                                                                             \
    uint##bpp##_t *fbptr;                                                     \
    uint##bpp##_t colorValue;                                                 \
    int dx, dy;                                                               \
                                                                              \
    fbptr = (uint##bpp##_t *)&cl->scaledScreen->frameBuffer                   \
        [y * cl->scaledScreen->paddedWidthInBytes + x * (bpp/8)];             \
                                                                              \
    colorValue = *fbptr;                                                      \
    if (needSameColor && (uint32_t)colorValue != *colorPtr)                   \
        return FALSE;                                                         \
                                                                              \
    for (dy = 0; dy < h; dy++) {                                              \
        for (dx = 0; dx < w; dx++) {                                          \
            if (colorValue != fbptr[dx])                                      \
                return FALSE;                                                 \
        }                                                                     \
        fbptr = (uint##bpp##_t *)((uint8_t *)fbptr                            \
                 + cl->scaledScreen->paddedWidthInBytes);                     \
    }                                                                         \
                                                                              \
    *colorPtr = (uint32_t)colorValue;                                         \
    return TRUE;                                                              \
}

Definition at line 579 of file tight.c.

#define DEFINE_FAST_FILL_PALETTE_FUNCTION (   bpp  ) 

Definition at line 1234 of file tight.c.

#define DEFINE_FILL_PALETTE_FUNCTION (   bpp  ) 

Definition at line 1169 of file tight.c.

#define DEFINE_IDX_ENCODE_FUNCTION (   bpp  ) 
Value:
\
static void                                                             \
EncodeIndexedRect##bpp(uint8_t *buf, int count) {                       \
    COLOR_LIST *pnode;                                                  \
    uint##bpp##_t *src;                                                 \
    uint##bpp##_t rgb;                                                  \
    int rep = 0;                                                        \
                                                                        \
    src = (uint##bpp##_t *) buf;                                        \
                                                                        \
    while (count--) {                                                   \
        rgb = *src++;                                                   \
        while (count && *src == rgb) {                                  \
            rep++, src++, count--;                                      \
        }                                                               \
        pnode = palette.hash[HASH_FUNC##bpp(rgb)];                      \
        while (pnode != NULL) {                                         \
            if ((uint##bpp##_t)pnode->rgb == rgb) {                     \
                *buf++ = (uint8_t)pnode->idx;                           \
                while (rep) {                                           \
                    *buf++ = (uint8_t)pnode->idx;                       \
                    rep--;                                              \
                }                                                       \
                break;                                                  \
            }                                                           \
            pnode = pnode->next;                                        \
        }                                                               \
    }                                                                   \
}

Definition at line 1460 of file tight.c.

#define DEFINE_JPEG_GET_ROW_FUNCTION (   bpp  ) 
Value:
\
static void                                                                 \
PrepareRowForImg##bpp(rfbClientPtr cl, uint8_t *dst, int x, int y, int count) { \
    uint##bpp##_t *fbptr;                                                   \
    uint##bpp##_t pix;                                                      \
    int inRed, inGreen, inBlue;                                             \
                                                                            \
    fbptr = (uint##bpp##_t *)                                               \
        &cl->scaledScreen->frameBuffer[y * cl->scaledScreen->paddedWidthInBytes +       \
                             x * (bpp / 8)];                                \
                                                                            \
    while (count--) {                                                       \
        pix = *fbptr++;                                                     \
                                                                            \
        inRed = (int)                                                       \
            (pix >> cl->screen->serverFormat.redShift   & cl->screen->serverFormat.redMax); \
        inGreen = (int)                                                     \
            (pix >> cl->screen->serverFormat.greenShift & cl->screen->serverFormat.greenMax); \
        inBlue  = (int)                                                     \
            (pix >> cl->screen->serverFormat.blueShift  & cl->screen->serverFormat.blueMax); \
                                                                            \
        *dst++ = (uint8_t)((inRed   * 255 + cl->screen->serverFormat.redMax / 2) / \
                         cl->screen->serverFormat.redMax);                  \
        *dst++ = (uint8_t)((inGreen * 255 + cl->screen->serverFormat.greenMax / 2) / \
                         cl->screen->serverFormat.greenMax);                \
        *dst++ = (uint8_t)((inBlue  * 255 + cl->screen->serverFormat.blueMax / 2) / \
                         cl->screen->serverFormat.blueMax);                 \
    }                                                                       \
}

Definition at line 1709 of file tight.c.

#define DEFINE_MONO_ENCODE_FUNCTION (   bpp  ) 

Definition at line 1495 of file tight.c.

#define HASH_FUNC16 (   rgb  )     ((int)((((rgb) >> 8) + (rgb)) & 0xFF))

Definition at line 1342 of file tight.c.

#define HASH_FUNC32 (   rgb  )     ((int)((((rgb) >> 16) + ((rgb) >> 8)) & 0xFF))

Definition at line 1343 of file tight.c.

#define MAX_SPLIT_TILE_SIZE   16

Definition at line 53 of file tight.c.

#define MIN_SOLID_SUBRECT_SIZE   2048

Definition at line 52 of file tight.c.

#define MIN_SPLIT_RECT_SIZE   4096

Definition at line 51 of file tight.c.

#define TIGHT_MIN_TO_COMPRESS   12

Definition at line 48 of file tight.c.


Function Documentation

int rfbNumCodedRectsTight ( rfbClientPtr  cl,
int  x,
int  y,
int  w,
int  h 
)

Definition at line 240 of file tight.c.

Here is the caller graph for this function:

rfbBool rfbSendRectEncodingTight ( rfbClientPtr  cl,
int  x,
int  y,
int  w,
int  h 
)

Definition at line 268 of file tight.c.

Here is the caller graph for this function:

rfbBool rfbSendRectEncodingTightPng ( rfbClientPtr  cl,
int  x,
int  y,
int  w,
int  h 
)

Definition at line 279 of file tight.c.

Here is the caller graph for this function:

void rfbTightCleanup ( rfbScreenInfoPtr  screen  ) 

Definition at line 154 of file tight.c.

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines