This commit is contained in:
lxsang 2018-09-21 01:35:12 +02:00
parent 96ceffed2e
commit 7e536d6c0b

6
wvnc.c
View File

@ -78,7 +78,7 @@ int zlib_compress(uint8_t *src, int len)
#endif #endif
#ifdef USE_JPEG #ifdef USE_JPEG
int jpeg_compress(uint8_t *buff, int w, int h, int components) int jpeg_compress(uint8_t *buff, int w, int h, int components, int quality)
{ {
uint8_t *tmp = buff; uint8_t *tmp = buff;
/*if(bbp == 4) /*if(bbp == 4)
@ -105,7 +105,7 @@ int jpeg_compress(uint8_t *buff, int w, int h, int components)
cinfo.input_components = components; cinfo.input_components = components;
cinfo.in_color_space = components==4?JCS_EXT_RGBA:JCS_RGB; cinfo.in_color_space = components==4?JCS_EXT_RGBA:JCS_RGB;
jpeg_set_defaults(&cinfo); jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo, 50, true); jpeg_set_quality(&cinfo, quality, true);
jpeg_start_compress(&cinfo, true); jpeg_start_compress(&cinfo, true);
//unsigned counter = 0; //unsigned counter = 0;
JSAMPROW row_pointer[1]; JSAMPROW row_pointer[1];
@ -338,7 +338,7 @@ static void update(rfbClient *client, int x, int y, int w, int h)
#ifdef USE_JPEG #ifdef USE_JPEG
if((components == 3 || components == 4) && (user_data->flag ==1 || user_data->flag == 3)) if((components == 3 || components == 4) && (user_data->flag ==1 || user_data->flag == 3))
{ {
int ret = jpeg_compress(tmp, w, h, components); int ret = jpeg_compress(tmp, w, h, components, user_data->quality);
if(ret > 0) if(ret > 0)
{ {
flag |= 0x01; flag |= 0x01;