Skip to content

Commit

Permalink
Switch to xxhash from CRC for capture tile diff
Browse files Browse the repository at this point in the history
  • Loading branch information
metalefty committed Apr 3, 2024
1 parent 4bdc737 commit dc448ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ AM_CONDITIONAL(WITH_GLAMOR, [test x$enable_glamor = xyes])
AM_CONDITIONAL(WITH_SIMD_AMD64, [test x$simd_arch = xx86_64])
AM_CONDITIONAL(WITH_SIMD_X86, [test x$simd_arch = xi386])

PKG_CHECK_MODULES([XXHASH], [libxxhash >= 0.8.0])

AC_CONFIG_FILES([Makefile
module/Makefile
module/amd64/Makefile
Expand Down
3 changes: 2 additions & 1 deletion module/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ endif
AM_CFLAGS = \
$(XORG_SERVER_CFLAGS) \
$(XRDP_CFLAGS) \
$(XXHASH_CFLAGS) \
-DPACKAGE_VERSION_MAJOR=@package_version_major@ \
-DPACKAGE_VERSION_MINOR=@package_version_minor@ \
-DPACKAGE_VERSION_PATCHLEVEL=@package_version_patchlevel@ \
Expand Down Expand Up @@ -95,4 +96,4 @@ rdpMisc.c rdpReg.c rdpComposite.c rdpGlyphs.c rdpPixmap.c rdpInput.c \
rdpClientCon.c rdpCapture.c rdpTrapezoids.c rdpTriangles.c \
rdpCompositeRects.c rdpXv.c rdpSimd.c $(EXTRA_SOURCES)

libxorgxrdp_la_LIBADD = $(ASMLIB) $(EGLLIB)
libxorgxrdp_la_LIBADD = $(ASMLIB) $(EGLLIB) $(XXHASH_LIBS)
11 changes: 6 additions & 5 deletions module/rdpCapture.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ capture
#include "rdpMisc.h"
#include "rdpCapture.h"

#include <xxhash.h>

#if defined(XORGXRDP_GLAMOR)
#include "rdpEgl.h"
#include <glamor.h>
Expand All @@ -61,6 +63,8 @@ capture
G = (pixel >> 8) & UCHAR_MAX; \
B = (pixel >> 0) & UCHAR_MAX;

#define XXH32_SEED 0

/******************************************************************************/
/* copy rects with no error checking */
static int
Expand Down Expand Up @@ -913,7 +917,6 @@ rdpCapture2(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
}
else
{
crc = crc_start();
if (rcode == rgnPART)
{
LLOGLN(10, ("rdpCapture2: rgnPART"));
Expand All @@ -922,8 +925,7 @@ rdpCapture2(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
rdpRegionIntersect(&tile_reg, in_reg, &tile_reg);
rects = REGION_RECTS(&tile_reg);
num_rects = REGION_NUM_RECTS(&tile_reg);
crc = crc_process_data(crc, rects,
num_rects * sizeof(BoxRec));
crc = XXH32(rects, num_rects * sizeof(BoxRec), XXH32_SEED);
rdpCopyBox_a8r8g8b8_to_yuvalp(x, y,
src, src_stride,
dst, dst_stride,
Expand All @@ -939,8 +941,7 @@ rdpCapture2(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
&rect, 1);
}
crc_dst = dst + (y << 8) * (dst_stride >> 8) + (x << 8);
crc = crc_process_data(crc, crc_dst, 64 * 64 * 4);
crc = crc_end(crc);
crc = XXH32(crc_dst, 64 * 64 * 4, XXH32_SEED);
crc_offset = (y / XRDP_RFX_ALIGN) * crc_stride
+ (x / XRDP_RFX_ALIGN);
LLOGLN(10, ("rdpCapture2: crc 0x%8.8x 0x%8.8x",
Expand Down

0 comments on commit dc448ff

Please sign in to comment.