Use tight encoder v2

tight-encoder-v2
Andri Yngvason 2020-07-08 18:21:25 +00:00
parent ec3610221c
commit ad11276c4f
3 changed files with 12 additions and 9 deletions

View File

@ -24,7 +24,7 @@
#include "sys/queue.h" #include "sys/queue.h"
#include "neatvnc.h" #include "neatvnc.h"
#include "tight.h" #include "tight-encoder-v2.h"
#include "config.h" #include "config.h"
#ifdef ENABLE_TLS #ifdef ENABLE_TLS
@ -74,7 +74,7 @@ struct nvnc_client {
bool is_updating; bool is_updating;
nvnc_client_fn cleanup_fn; nvnc_client_fn cleanup_fn;
z_stream z_stream; z_stream z_stream;
struct tight_encoder tight_encoder; struct tight_encoder_v2 tight_encoder;
size_t buffer_index; size_t buffer_index;
size_t buffer_len; size_t buffer_len;
uint8_t msg_buffer[MSG_BUFFER_SIZE]; uint8_t msg_buffer[MSG_BUFFER_SIZE];

View File

@ -73,7 +73,7 @@ config = configuration_data()
if libturbojpeg.found() if libturbojpeg.found()
dependencies += libturbojpeg dependencies += libturbojpeg
sources += 'src/tight.c' sources += 'src/tight-encoder-v2.c'
config.set('ENABLE_TIGHT', true) config.set('ENABLE_TIGHT', true)
endif endif

View File

@ -16,7 +16,7 @@
#include "rfb-proto.h" #include "rfb-proto.h"
#include "zrle.h" #include "zrle.h"
#include "tight.h" #include "tight-encoder-v2.h"
#include "raw-encoding.h" #include "raw-encoding.h"
#include "vec.h" #include "vec.h"
#include "type-macros.h" #include "type-macros.h"
@ -82,7 +82,7 @@ static void client_close(struct nvnc_client* client)
LIST_REMOVE(client, link); LIST_REMOVE(client, link);
stream_destroy(client->net_stream); stream_destroy(client->net_stream);
#ifdef ENABLE_TIGHT #ifdef ENABLE_TIGHT
tight_encoder_destroy(&client->tight_encoder); tight_encoder_v2_destroy(&client->tight_encoder);
#endif #endif
deflateEnd(&client->z_stream); deflateEnd(&client->z_stream);
pixman_region_fini(&client->damage); pixman_region_fini(&client->damage);
@ -731,7 +731,9 @@ static void on_connection(void* obj)
goto deflate_failure; goto deflate_failure;
#ifdef ENABLE_TIGHT #ifdef ENABLE_TIGHT
if (tight_encoder_init(&client->tight_encoder) < 0) int width = server->display->buffer->width;
int height = server->display->buffer->height;
if (tight_encoder_v2_init(&client->tight_encoder, width, height) < 0)
goto tight_failure; goto tight_failure;
#endif #endif
@ -753,7 +755,7 @@ static void on_connection(void* obj)
payload_failure: payload_failure:
#ifdef ENABLE_TIGHT #ifdef ENABLE_TIGHT
tight_encoder_destroy(&client->tight_encoder); tight_encoder_v2_destroy(&client->tight_encoder);
#endif #endif
pixman_region_fini(&client->damage); pixman_region_fini(&client->damage);
#ifdef ENABLE_TIGHT #ifdef ENABLE_TIGHT
@ -961,8 +963,9 @@ static void do_client_update_fb(void* work)
break; break;
#ifdef ENABLE_TIGHT #ifdef ENABLE_TIGHT
case RFB_ENCODING_TIGHT: case RFB_ENCODING_TIGHT:
tight_encode_frame(&client->tight_encoder, &update->frame, fb, tight_encode_frame_v2(&client->tight_encoder, &update->frame,
&update->server_fmt, &update->region); &client->pixfmt, fb, &update->server_fmt,
&update->region);
break; break;
#endif #endif
case RFB_ENCODING_ZRLE: case RFB_ENCODING_ZRLE: