Browse Source

New upstream version 0.9.5

tags/upstream/0.9.5^0
Dominik George 3 years ago
parent
commit
685ef4e88d
73 changed files with 3331 additions and 1499 deletions
  1. +35
    -0
      NEWS.md
  2. +7
    -2
      README.md
  3. +0
    -1
      common/Makefile.am
  4. +5
    -6
      common/Makefile.in
  5. +0
    -0
      common/crc16.h
  6. +9
    -3
      common/log.c
  7. +2
    -1
      common/log.h
  8. +82
    -8
      common/os_calls.c
  9. +2
    -0
      common/os_calls.h
  10. +9
    -0
      common/ssl_calls.c
  11. +20
    -0
      common/trans.c
  12. +2
    -1
      common/trans.h
  13. +572
    -451
      common/xrdp_constants.h
  14. +9
    -0
      config_ac-h.in
  15. +40
    -10
      configure
  16. +13
    -1
      configure.ac
  17. +4
    -0
      genkeymap/dump-keymaps.sh
  18. +2
    -1
      instfiles/Makefile.am
  19. +2
    -1
      instfiles/Makefile.in
  20. +1055
    -0
      instfiles/km-00010409.ini
  21. +10
    -10
      librfxcodec/configure
  22. +1
    -1
      librfxcodec/configure.ac
  23. +34
    -0
      librfxcodec/include/rfxcodec_encode.h
  24. +4
    -2
      librfxcodec/src/Makefile.am
  25. +7
    -3
      librfxcodec/src/Makefile.in
  26. +34
    -2
      librfxcodec/src/rfxencode.c
  27. +10
    -0
      librfxcodec/src/rfxencode.h
  28. +483
    -0
      librfxcodec/src/rfxencode_rgb_to_yuv.c
  29. +33
    -0
      librfxcodec/src/rfxencode_rgb_to_yuv.h
  30. +12
    -407
      librfxcodec/src/rfxencode_tile.c
  31. +38
    -34
      libxrdp/xrdp_caps.c
  32. +7
    -7
      libxrdp/xrdp_sec.c
  33. +7
    -2
      neutrinordp/xrdp-neutrinordp.c
  34. +2
    -1
      sesman/chansrv/chansrv.c
  35. +117
    -0
      sesman/chansrv/pulse/README.md
  36. +145
    -0
      sesman/chansrv/pulse/README.md~
  37. +0
    -79
      sesman/chansrv/pulse/pulse-notes.txt
  38. +0
    -77
      sesman/chansrv/pulse/pulse-notes.ubuntu.txt
  39. +3
    -3
      sesman/chansrv/sound.c
  40. +25
    -7
      sesman/libscp/libscp_v0.c
  41. +24
    -10
      sesman/sesman.ini
  42. +1
    -1
      xorg/X11R7.6/rdp/rdp.h
  43. +1
    -1
      xorg/X11R7.6/rdp/rdp.h~
  44. +1
    -1
      xorgxrdp/README.md
  45. +10
    -10
      xorgxrdp/configure
  46. +1
    -1
      xorgxrdp/configure.ac
  47. +2
    -0
      xorgxrdp/module/amd64/Makefile.am
  48. +1
    -1
      xorgxrdp/module/amd64/Makefile.in
  49. +8
    -12
      xorgxrdp/module/amd64/a8r8g8b8_to_a8b8g8r8_box_amd64_sse2.asm
  50. +55
    -61
      xorgxrdp/module/amd64/a8r8g8b8_to_nv12_box_amd64_sse2.asm
  51. +1
    -4
      xorgxrdp/module/amd64/cpuid_amd64.asm
  52. +8
    -13
      xorgxrdp/module/amd64/i420_to_rgb32_amd64_sse2.asm
  53. +7
    -11
      xorgxrdp/module/amd64/uyvy_to_rgb32_amd64_sse2.asm
  54. +7
    -11
      xorgxrdp/module/amd64/yuy2_to_rgb32_amd64_sse2.asm
  55. +8
    -13
      xorgxrdp/module/amd64/yv12_to_rgb32_amd64_sse2.asm
  56. +75
    -0
      xorgxrdp/module/common.asm
  57. +8
    -3
      xorgxrdp/module/rdpClientCon.c
  58. +2
    -0
      xorgxrdp/module/x86/Makefile.am
  59. +1
    -1
      xorgxrdp/module/x86/Makefile.in
  60. +28
    -30
      xorgxrdp/module/x86/a8r8g8b8_to_a8b8g8r8_box_x86_sse2.asm
  61. +60
    -64
      xorgxrdp/module/x86/a8r8g8b8_to_nv12_box_x86_sse2.asm
  62. +1
    -4
      xorgxrdp/module/x86/cpuid_x86.asm
  63. +32
    -30
      xorgxrdp/module/x86/i420_to_rgb32_x86_sse2.asm
  64. +9
    -11
      xorgxrdp/module/x86/uyvy_to_rgb32_x86_sse2.asm
  65. +9
    -11
      xorgxrdp/module/x86/yuy2_to_rgb32_x86_sse2.asm
  66. +32
    -30
      xorgxrdp/module/x86/yv12_to_rgb32_x86_sse2.asm
  67. +5
    -0
      xrdp/xrdp.ini
  68. +0
    -1
      xrdp/xrdp_bitmap.c
  69. +0
    -1
      xrdp/xrdp_cache.c
  70. +6
    -0
      xrdp/xrdp_keyboard.ini
  71. +28
    -9
      xrdp/xrdp_listen.c
  72. +4
    -2
      xrdp/xrdp_mm.c
  73. +54
    -31
      xrdp/xrdp_wm.c

+ 35
- 0
NEWS.md View File

@@ -1,3 +1,34 @@
# Release notes for xrdp v0.9.5 (2017/12/27)

## Security fixes
* Fix local denial of service [CVE-2017-16927](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-16927) #958 #979

## New features
* Add a new log level TRACE more verbose than DEBUG #835 #944
* SSH agent forwarding via RDP #867 #868 FreeRDP/FreeRDP#4122
* Support horizontal wheel properly #928

## Bug fixes

