diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2014-01-21 01:45:35 -0800 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2014-01-21 01:45:35 -0800 |
commit | a9701a7cc3899349a642b6f9fd73c104a3aaee99 (patch) | |
tree | 95184053b85a306309df1f8cc80acedfa1cbb130 /libxrdp/xrdp_jpeg_compress.c | |
parent | 055c577f5497b55fd7bb597c7303aa1236b39d61 (diff) | |
parent | c36bc0c4e4b3ed4608da56011cc51dba5e050d8d (diff) | |
download | xrdp-proprietary-a9701a7cc3899349a642b6f9fd73c104a3aaee99.tar.gz xrdp-proprietary-a9701a7cc3899349a642b6f9fd73c104a3aaee99.zip |
Merge branch 'devel' of github.com:neutrinolabs/xrdp into devel
Diffstat (limited to 'libxrdp/xrdp_jpeg_compress.c')
-rw-r--r-- | libxrdp/xrdp_jpeg_compress.c | 61 |
1 files changed, 61 insertions, 0 deletions
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) |