From: Andri Yngvason Date: Thu, 22 Aug 2024 21:26:59 +0000 (+0000) Subject: H264Libav: Use nearest-neighbour sampling in scaler X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1814%2Fhead;p=tigervnc.git H264Libav: Use nearest-neighbour sampling in scaler sws_getCachedContext will set a default sampling method if 0 is passed to the flags argument. This means that when it is called again, the flags argument will not match the flags in the context, so a new one will be allocated every time. To get around this problem, we assign an explicit sampling method, one that also happens to be more efficient and just as good for this use-case as the default one, which is bicubic interpolation. --- diff --git a/common/rfb/H264LibavDecoderContext.cxx b/common/rfb/H264LibavDecoderContext.cxx index c3153fd1..73bfb68c 100644 --- a/common/rfb/H264LibavDecoderContext.cxx +++ b/common/rfb/H264LibavDecoderContext.cxx @@ -215,7 +215,7 @@ void H264LibavDecoderContext::decode(const uint8_t* h264_in_buffer, sws = sws_getCachedContext(sws, frame->width, frame->height, avctx->pix_fmt, frame->width, frame->height, AV_PIX_FMT_RGB32, - 0, nullptr, nullptr, nullptr); + SWS_POINT, nullptr, nullptr, nullptr); int inFull, outFull, brightness, contrast, saturation; const int* inTable;