* Avoid use of hard-coded sesman port #895
* Workaround for corrupted display with Windows Server 2008 using NeutrinoRDP #869
* Fix glitch in audio redirection by AAC #910 #936
* Implement vsock support #930 #935 #948
* Avoid 100% CPU usage on SSL accept #956

## Other changes
* Add US Dvorak keyboard #929
* Suppress some misleading logs #964
* Add Finnish keyboard #972
* Add more user-friendlier description about Xorg config #974
* Renew pulseaudio document #984 #985
* Lots of cleanups and refactoring

## Known issues
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965

-----------------------

# Release notes for xrdp v0.9.4 (2017/09/28)

## New features
@@ -22,6 +53,8 @@
* Windows 10 (1703) shows black blank screen in RemoteFX mode
* This issue is already fixed at Insider Preview build 16273

-----------------------

# Release notes for xrdp v0.9.3.1 (2017/08/16)

This release fixes a trivial packaging issue #848 occurred in v0.9.3. The issue only affects systemd systems. This release is principally for distro packagers or users who compile & install xrdp from source.
@@ -31,6 +64,8 @@ Users who running xrdp on these systems don't need to upgrade from v0.9.3 to v0.
* Linux systems without systemd
* non-Linux systems such as BSD operating systems

-----------------------

# Release notes for xrdp v0.9.3 (2017/07/15)

## New features


+ 7
- 2
README.md View File

@@ -2,7 +2,7 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/neutrinolabs/xrdp)
![Apache-License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)

*Current Version:* 0.9.4
*Current Version:* 0.9.5

# xrdp - an open source RDP server

@@ -29,7 +29,7 @@ RDP transport is encrypted using TLS by default.

### Access to Remote Resources
* two-way clipboard transfer (text, bitmap, file)
* audio redirection
* audio redirection ([requires to build additional modules](https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection))
* drive redirection (mount local client drives on remote machine)

## Quick Start
@@ -114,6 +114,11 @@ make
sudo make install
```

If you want to use audio redirection, you need to build and install additional
pulseaudio modules. The build instructions can be found at wiki.

* [How to set up audio redirection](https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection)

## Directory Structure

```


+ 0
- 1
common/Makefile.am View File

@@ -33,7 +33,6 @@ libcommon_la_SOURCES = \
arch.h \
base64.h \
base64.c \
crc16.h \
defines.h \
fifo.c \
fifo.h \


+ 5
- 6
common/Makefile.in View File

@@ -143,11 +143,11 @@ LTLIBRARIES = $(module_LTLIBRARIES)
am__DEPENDENCIES_1 =
libcommon_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am__libcommon_la_SOURCES_DIST = arch.h base64.h base64.c crc16.h \
defines.h fifo.c fifo.h file.c file.h list.c list.h list16.c \
list16.h log.c log.h os_calls.c os_calls.h parse.h rail.h \
ssl_calls.c ssl_calls.h thread_calls.c thread_calls.h trans.c \
trans.h pixman-region16.c pixman-region.h
am__libcommon_la_SOURCES_DIST = arch.h base64.h base64.c defines.h \
fifo.c fifo.h file.c file.h list.c list.h list16.c list16.h \
log.c log.h os_calls.c os_calls.h parse.h rail.h ssl_calls.c \
ssl_calls.h thread_calls.c thread_calls.h trans.c trans.h \
pixman-region16.c pixman-region.h
@XRDP_PIXMAN_FALSE@am__objects_1 = pixman-region16.lo
am_libcommon_la_OBJECTS = base64.lo fifo.lo file.lo list.lo list16.lo \
log.lo os_calls.lo ssl_calls.lo thread_calls.lo trans.lo \
@@ -386,7 +386,6 @@ libcommon_la_SOURCES = \
arch.h \
base64.h \
base64.c \
crc16.h \
defines.h \
fifo.c \
fifo.h \


+ 0
- 0
common/crc16.h View File


+ 9
- 3
common/log.c View File

@@ -94,6 +94,7 @@ internal_log_xrdp2syslog(const enum logLevels lvl)
case LOG_LEVEL_INFO:
return LOG_INFO;
case LOG_LEVEL_DEBUG:
case LOG_LEVEL_TRACE:
return LOG_DEBUG;
default:
g_writeln("Undefined log level - programming error");
@@ -128,6 +129,9 @@ internal_log_lvl2str(const enum logLevels lvl, char *str)
case LOG_LEVEL_DEBUG:
snprintf(str, 9, "%s", "[DEBUG] ");
break;
case LOG_LEVEL_TRACE:
snprintf(str, 9, "%s", "[TRACE] ");
break;
default:
snprintf(str, 9, "%s", "PRG ERR!");
g_writeln("Programming error - undefined log level!!!");
@@ -194,9 +198,6 @@ internal_log_end(struct log_config *l_cfg)
return ret;
}

/* closing log file */
log_message(LOG_LEVEL_ALWAYS, "shutting down log subsystem...");

if (-1 != l_cfg->fd)
{
/* closing logfile... */
@@ -254,6 +255,11 @@ internal_log_text2level(const char *buf)
{
return LOG_LEVEL_DEBUG;
}
else if (0 == g_strcasecmp(buf, "5") ||
0 == g_strcasecmp(buf, "trace"))
{
return LOG_LEVEL_TRACE;
}

g_writeln("Your configured log level is corrupt - we use debug log level");
return LOG_LEVEL_DEBUG;


+ 2
- 1
common/log.h View File

@@ -33,7 +33,8 @@ enum logLevels
LOG_LEVEL_ERROR,
LOG_LEVEL_WARNING,
LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG
LOG_LEVEL_DEBUG,
LOG_LEVEL_TRACE
};

/* startup return values */


+ 82
- 8
common/os_calls.c View File

@@ -41,6 +41,9 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#if defined(XRDP_ENABLE_VSOCK)
#include <linux/vm_sockets.h>
#endif
#include <sys/un.h>
#include <sys/time.h>
#include <sys/times.h>
@@ -576,12 +579,23 @@ int
g_sck_local_socket(void)
{
#if defined(_WIN32)
return 0;
return -1;
#else
return socket(PF_LOCAL, SOCK_STREAM, 0);
#endif
}

/*****************************************************************************/
int
g_sck_vsock_socket(void)
{
#if defined(XRDP_ENABLE_VSOCK)
return socket(PF_VSOCK, SOCK_STREAM, 0);
#else
return -1;
#endif
}

