From 3c4a069ba233624a5584ee2100a14634df57436d Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 23 Oct 2022 19:05:27 +0000 Subject: [PATCH] tight: Disable chroma subsampling at q=9 This avoids color banding at the highest quality level. --- src/tight.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tight.c b/src/tight.c index 64d4c37..78b465d 100644 --- a/src/tight.c +++ b/src/tight.c @@ -364,9 +364,11 @@ static int tight_encode_tile_jpeg(struct tight_encoder* self, int32_t stride = nvnc_fb_get_stride(self->fb); void* img = (uint32_t*)addr + x + y * stride; + enum TJSAMP subsampling = (quality == 9) ? TJSAMP_444 : TJSAMP_420; + int rc = -1; rc = tjCompress2(handle, img, width, stride * 4, height, tjfmt, &buffer, - &size, TJSAMP_422, quality, TJFLAG_FASTDCT); + &size, subsampling, quality, TJFLAG_FASTDCT); if (rc < 0) { nvnc_log(NVNC_LOG_ERROR, "Failed to encode tight JPEG box: %s", tjGetErrorStr());