diff options
author | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-01-20 17:48:17 -0800 |
---|---|---|
committer | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-01-20 17:48:17 -0800 |
commit | 6cd342a20aa988ce21e27261117c6bc6d2dced80 (patch) | |
tree | 7932faf859a3d6cf8fef6b7aaa5d9a3477cf6466 /libxrdp | |
parent | b001b9432aef7642a64bdb84dcd0964ea72a1531 (diff) | |
download | xrdp-proprietary-6cd342a20aa988ce21e27261117c6bc6d2dced80.tar.gz xrdp-proprietary-6cd342a20aa988ce21e27261117c6bc6d2dced80.zip |
added code for region copy used in codec mode
Diffstat (limited to 'libxrdp')
-rw-r--r-- | libxrdp/libxrdp.h | 20 | ||||
-rw-r--r-- | libxrdp/xrdp_jpeg_compress.c | 61 |
2 files changed, 80 insertions, 1 deletions
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h index 70c8a124..993b412b 100644 --- a/libxrdp/libxrdp.h +++ b/libxrdp/libxrdp.h @@ -221,7 +221,7 @@ struct xrdp_orders_state int com_blt_width; /* 2 */ int com_blt_height; /* 2 */ int com_blt_dstformat; /* 2 */ - + }; /* orders */ @@ -473,6 +473,24 @@ xrdp_jpeg_compress(void *handle, char* in_data, int width, int height, struct stream* s, int bpp, int byte_limit, int start_line, struct stream* temp_s, int e, int quality); + +int APP_CC +xrdp_codec_jpeg_compress(void *handle, + int format, /* input data format */ + char *inp_data, /* input data */ + int width, /* width of inp_data */ + int height, /* height of inp_data */ + int stride, /* inp_data stride, in bytes*/ + int x, /* x loc in inp_data */ + int y, /* y loc in inp_data */ + int cx, /* width of area to compress */ + int cy, /* height of area to compress */ + int quality, /* higher numbers compress less */ + char *out_data, /* dest for jpg image */ + int *io_len /* length of out_data and on return */ + /* len of compressed data */ + ); + void *APP_CC xrdp_jpeg_init(void); int APP_CC diff --git a/libxrdp/xrdp_jpeg_compress.c b/libxrdp/xrdp_jpeg_compress.c index a41bd1cf..1bb42b8c 100644 --- a/libxrdp/xrdp_jpeg_compress.c +++ b/libxrdp/xrdp_jpeg_compress.c @@ -98,6 +98,67 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height, return height; } +/** + * Compress a rectangular area (aka inner rectangle) inside our + * frame buffer (inp_data) + *****************************************************************************/ + +int APP_CC +xrdp_codec_jpeg_compress(void *handle, + int format, /* input data format */ + char *inp_data, /* input data */ + int width, /* width of inp_data */ + int height, /* height of inp_data */ + int stride, /* inp_data stride, in bytes*/ + int x, /* x loc in inp_data */ + int y, /* y loc in inp_data */ + int cx, /* width of area to compress */ + int cy, /* height of area to compress */ + int quality, /* higher numbers compress less */ + char *out_data, /* dest for jpg image */ + int *io_len /* length of out_data and on return */ + /* len of compressed data */ + ) +{ + tjhandle tj_han; + int error; + int bpp; + char *src_ptr; + + /* + * note: for now we assume that format is always XBGR and ignore format + */ + + if (handle == 0) + { + g_writeln("xrdp_codec_jpeg_compress: handle is nil"); + return height; + } + + tj_han = (tjhandle) handle; + + /* get bytes per pixel */ + bpp = stride / width; + + /* start of inner rect in inp_data */ + src_ptr = inp_data + (y * stride + x * bpp); + + /* compress inner rect */ + error = tjCompress(tj_han, /* opaque handle */ + src_ptr, /* source buf */ + cx, /* width of area to compress */ + stride, /* pitch */ + cy, /* height of area to compress */ + TJPF_XBGR, /* pixel size */ + out_data, /* dest buf */ + io_len, /* inner_buf length & compressed_size */ + TJSAMP_420, /* jpeg sub sample */ + quality, /* jpeg quality */ + 0 /* flags */ + ); + return height; +} + /*****************************************************************************/ void *APP_CC xrdp_jpeg_init(void) |