/*****************************************************************************/
/* returns error */
int
@@ -655,6 +669,9 @@ g_sck_close(int sck)
struct sockaddr_in sock_addr_in;
#if defined(XRDP_ENABLE_IPV6)
struct sockaddr_in6 sock_addr_in6;
#endif
#if defined(XRDP_ENABLE_VSOCK)
struct sockaddr_vm sock_addr_vm;
#endif
} sock_info;
socklen_t sock_len = sizeof(sock_info);
@@ -695,6 +712,22 @@ g_sck_close(int sck)
g_snprintf(sockname, sizeof(sockname), "AF_UNIX");
break;

#if defined(XRDP_ENABLE_VSOCK)

case AF_VSOCK:
{
struct sockaddr_vm *sock_addr_vm = &sock_info.sock_addr_vm;

g_snprintf(sockname,
sizeof(sockname),
"AF_VSOCK cid %d port %d",
sock_addr_vm->svm_cid,
sock_addr_vm->svm_port);
break;
}

#endif

default:
g_snprintf(sockname, sizeof(sockname), "unknown family %d",
sock_info.sock_addr.sa_family);
@@ -990,6 +1023,24 @@ g_sck_local_bind(int sck, const char *port)
#endif
}

/*****************************************************************************/
int
g_sck_vsock_bind(int sck, const char *port)
{
#if defined(XRDP_ENABLE_VSOCK)
struct sockaddr_vm s;

g_memset(&s, 0, sizeof(struct sockaddr_vm));
s.svm_family = AF_VSOCK;
s.svm_port = atoi(port);
s.svm_cid = VMADDR_CID_ANY;

return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_vm));
#else
return -1;
#endif
}

#if defined(XRDP_ENABLE_IPV6)
/*****************************************************************************/
/* Helper function for g_tcp_bind_address. */
@@ -1180,9 +1231,9 @@ g_tcp_accept(int sck)
{
struct sockaddr_in *sock_addr_in = &sock_info.sock_addr_in;

snprintf(msg, sizeof(msg), "A connection received from %s port %d",
inet_ntoa(sock_addr_in->sin_addr),
ntohs(sock_addr_in->sin_port));
g_snprintf(msg, sizeof(msg), "A connection received from %s port %d",
inet_ntoa(sock_addr_in->sin_addr),
ntohs(sock_addr_in->sin_port));
log_message(LOG_LEVEL_INFO, "%s", msg);

break;
@@ -1197,8 +1248,8 @@ g_tcp_accept(int sck)

inet_ntop(sock_addr_in6->sin6_family,
&sock_addr_in6->sin6_addr, addr, sizeof(addr));
snprintf(msg, sizeof(msg), "A connection received from %s port %d",
addr, ntohs(sock_addr_in6->sin6_port));
g_snprintf(msg, sizeof(msg), "A connection received from %s port %d",
addr, ntohs(sock_addr_in6->sin6_port));
log_message(LOG_LEVEL_INFO, "%s", msg);

break;
@@ -1226,6 +1277,9 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes)
struct sockaddr_in6 sock_addr_in6;
#endif
struct sockaddr_un sock_addr_un;
#if defined(XRDP_ENABLE_VSOCK)
struct sockaddr_vm sock_addr_vm;
#endif
} sock_info;

socklen_t sock_len = sizeof(sock_info);
@@ -1273,6 +1327,26 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes)
g_snprintf(msg, sizeof(msg), "AF_UNIX connection received");
break;
}

#if defined(XRDP_ENABLE_VSOCK)

case AF_VSOCK:
{
struct sockaddr_vm *sock_addr_vm = &sock_info.sock_addr_vm;

g_snprintf(addr, addr_bytes - 1, "%d", sock_addr_vm->svm_cid);
g_snprintf(port, addr_bytes - 1, "%d", sock_addr_vm->svm_port);

g_snprintf(msg,
sizeof(msg),
"AF_VSOCK connection received from cid: %s port: %s",
addr,
port);

break;
}

#endif
default:
{
g_strncpy(addr, "", addr_bytes - 1);
@@ -1358,13 +1432,13 @@ g_write_ip_address(int rcv_sck, char *ip_address, int bytes)

if (ok)
{
snprintf(ip_address, bytes, "%s:%d - socket: %d", addr, port, rcv_sck);
g_snprintf(ip_address, bytes, "%s:%d - socket: %d", addr, port, rcv_sck);
}
}

if (!ok)
{
snprintf(ip_address, bytes, "NULL:NULL - socket: %d", rcv_sck);
g_snprintf(ip_address, bytes, "NULL:NULL - socket: %d", rcv_sck);
}

g_free(addr);


+ 2
- 0
common/os_calls.h View File

@@ -62,6 +62,7 @@ int g_sck_get_send_buffer_bytes(int sck, int *bytes);
int g_sck_set_recv_buffer_bytes(int sck, int bytes);
int g_sck_get_recv_buffer_bytes(int sck, int *bytes);
int g_sck_local_socket(void);
int g_sck_vsock_socket(void);
int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid);
void g_sck_close(int sck);
int g_tcp_connect(int sck, const char* address, const char* port);
@@ -69,6 +70,7 @@ int g_sck_local_connect(int sck, const char* port);
int g_sck_set_non_blocking(int sck);
int g_tcp_bind(int sck, const char *port);
int g_sck_local_bind(int sck, const char* port);
int g_sck_vsock_bind(int sck, const char* port);
int g_tcp_bind_address(int sck, const char* port, const char* address);
int g_sck_listen(int sck);
int g_tcp_accept(int sck);


+ 9
- 0
common/ssl_calls.c View File

