From 98e99bf153c581bef87fa442eb9be9cee520ce65 Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Wed, 11 Oct 2023 17:19:45 +0000
Subject: [PATCH 1/2] Rename src/rfxconstants.h -> include/ms-rdprfx.h
and add alias to indicate RemoteFX Codec mode (video/image).
---
src/rfxconstants.h => include/ms-rdprfx.h | 2 ++
src/Makefile.am | 1 -
src/rfxencode.c | 2 +-
src/rfxencode_alpha.c | 2 +-
src/rfxencode_compose.c | 2 +-
src/rfxencode_differential.c | 2 +-
src/rfxencode_quantization.c | 2 +-
src/rfxencode_rgb_to_yuv.c | 2 +-
src/rfxencode_tile.c | 2 +-
9 files changed, 9 insertions(+), 8 deletions(-)
rename src/rfxconstants.h => include/ms-rdprfx.h (96%)
diff --git a/src/rfxconstants.h b/include/ms-rdprfx.h
similarity index 96%
rename from src/rfxconstants.h
rename to include/ms-rdprfx.h
index 77f487c..98aa23f 100644
--- a/src/rfxconstants.h
+++ b/include/ms-rdprfx.h
@@ -65,6 +65,8 @@ enum _RLGR_MODE
/* properties.flags */
#define CODEC_MODE 0x02
+#define CODEC_MODE_IMAGE CODEC_MODE
+#define CODEC_MODE_VIDEO 0x00
/* properties.cct */
#define COL_CONV_ICT 0x1
diff --git a/src/Makefile.am b/src/Makefile.am
index 503679a..b32ce60 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,6 @@ noinst_HEADERS = \
rfx_bitstream.h \
rfxcommon.h \
rfxencode_compose.h \
- rfxconstants.h \
rfxencode_alpha.h \
rfxencode_differential.h \
rfxencode_dwt.h \
diff --git a/src/rfxencode.c b/src/rfxencode.c
index 9b7826a..18c5927 100644
--- a/src/rfxencode.c
+++ b/src/rfxencode.c
@@ -29,7 +29,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
#include "rfxencode_compose.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#include "rfxencode_tile.h"
#include "rfxencode_rlgr1.h"
#include "rfxencode_rlgr3.h"
diff --git a/src/rfxencode_alpha.c b/src/rfxencode_alpha.c
index 2b04923..3352f39 100644
--- a/src/rfxencode_alpha.c
+++ b/src/rfxencode_alpha.c
@@ -29,7 +29,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#include "rfxencode_tile.h"
#define LLOG_LEVEL 1
diff --git a/src/rfxencode_compose.c b/src/rfxencode_compose.c
index b07f0c0..f18f312 100644
--- a/src/rfxencode_compose.c
+++ b/src/rfxencode_compose.c
@@ -30,7 +30,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#include "rfxencode_tile.h"
#include "rfxencode_quantization.h"
diff --git a/src/rfxencode_differential.c b/src/rfxencode_differential.c
index 64b4595..60da75e 100644
--- a/src/rfxencode_differential.c
+++ b/src/rfxencode_differential.c
@@ -29,7 +29,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
/******************************************************************************/
int
diff --git a/src/rfxencode_quantization.c b/src/rfxencode_quantization.c
index 45b1672..8c6434e 100644
--- a/src/rfxencode_quantization.c
+++ b/src/rfxencode_quantization.c
@@ -32,7 +32,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#if 0
/******************************************************************************/
diff --git a/src/rfxencode_rgb_to_yuv.c b/src/rfxencode_rgb_to_yuv.c
index 40f785d..f0e7916 100644
--- a/src/rfxencode_rgb_to_yuv.c
+++ b/src/rfxencode_rgb_to_yuv.c
@@ -30,7 +30,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#include "rfxencode_tile.h"
#include "rfxencode_dwt.h"
#include "rfxencode_quantization.h"
diff --git a/src/rfxencode_tile.c b/src/rfxencode_tile.c
index a0ec108..fdfe97a 100644
--- a/src/rfxencode_tile.c
+++ b/src/rfxencode_tile.c
@@ -30,7 +30,7 @@
#include "rfxcommon.h"
#include "rfxencode.h"
-#include "rfxconstants.h"
+#include "ms-rdprfx.h"
#include "rfxencode_tile.h"
#include "rfxencode_dwt.h"
#include "rfxencode_dwt_rem.h"
From bb38821b89dfeeb437ce399af5d7a664f72c3c42 Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Thu, 19 Oct 2023 14:24:06 +0000
Subject: [PATCH 2/2] Implement Image RemoteFX
---
include/rfxcodec_encode.h | 4 ++--
src/rfxencode.c | 11 +++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/rfxcodec_encode.h b/include/rfxcodec_encode.h
index 76e5e6a..5e9ff06 100644
--- a/include/rfxcodec_encode.h
+++ b/include/rfxcodec_encode.h
@@ -41,10 +41,10 @@ struct rfx_tile
};
void *
-rfxcodec_encode_create(int width, int height, int format, int flags);
+rfxcodec_encode_create(int width, int height, int format, int flags, int codec_mode);
int
rfxcodec_encode_create_ex(int width, int height, int format, int flags,
- void **handle);
+ void **handle, int codec_mode);
int
rfxcodec_encode_destroy(void *handle);
/* quants, 5 ints per set, should be num_quants * 5 chars in quants)
diff --git a/src/rfxencode.c b/src/rfxencode.c
index 18c5927..106a951 100644
--- a/src/rfxencode.c
+++ b/src/rfxencode.c
@@ -51,7 +51,7 @@
/******************************************************************************/
int
rfxcodec_encode_create_ex(int width, int height, int format, int flags,
- void **handle)
+ void **handle, int codec_mode)
{
struct rfxencode *enc;
int ax;
@@ -65,6 +65,8 @@ rfxcodec_encode_create_ex(int width, int height, int format, int flags,
return 1;
}
+ enc->flags = (codec_mode == CODEC_MODE_IMAGE) ? CODEC_MODE_IMAGE : CODEC_MODE_VIDEO;
+
enc->dwt_buffer = (sint16 *) (((size_t) (enc->dwt_buffer_a)) & ~15);
enc->dwt_buffer1 = (sint16 *) (((size_t) (enc->dwt_buffer1_a)) & ~15);
enc->dwt_buffer2 = (sint16 *) (((size_t) (enc->dwt_buffer2_a)) & ~15);
@@ -285,12 +287,12 @@ rfxcodec_encode_create_ex(int width, int height, int format, int flags,
/******************************************************************************/
void *
-rfxcodec_encode_create(int width, int height, int format, int flags)
+rfxcodec_encode_create(int width, int height, int format, int flags, int codec_mode)
{
int error;
void *handle;
- error = rfxcodec_encode_create_ex(width, height, format, flags, &handle);
+ error = rfxcodec_encode_create_ex(width, height, format, flags, &handle, codec_mode);
if (error == 0)
{
return handle;
@@ -363,7 +365,8 @@ rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
}
/* Only the first frame should send the RemoteFX header */
- if ((enc->frame_idx == 0) && (enc->header_processed == 0))
+ if (enc->flags == CODEC_MODE_IMAGE ||
+ ((enc->frame_idx == 0) && (enc->header_processed == 0)))
{
if (rfx_compose_message_header(enc, &s) != 0)
{