tight: Disable chroma subsampling at q=9

This avoids color banding at the highest quality level.
pull/80/head
Andri Yngvason 2022-10-23 19:05:27 +00:00
parent df84f371fe
commit 3c4a069ba2
1 changed files with 3 additions and 1 deletions

View File

@ -364,9 +364,11 @@ static int tight_encode_tile_jpeg(struct tight_encoder* self,
int32_t stride = nvnc_fb_get_stride(self->fb); int32_t stride = nvnc_fb_get_stride(self->fb);
void* img = (uint32_t*)addr + x + y * stride; void* img = (uint32_t*)addr + x + y * stride;
enum TJSAMP subsampling = (quality == 9) ? TJSAMP_444 : TJSAMP_420;
int rc = -1; int rc = -1;
rc = tjCompress2(handle, img, width, stride * 4, height, tjfmt, &buffer, rc = tjCompress2(handle, img, width, stride * 4, height, tjfmt, &buffer,
&size, TJSAMP_422, quality, TJFLAG_FASTDCT); &size, subsampling, quality, TJFLAG_FASTDCT);
if (rc < 0) { if (rc < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to encode tight JPEG box: %s", nvnc_log(NVNC_LOG_ERROR, "Failed to encode tight JPEG box: %s",
tjGetErrorStr()); tjGetErrorStr());