@@ -651,6 +651,15 @@ ssl_tls_accept(struct ssl_tls *self, long ssl_protocols,
* SSL_ERROR_WANT_READ
* SSL_ERROR_WANT_WRITE
*/
switch (SSL_get_error(self->ssl, connection_status))
{
case SSL_ERROR_WANT_READ:
g_sck_can_recv(self->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
break;
case SSL_ERROR_WANT_WRITE:
g_sck_can_send(self->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
break;
}
}
else
{


+ 20
- 0
common/trans.c View File

@@ -831,6 +831,26 @@ trans_listen_address(struct trans *self, char *port, const char *address)
}
}
}
else if (self->mode == TRANS_MODE_VSOCK) /* vsock socket */
{
self->sck = g_sck_vsock_socket();
if (self->sck < 0)
{
return 1;
}

g_tcp_set_non_blocking(self->sck);

if (g_sck_vsock_bind(self->sck, port) == 0)
{
if (g_tcp_listen(self->sck) == 0)
{
self->status = TRANS_STATUS_UP; /* ok */
self->type1 = TRANS_TYPE_LISTENER; /* listener */
return 0;
}
}
}

return 1;
}


+ 2
- 1
common/trans.h View File

@@ -26,6 +26,7 @@

#define TRANS_MODE_TCP 1
#define TRANS_MODE_UNIX 2
#define TRANS_MODE_VSOCK 3

#define TRANS_TYPE_LISTENER 1
#define TRANS_TYPE_SERVER 2
@@ -62,7 +63,7 @@ struct source_info
struct trans
{
tbus sck; /* socket handle */
int mode; /* 1 tcp, 2 unix socket */
int mode; /* 1 tcp, 2 unix socket, 3 vsock */
int status;
int type1; /* 1 listener 2 server 3 client */
ttrans_data_in trans_data_in;


+ 572
- 451
common/xrdp_constants.h
File diff suppressed because it is too large
View File


+ 9
- 0
config_ac-h.in View File

@@ -9,6 +9,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <linux/socket.h> header file. */
#undef HAVE_LINUX_SOCKET_H

/* Define to 1 if you have the <linux/vm_sockets.h> header file. */
#undef HAVE_LINUX_VM_SOCKETS_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

@@ -81,6 +87,9 @@
/* Enable IPv6 only */
#undef XRDP_ENABLE_IPV6ONLY

/* Enable AF_VSOCK */
#undef XRDP_ENABLE_VSOCK

/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING



+ 40
- 10
configure View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xrdp 0.9.4.
# Generated by GNU Autoconf 2.69 for xrdp 0.9.5.
#
# Report bugs to <xrdp-devel@googlegroups.com>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xrdp'
PACKAGE_TARNAME='xrdp'
PACKAGE_VERSION='0.9.4'
PACKAGE_STRING='xrdp 0.9.4'
PACKAGE_VERSION='0.9.5'
PACKAGE_STRING='xrdp 0.9.5'
PACKAGE_BUGREPORT='xrdp-devel@googlegroups.com'
PACKAGE_URL=''

@@ -835,6 +835,7 @@ enable_libtool_lock
with_socketdir
with_systemdsystemunitdir
enable_pam
enable_vsock
enable_ipv6
enable_ipv6only
enable_kerberos
@@ -1421,7 +1422,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures xrdp 0.9.4 to adapt to many kinds of systems.
\`configure' configures xrdp 0.9.5 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1495,7 +1496,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xrdp 0.9.4:";;
short | recursive ) echo "Configuration of xrdp 0.9.5:";;
esac
cat <<\_ACEOF

@@ -1515,6 +1516,7 @@ Optional Features:
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-pam Build PAM support (default: yes)
--enable-vsock Build AF_VSOCK support (default: no)
--enable-ipv6 Build IPv6 support (default: no, experimental)
--enable-ipv6only Build IPv6-only (default: no)
--enable-kerberos Build kerberos support (default: no)
@@ -1659,7 +1661,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xrdp configure 0.9.4
xrdp configure 0.9.5
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2028,7 +2030,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by xrdp $as_me 0.9.4, which was
It was created by xrdp $as_me 0.9.5, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
@@ -2893,7 +2895,7 @@ fi

# Define the identity of the package.
PACKAGE='xrdp'
VERSION='0.9.4'
VERSION='0.9.5'


cat >>confdefs.h <<_ACEOF
@@ -12692,6 +12694,13 @@ else
SESMAN_NOPAM_FALSE=
fi

# Check whether --enable-vsock was given.
if test "${enable_vsock+set}" = set; then :
enableval=$enable_vsock;
else
enable_vsock=no
fi

# Check whether --enable-ipv6 was given.
if test "${enable_ipv6+set}" = set; then :
enableval=$enable_ipv6;
@@ -13171,6 +13180,27 @@ fi



if test "x$enable_vsock" = "xyes"
then
enable_vsock=yes
for ac_header in linux/socket.h linux/vm_sockets.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <sys/socket.h>
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF

$as_echo "#define XRDP_ENABLE_VSOCK 1" >>confdefs.h

fi

done

fi

if test "x$enable_ipv6only" = "xyes"
then
enable_ipv6=yes
@@ -15002,7 +15032,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xrdp $as_me 0.9.4, which was
This file was extended by xrdp $as_me 0.9.5, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -15068,7 +15098,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
xrdp config.status 0.9.4
xrdp config.status 0.9.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"



+ 13
- 1
configure.ac View File

@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script

AC_PREREQ(2.65)
AC_INIT([xrdp], [0.9.4], [xrdp-devel@googlegroups.com])
AC_INIT([xrdp], [0.9.5], [xrdp-devel@googlegroups.com])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.7.2 foreign])
AC_CONFIG_MACRO_DIR([m4])
@@ -70,6 +70,9 @@ AC_ARG_ENABLE(pam, AS_HELP_STRING([--disable-pam],
[Build PAM support (default: yes)]),
[], [enable_pam=yes])
AM_CONDITIONAL(SESMAN_NOPAM, [test x$enable_pam != xyes])
AC_ARG_ENABLE(vsock, AS_HELP_STRING([--enable-vsock],
[Build AF_VSOCK support (default: no)]),
[], [enable_vsock=no])
AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],
[Build IPv6 support (default: no, experimental)]),
[], [enable_ipv6=no])
@@ -197,6 +200,15 @@ fi

AC_SUBST(PAM_RULES)

if test "x$enable_vsock" = "xyes"
then
enable_vsock=yes
AC_CHECK_HEADERS([linux/socket.h linux/vm_sockets.h],
[AC_DEFINE([XRDP_ENABLE_VSOCK], 1, [Enable AF_VSOCK])],
[],
[#include <sys/socket.h>])
fi

if test "x$enable_ipv6only" = "xyes"
then
enable_ipv6=yes


+ 4
- 0
genkeymap/dump-keymaps.sh View File

@@ -11,6 +11,10 @@ fi
setxkbmap -model pc104 -layout us
./xrdp-genkeymap ../instfiles/km-00000409.ini

# English - US 'dvorak' 0x00010409
setxkbmap -model pc104 -layout dvorak
./xrdp-genkeymap ../instfiles/km-00010409.ini

# English - UK 'en-GB' 0x00000809
setxkbmap -model pc105 -layout gb
./xrdp-genkeymap ../instfiles/km-00000809.ini


+ 2
- 1
instfiles/Makefile.am View File

@@ -48,7 +48,8 @@ dist_startscript_DATA = \
km-0000080c.ini \
km-00000813.ini \
km-00000816.ini \
km-0000100c.ini
km-0000100c.ini \
km-00010409.ini

#
# platform specific files


+ 2
- 1
instfiles/Makefile.in View File

@@ -429,7 +429,8 @@ dist_startscript_DATA = \
km-0000080c.ini \
km-00000813.ini \
km-00000816.ini \
km-0000100c.ini
km-0000100c.ini \
km-00010409.ini


#


+ 1055
- 0
instfiles/km-00010409.ini
File diff suppressed because it is too large
View File


+ 10
- 10
librfxcodec/configure View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for rfxcodec 0.1.3.
# Generated by GNU Autoconf 2.69 for rfxcodec 0.1.4.
#
# Report bugs to <xrdp-devel@googlegroups.com>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rfxcodec'
PACKAGE_TARNAME='rfxcodec'
PACKAGE_VERSION='0.1.3'
PACKAGE_STRING='rfxcodec 0.1.3'
PACKAGE_VERSION='0.1.4'
PACKAGE_STRING='rfxcodec 0.1.4'
PACKAGE_BUGREPORT='xrdp-devel@googlegroups.com'
PACKAGE_URL=''

@@ -1321,7 +1321,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rfxcodec 0.1.3 to adapt to many kinds of systems.
\`configure' configures rfxcodec 0.1.4 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1391,7 +1391,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rfxcodec 0.1.3:";;
short | recursive ) echo "Configuration of rfxcodec 0.1.4:";;
esac
cat <<\_ACEOF

@@ -1504,7 +1504,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rfxcodec configure 0.1.3
rfxcodec configure 0.1.4
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1782,7 +1782,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by rfxcodec $as_me 0.1.3, which was
It was created by rfxcodec $as_me 0.1.4, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
@@ -2647,7 +2647,7 @@ fi

# Define the identity of the package.
PACKAGE='rfxcodec'
VERSION='0.1.3'
VERSION='0.1.4'


cat >>confdefs.h <<_ACEOF
@@ -13160,7 +13160,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rfxcodec $as_me 0.1.3, which was
This file was extended by rfxcodec $as_me 0.1.4, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -13226,7 +13226,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
rfxcodec config.status 0.1.3
rfxcodec config.status 0.1.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"



+ 1
- 1
librfxcodec/configure.ac View File

@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script

AC_PREREQ(2.59)
AC_INIT([rfxcodec], [0.1.3], [xrdp-devel@googlegroups.com])
AC_INIT([rfxcodec], [0.1.4], [xrdp-devel@googlegroups.com])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.6 foreign])
AC_CONFIG_MACRO_DIR([m4])


+ 34
- 0
librfxcodec/include/rfxcodec_encode.h View File

@@ -73,4 +73,38 @@ rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants, int flags);

/* use simple types here, no sint16_t, uint8_t, ... */
typedef int (*rfxencode_rlgr1_proc)(const short *data, unsigned char *buffer, int buffer_size);
typedef int (*rfxencode_rlgr3_proc)(const short *data, unsigned char *buffer, int buffer_size);
typedef int (*rfxencode_differential_proc)(short *buffer, int buffer_size);
typedef int (*rfxencode_quantization_proc)(short *buffer, const char *quantization_values);
typedef int (*rfxencode_dwt_2d_proc)(const unsigned char *in_buffer, short *buffer, short *dwt_buffer);

typedef int (*rfxencode_diff_rlgr1_proc)(short *coef, unsigned char *cdata, int cdata_size);
typedef int (*rfxencode_diff_rlgr3_proc)(short *coef, unsigned char *cdata, int cdata_size);

typedef int (*rfxencode_dwt_shift_x86_sse2_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer);
typedef int (*rfxencode_dwt_shift_x86_sse41_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer);

typedef int (*rfxencode_dwt_shift_amd64_sse2_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer);
typedef int (*rfxencode_dwt_shift_amd64_sse41_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer);

struct rfxcodec_encode_internals
{
rfxencode_rlgr1_proc rfxencode_rlgr1;
rfxencode_rlgr3_proc rfxencode_rlgr3;
rfxencode_differential_proc rfxencode_differential;
rfxencode_quantization_proc rfxencode_quantization;
rfxencode_dwt_2d_proc rfxencode_dwt_2d;
rfxencode_diff_rlgr1_proc rfxencode_diff_rlgr1;
rfxencode_diff_rlgr3_proc rfxencode_diff_rlgr3;
rfxencode_dwt_shift_x86_sse2_proc rfxencode_dwt_shift_x86_sse2;
rfxencode_dwt_shift_x86_sse41_proc rfxencode_dwt_shift_x86_sse41;
rfxencode_dwt_shift_amd64_sse2_proc rfxencode_dwt_shift_amd64_sse2;
rfxencode_dwt_shift_amd64_sse41_proc rfxencode_dwt_shift_amd64_sse41;
};

int
rfxcodec_encode_get_internals(struct rfxcodec_encode_internals *internals);

#endif

+ 4
- 2
librfxcodec/src/Makefile.am View File

@@ -31,7 +31,8 @@ noinst_HEADERS = \
rfxencode_rlgr3.h \
rfxencode_tile.h \
rfxencode_diff_rlgr1.h \
rfxencode_diff_rlgr3.h
rfxencode_diff_rlgr3.h \
rfxencode_rgb_to_yuv.h

lib_LTLIBRARIES = librfxencode.la

@@ -39,4 +40,5 @@ librfxencode_la_SOURCES = $(noinst_HEADERS) rfxencode.c \
rfxencode_compose.c rfxencode_tile.c rfxencode_dwt.c \
rfxencode_quantization.c rfxencode_differential.c \
rfxencode_rlgr1.c rfxencode_rlgr3.c rfxencode_alpha.c \
rfxencode_diff_rlgr1.c rfxencode_diff_rlgr3.c
rfxencode_diff_rlgr1.c rfxencode_diff_rlgr3.c \
rfxencode_rgb_to_yuv.c

+ 7
- 3
librfxcodec/src/Makefile.in View File

@@ -149,7 +149,8 @@ am_librfxencode_la_OBJECTS = $(am__objects_1) rfxencode.lo \
rfxencode_compose.lo rfxencode_tile.lo rfxencode_dwt.lo \
rfxencode_quantization.lo rfxencode_differential.lo \
rfxencode_rlgr1.lo rfxencode_rlgr3.lo rfxencode_alpha.lo \
rfxencode_diff_rlgr1.lo rfxencode_diff_rlgr3.lo
rfxencode_diff_rlgr1.lo rfxencode_diff_rlgr3.lo \
rfxencode_rgb_to_yuv.lo
librfxencode_la_OBJECTS = $(am_librfxencode_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -397,14 +398,16 @@ noinst_HEADERS = \
rfxencode_rlgr3.h \
rfxencode_tile.h \
rfxencode_diff_rlgr1.h \
rfxencode_diff_rlgr3.h
rfxencode_diff_rlgr3.h \
rfxencode_rgb_to_yuv.h

lib_LTLIBRARIES = librfxencode.la
librfxencode_la_SOURCES = $(noinst_HEADERS) rfxencode.c \
rfxencode_compose.c rfxencode_tile.c rfxencode_dwt.c \
rfxencode_quantization.c rfxencode_differential.c \
rfxencode_rlgr1.c rfxencode_rlgr3.c rfxencode_alpha.c \
rfxencode_diff_rlgr1.c rfxencode_diff_rlgr3.c
rfxencode_diff_rlgr1.c rfxencode_diff_rlgr3.c \
rfxencode_rgb_to_yuv.c

all: all-recursive

@@ -492,6 +495,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_differential.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_dwt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_quantization.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_rgb_to_yuv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_rlgr1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_rlgr3.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfxencode_tile.Plo@am__quote@


+ 34
- 2
librfxcodec/src/rfxencode.c View File

@@ -31,6 +31,14 @@
#include "rfxencode_compose.h"
#include "rfxconstants.h"
#include "rfxencode_tile.h"
#include "rfxencode_rlgr1.h"
#include "rfxencode_rlgr3.h"
#include "rfxencode_differential.h"
#include "rfxencode_quantization.h"
#include "rfxencode_dwt.h"
#include "rfxencode_diff_rlgr1.h"
#include "rfxencode_diff_rlgr3.h"
#include "rfxencode_rgb_to_yuv.h"

#ifdef RFX_USE_ACCEL_X86
#include "x86/funcs_x86.h"
@@ -52,7 +60,7 @@ rfxcodec_encode_create_ex(int width, int height, int format, int flags,
int dx;

enc = (struct rfxencode *) calloc(1, sizeof(struct rfxencode));
if (enc == 0)
if (enc == NULL)
{
return 1;
}
@@ -146,6 +154,8 @@ rfxcodec_encode_create_ex(int width, int height, int format, int flags,
return 2;
}
enc->format = format;
enc->rfx_encode_rgb_to_yuv = rfx_encode_rgb_to_yuv;
enc->rfx_encode_argb_to_yuva = rfx_encode_argb_to_yuva;
/* assign encoding functions */
if (flags & RFX_FLAGS_NOACCEL)
{
@@ -287,7 +297,7 @@ rfxcodec_encode_destroy(void *handle)
struct rfxencode *enc;

enc = (struct rfxencode *) handle;
if (enc == 0)
if (enc == NULL)
{
return 0;
}
@@ -344,3 +354,25 @@ rfxcodec_encode(void *handle, char *cdata, int *cdata_bytes,
num_tiles, quants, num_quants, 0);
}

/******************************************************************************/
int
rfxcodec_encode_get_internals(struct rfxcodec_encode_internals *internals)
{
memset(internals, 0, sizeof(struct rfxcodec_encode_internals));
internals->rfxencode_rlgr1 = rfx_rlgr1_encode;
internals->rfxencode_rlgr3 = rfx_rlgr3_encode;
internals->rfxencode_differential = rfx_differential_encode;
internals->rfxencode_quantization = rfx_quantization_encode;
internals->rfxencode_dwt_2d = rfx_dwt_2d_encode;
internals->rfxencode_diff_rlgr1 = rfx_encode_diff_rlgr1;
internals->rfxencode_diff_rlgr3 = rfx_encode_diff_rlgr3;
#if defined(RFX_USE_ACCEL_X86)
internals->rfxencode_dwt_shift_x86_sse2 = rfxcodec_encode_dwt_shift_x86_sse2;
internals->rfxencode_dwt_shift_x86_sse41 = rfxcodec_encode_dwt_shift_x86_sse41;
#endif
#if defined(RFX_USE_ACCEL_AMD64)
internals->rfxencode_dwt_shift_amd64_sse2 = rfxcodec_encode_dwt_shift_amd64_sse2;
internals->rfxencode_dwt_shift_amd64_sse41 = rfxcodec_encode_dwt_shift_amd64_sse41;
#endif
return 0;
}

+ 10
- 0
librfxcodec/src/rfxencode.h View File

@@ -21,6 +21,14 @@

struct rfxencode;

typedef int (*rfx_encode_rgb_to_yuv_proc)(struct rfxencode *enc,
const char *rgb_data,
int width, int height,
int stride_bytes);
typedef int (*rfx_encode_argb_to_yuva_proc)(struct rfxencode *enc,
const char *argb_data,
int width, int height,
int stride_bytes);
typedef int (*rfx_encode_proc)(struct rfxencode *enc, const char *qtable,
const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
@@ -51,6 +59,8 @@ struct rfxencode
sint16 *dwt_buffer1;
sint16 *dwt_buffer2;
rfx_encode_proc rfx_encode;
rfx_encode_rgb_to_yuv_proc rfx_encode_rgb_to_yuv;
rfx_encode_argb_to_yuva_proc rfx_encode_argb_to_yuva;

int got_sse2;
int got_sse3;


+ 483
- 0
librfxcodec/src/rfxencode_rgb_to_yuv.c View File

@@ -0,0 +1,483 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* RemoteFX Codec Library - Encode
*
* Copyright 2011 Vic Lee
* Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#if defined(HAVE_CONFIG_H)
#include <config_ac.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <rfxcodec_encode.h>

#include "rfxcommon.h"
#include "rfxencode.h"
#include "rfxconstants.h"
#include "rfxencode_tile.h"
#include "rfxencode_dwt.h"
#include "rfxencode_quantization.h"
#include "rfxencode_differential.h"
#include "rfxencode_rlgr1.h"
#include "rfxencode_rlgr3.h"
#include "rfxencode_alpha.h"

#define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LLOG_LEVEL) { printf _args ; printf("\n"); } } while (0)

/******************************************************************************/
static int
rfx_encode_format_rgb(const char *rgb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
int x;
int y;
const uint8 *src;
uint8 r;
uint8 g;
uint8 b;
uint8 *lr_buf;
uint8 *lg_buf;
uint8 *lb_buf;

LLOGLN(10, ("rfx_encode_format_rgb: pixel_format %d", pixel_format));
b = 0;
g = 0;
r = 0;
switch (pixel_format)
{
case RFX_FORMAT_BGRA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
src++;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = r;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGBA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
src++;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_BGR:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGB:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
}
return 0;
}

/******************************************************************************/
static int
rfx_encode_format_argb(const char *argb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *a_buf, uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
int x;
int y;
const uint8 *src;
uint8 a;
uint8 r;
uint8 g;
uint8 b;
uint8 *la_buf;
uint8 *lr_buf;
uint8 *lg_buf;
uint8 *lb_buf;

LLOGLN(10, ("rfx_encode_format_argb: pixel_format %d", pixel_format));
b = 0;
g = 0;
r = 0;
a = 0;
switch (pixel_format)
{
case RFX_FORMAT_BGRA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
a = *src++;
*la_buf++ = a;
}
while (x < 64)
{
*la_buf++ = a;
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = r;
x++;
}
}
while (y < 64)
{
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(la_buf, la_buf - 64, 64);
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGBA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
a = *src++;
*la_buf++ = a;
}
while (x < 64)
{
*la_buf++ = a;
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(la_buf, la_buf - 64, 64);
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_BGR:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGB:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
}
return 0;
}

/******************************************************************************/
/* http://msdn.microsoft.com/en-us/library/ff635643.aspx
* 0.299 -0.168935 0.499813
* 0.587 -0.331665 -0.418531
* 0.114 0.50059 -0.081282
y = r * 0.299000 + g * 0.587000 + b * 0.114000;
u = r * -0.168935 + g * -0.331665 + b * 0.500590;
v = r * 0.499813 + g * -0.418531 + b * -0.081282; */
/* 19595 38470 7471
-11071 -21736 32807
32756 -27429 -5327 */
static int
rfx_encode_rgb_to_yuv_tile(uint8 *y_r_buf, uint8 *u_g_buf, uint8 *v_b_buf)
{
int i;
sint32 r, g, b;
sint32 y, u, v;

for (i = 0; i < 4096; i++)
{
r = y_r_buf[i];
g = u_g_buf[i];
b = v_b_buf[i];

y = (r * 19595 + g * 38470 + b * 7471) >> 16;
u = (r * -11071 + g * -21736 + b * 32807) >> 16;
v = (r * 32756 + g * -27429 + b * -5327) >> 16;

y_r_buf[i] = MINMAX(y, 0, 255);
u_g_buf[i] = MINMAX(u + 128, 0, 255);
v_b_buf[i] = MINMAX(v + 128, 0, 255);

}
return 0;
}

/******************************************************************************/
int
rfx_encode_rgb_to_yuv(struct rfxencode *enc, const char *rgb_data,
int width, int height, int stride_bytes)
{
uint8 *y_r_buffer;
uint8 *u_g_buffer;
uint8 *v_b_buffer;

y_r_buffer = enc->y_r_buffer;
u_g_buffer = enc->u_g_buffer;
v_b_buffer = enc->v_b_buffer;

if (rfx_encode_format_rgb(rgb_data, width, height, stride_bytes,
enc->format,
y_r_buffer, u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
if (rfx_encode_rgb_to_yuv_tile(y_r_buffer, u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
return 0;
}

/******************************************************************************/
int
rfx_encode_argb_to_yuva(struct rfxencode *enc, const char *argb_data,
int width, int height, int stride_bytes)
{
uint8 *a_buffer;
uint8 *y_r_buffer;
uint8 *u_g_buffer;
uint8 *v_b_buffer;

a_buffer = enc->a_buffer;
y_r_buffer = enc->y_r_buffer;
u_g_buffer = enc->u_g_buffer;
v_b_buffer = enc->v_b_buffer;

if (rfx_encode_format_argb(argb_data, width, height, stride_bytes,
enc->format, a_buffer,
y_r_buffer, u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
if (rfx_encode_rgb_to_yuv_tile(y_r_buffer, u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
return 0;
}

+ 33
- 0
librfxcodec/src/rfxencode_rgb_to_yuv.h View File

@@ -0,0 +1,33 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* RemoteFX Codec Library - Encode
*
* Copyright 2011 Vic Lee
* Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __RFXRBGTOYUV_H
#define __RFXRBGTOYUV_H

#include "rfxcommon.h"

int
rfx_encode_rgb_to_yuv(struct rfxencode *enc, const char *rgb_data,
int width, int height, int stride_bytes);
int
rfx_encode_argb_to_yuva(struct rfxencode *enc, const char *argb_data,
int width, int height, int stride_bytes);

#endif

+ 12
- 407
librfxcodec/src/rfxencode_tile.c View File

@@ -51,391 +51,6 @@
#define LLOGLN(_level, _args) \
do { if (_level < LLOG_LEVEL) { printf _args ; printf("\n"); } } while (0)

/******************************************************************************/
static int
rfx_encode_format_rgb(const char *rgb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
int x;
int y;
const uint8 *src;
uint8 r;
uint8 g;
uint8 b;
uint8 *lr_buf;
uint8 *lg_buf;
uint8 *lb_buf;

LLOGLN(10, ("rfx_encode_format_rgb: pixel_format %d", pixel_format));
b = 0;
g = 0;
r = 0;
switch (pixel_format)
{
case RFX_FORMAT_BGRA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
src++;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = r;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGBA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
src++;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_BGR:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGB:
for (y = 0; y < height; y++)
{
src = (uint8 *) (rgb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
}
return 0;
}

/******************************************************************************/
static int
rfx_encode_format_argb(const char *argb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *a_buf, uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
int x;
int y;
const uint8 *src;
uint8 a;
uint8 r;
uint8 g;
uint8 b;
uint8 *la_buf;
uint8 *lr_buf;
uint8 *lg_buf;
uint8 *lb_buf;

LLOGLN(10, ("rfx_encode_format_argb: pixel_format %d", pixel_format));
b = 0;
g = 0;
r = 0;
a = 0;
switch (pixel_format)
{
case RFX_FORMAT_BGRA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
a = *src++;
*la_buf++ = a;
}
while (x < 64)
{
*la_buf++ = a;
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = r;
x++;
}
}
while (y < 64)
{
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(la_buf, la_buf - 64, 64);
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGBA:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
a = *src++;
*la_buf++ = a;
}
while (x < 64)
{
*la_buf++ = a;
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
la_buf = a_buf + y * 64;
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(la_buf, la_buf - 64, 64);
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_BGR:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
b = *src++;
*lb_buf++ = b;
g = *src++;
*lg_buf++ = g;
r = *src++;
*lr_buf++ = r;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
case RFX_FORMAT_RGB:
for (y = 0; y < height; y++)
{
src = (uint8 *) (argb_data + y * stride_bytes);
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
for (x = 0; x < width; x++)
{
r = *src++;
*lr_buf++ = r;
g = *src++;
*lg_buf++ = g;
b = *src++;
*lb_buf++ = b;
}
while (x < 64)
{
*lr_buf++ = r;
*lg_buf++ = g;
*lb_buf++ = b;
x++;
}
}
while (y < 64)
{
lr_buf = r_buf + y * 64;
lg_buf = g_buf + y * 64;
lb_buf = b_buf + y * 64;
memcpy(lr_buf, lr_buf - 64, 64);
memcpy(lg_buf, lg_buf - 64, 64);
memcpy(lb_buf, lb_buf - 64, 64);
y++;
}
break;
}
return 0;
}

/******************************************************************************/
/* http://msdn.microsoft.com/en-us/library/ff635643.aspx
* 0.299 -0.168935 0.499813
* 0.587 -0.331665 -0.418531
* 0.114 0.50059 -0.081282
y = r * 0.299000 + g * 0.587000 + b * 0.114000;
u = r * -0.168935 + g * -0.331665 + b * 0.500590;
v = r * 0.499813 + g * -0.418531 + b * -0.081282; */
/* 19595 38470 7471
-11071 -21736 32807
32756 -27429 -5327 */
static int
rfx_encode_rgb_to_yuv(uint8 *y_r_buf, uint8 *u_g_buf, uint8 *v_b_buf)
{
int i;
sint32 r, g, b;
sint32 y, u, v;

for (i = 0; i < 4096; i++)
{
r = y_r_buf[i];
g = u_g_buf[i];
b = v_b_buf[i];

y = (r * 19595 + g * 38470 + b * 7471) >> 16;
u = (r * -11071 + g * -21736 + b * 32807) >> 16;
v = (r * 32756 + g * -27429 + b * -5327) >> 16;

y_r_buf[i] = MINMAX(y, 0, 255);
u_g_buf[i] = MINMAX(u + 128, 0, 255);
v_b_buf[i] = MINMAX(v + 128, 0, 255);

}
return 0;
}

/******************************************************************************/
int
rfx_encode_component_rlgr1(struct rfxencode *enc, const char *qtable,
@@ -494,19 +109,15 @@ rfx_encode_rgb(struct rfxencode *enc, const char *rgb_data,
uint8 *u_g_buffer;
uint8 *v_b_buffer;

y_r_buffer = enc->y_r_buffer;
u_g_buffer = enc->u_g_buffer;
v_b_buffer = enc->v_b_buffer;
if (rfx_encode_format_rgb(rgb_data, width, height, stride_bytes,
enc->format,
y_r_buffer, u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
if (rfx_encode_rgb_to_yuv(y_r_buffer, u_g_buffer, v_b_buffer) != 0)
LLOGLN(10, ("rfx_encode_rgb:"));
if (enc->rfx_encode_rgb_to_yuv(enc, rgb_data, width, height,
stride_bytes) != 0)
{
return 1;
}
y_r_buffer = enc->y_r_buffer;
u_g_buffer = enc->u_g_buffer;
v_b_buffer = enc->v_b_buffer;
if (enc->rfx_encode(enc, y_quants, y_r_buffer,
stream_get_tail(data_out),
stream_get_left(data_out),
@@ -539,7 +150,7 @@ rfx_encode_rgb(struct rfxencode *enc, const char *rgb_data,

/******************************************************************************/
int
rfx_encode_argb(struct rfxencode *enc, const char *rgb_data,
rfx_encode_argb(struct rfxencode *enc, const char *argb_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
@@ -552,21 +163,15 @@ rfx_encode_argb(struct rfxencode *enc, const char *rgb_data,
uint8 *v_b_buffer;

LLOGLN(10, ("rfx_encode_argb:"));
if (enc->rfx_encode_argb_to_yuva(enc, argb_data, width, height,
stride_bytes) != 0)
{
return 1;
}
a_buffer = enc->a_buffer;
y_r_buffer = enc->y_r_buffer;
u_g_buffer = enc->u_g_buffer;
v_b_buffer = enc->v_b_buffer;
if (rfx_encode_format_argb(rgb_data, width, height, stride_bytes,
enc->format,
a_buffer, y_r_buffer,
u_g_buffer, v_b_buffer) != 0)
{
return 1;
}
if (rfx_encode_rgb_to_yuv(y_r_buffer, u_g_buffer, v_b_buffer) != 0)