diff options
Diffstat (limited to 'include/freerdp/codec')
-rw-r--r-- | include/freerdp/codec/audio.h | 228 | ||||
-rw-r--r-- | include/freerdp/codec/bitmap.h | 44 | ||||
-rw-r--r-- | include/freerdp/codec/bulk.h | 39 | ||||
-rw-r--r-- | include/freerdp/codec/clear.h | 56 | ||||
-rw-r--r-- | include/freerdp/codec/color.h | 428 | ||||
-rw-r--r-- | include/freerdp/codec/dsp.h | 54 | ||||
-rw-r--r-- | include/freerdp/codec/h264.h | 94 | ||||
-rw-r--r-- | include/freerdp/codec/interleaved.h | 60 | ||||
-rw-r--r-- | include/freerdp/codec/jpeg.h | 38 | ||||
-rw-r--r-- | include/freerdp/codec/nsc.h | 78 | ||||
-rw-r--r-- | include/freerdp/codec/planar.h | 75 | ||||
-rw-r--r-- | include/freerdp/codec/progressive.h | 76 | ||||
-rw-r--r-- | include/freerdp/codec/region.h | 148 | ||||
-rw-r--r-- | include/freerdp/codec/rfx.h | 144 | ||||
-rw-r--r-- | include/freerdp/codec/yuv.h | 65 | ||||
-rw-r--r-- | include/freerdp/codec/zgfx.h | 61 |
16 files changed, 1688 insertions, 0 deletions
diff --git a/include/freerdp/codec/audio.h b/include/freerdp/codec/audio.h new file mode 100644 index 0000000..08be77d --- /dev/null +++ b/include/freerdp/codec/audio.h @@ -0,0 +1,228 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Formats + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_AUDIO_H +#define FREERDP_CODEC_AUDIO_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct AUDIO_FORMAT + { + UINT16 wFormatTag; + UINT16 nChannels; + UINT32 nSamplesPerSec; + UINT32 nAvgBytesPerSec; + UINT16 nBlockAlign; + UINT16 wBitsPerSample; + UINT16 cbSize; + BYTE* data; + }; + typedef struct AUDIO_FORMAT AUDIO_FORMAT; + +#define SNDC_CLOSE 1 +#define SNDC_WAVE 2 +#define SNDC_SETVOLUME 3 +#define SNDC_SETPITCH 4 +#define SNDC_WAVECONFIRM 5 +#define SNDC_TRAINING 6 +#define SNDC_FORMATS 7 +#define SNDC_CRYPTKEY 8 +#define SNDC_WAVEENCRYPT 9 +#define SNDC_UDPWAVE 10 +#define SNDC_UDPWAVELAST 11 +#define SNDC_QUALITYMODE 12 +#define SNDC_WAVE2 13 + +#define TSSNDCAPS_ALIVE 1 +#define TSSNDCAPS_VOLUME 2 +#define TSSNDCAPS_PITCH 4 + +#define DYNAMIC_QUALITY 0x0000 +#define MEDIUM_QUALITY 0x0001 +#define HIGH_QUALITY 0x0002 + + /* + * Format Tags: + * http://tools.ietf.org/html/rfc2361 + */ + +#ifndef WAVE_FORMAT_UNKNOWN +#define WAVE_FORMAT_UNKNOWN 0x0000 +#endif /* !WAVE_FORMAT_UNKNOWN */ + +#ifndef WAVE_FORMAT_PCM +#define WAVE_FORMAT_PCM 0x0001 +#endif /* !WAVE_FORMAT_PCM */ + +#ifndef WAVE_FORMAT_ADPCM +#define WAVE_FORMAT_ADPCM 0x0002 +#define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#define WAVE_FORMAT_VSELP 0x0004 +#define WAVE_FORMAT_IBM_CVSD 0x0005 +#define WAVE_FORMAT_ALAW 0x0006 +#define WAVE_FORMAT_MULAW 0x0007 +#define WAVE_FORMAT_OKI_ADPCM 0x0010 +#define WAVE_FORMAT_DVI_ADPCM 0x0011 +#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 +#define WAVE_FORMAT_SIERRA_ADPCM 0x0013 +#define WAVE_FORMAT_G723_ADPCM 0x0014 +#define WAVE_FORMAT_DIGISTD 0x0015 +#define WAVE_FORMAT_DIGIFIX 0x0016 +#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 +#define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018 +#define WAVE_FORMAT_CU_CODEC 0x0019 +#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 +#define WAVE_FORMAT_SONARC 0x0021 +#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 +#define WAVE_FORMAT_ECHOSC1 0x0023 +#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 +#define WAVE_FORMAT_APTX 0x0025 +#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 +#define WAVE_FORMAT_PROSODY_1612 0x0027 +#define WAVE_FORMAT_LRC 0x0028 +#define WAVE_FORMAT_DOLBY_AC2 0x0030 +#define WAVE_FORMAT_GSM610 0x0031 +#define WAVE_FORMAT_MSNAUDIO 0x0032 +#define WAVE_FORMAT_ANTEX_ADPCME 0x0033 +#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 +#define WAVE_FORMAT_DIGIREAL 0x0035 +#define WAVE_FORMAT_DIGIADPCM 0x0036 +#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 +#define WAVE_FORMAT_NMS_VBXADPCM 0x0038 +#define WAVE_FORMAT_ROLAND_RDAC 0x0039 +#define WAVE_FORMAT_ECHOSC3 0x003A +#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B +#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C +#define WAVE_FORMAT_XEBEC 0x003D +#define WAVE_FORMAT_G721_ADPCM 0x0040 +#define WAVE_FORMAT_G728_CELP 0x0041 +#define WAVE_FORMAT_MSG723 0x0042 +#define WAVE_FORMAT_MPEG 0x0050 +#define WAVE_FORMAT_RT24 0x0052 +#define WAVE_FORMAT_PAC 0x0053 +#endif /* !WAVE_FORMAT_ADPCM */ + +#ifndef WAVE_FORMAT_MPEGLAYER3 +#define WAVE_FORMAT_MPEGLAYER3 0x0055 +#endif + +#ifndef WAVE_FORMAT_LUCENT_G723 +#define WAVE_FORMAT_LUCENT_G723 0x0059 +#define WAVE_FORMAT_CIRRUS 0x0060 +#define WAVE_FORMAT_ESPCM 0x0061 +#define WAVE_FORMAT_VOXWARE 0x0062 +#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063 +#define WAVE_FORMAT_G726_ADPCM 0x0064 +#define WAVE_FORMAT_G722_ADPCM 0x0065 +#define WAVE_FORMAT_DSAT 0x0066 +#define WAVE_FORMAT_DSAT_DISPLAY 0x0067 +#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069 +#define WAVE_FORMAT_VOXWARE_AC8 0x0070 +#define WAVE_FORMAT_VOXWARE_AC10 0x0071 +#define WAVE_FORMAT_VOXWARE_AC16 0x0072 +#define WAVE_FORMAT_VOXWARE_AC20 0x0073 +#define WAVE_FORMAT_VOXWARE_RT24 0x0074 +#define WAVE_FORMAT_VOXWARE_RT29 0x0075 +#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076 +#define WAVE_FORMAT_VOXWARE_VR12 0x0077 +#define WAVE_FORMAT_VOXWARE_VR18 0x0078 +#define WAVE_FORMAT_VOXWARE_TQ40 0x0079 +#define WAVE_FORMAT_SOFTSOUND 0x0080 +#define WAVE_FORMAT_VOXWARE_TQ60 0x0081 +#define WAVE_FORMAT_MSRT24 0x0082 +#define WAVE_FORMAT_G729A 0x0083 +#define WAVE_FORMAT_MVI_MV12 0x0084 +#define WAVE_FORMAT_DF_G726 0x0085 +#define WAVE_FORMAT_DF_GSM610 0x0086 +#define WAVE_FORMAT_ISIAUDIO 0x0088 +#define WAVE_FORMAT_ONLIVE 0x0089 +#define WAVE_FORMAT_SBC24 0x0091 +#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 +#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097 +#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098 +#define WAVE_FORMAT_PACKED 0x0099 +#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100 +#define WAVE_FORMAT_IRAT 0x0101 +#define WAVE_FORMAT_VIVO_G723 0x0111 +#define WAVE_FORMAT_VIVO_SIREN 0x0112 +#define WAVE_FORMAT_DIGITAL_G723 0x0123 +#define WAVE_FORMAT_WMAUDIO2 0x0161 +#define WAVE_FORMAT_WMAUDIO3 0x0162 +#define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163 +#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 +#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 +#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 +#define WAVE_FORMAT_QUARTERDECK 0x0220 +#define WAVE_FORMAT_FM_TOWNS_SND 0x0300 +#define WAVE_FORMAT_BTV_DIGITAL 0x0400 +#define WAVE_FORMAT_VME_VMPCM 0x0680 +#define WAVE_FORMAT_OLIGSM 0x1000 +#define WAVE_FORMAT_OLIADPCM 0x1001 +#define WAVE_FORMAT_OLICELP 0x1002 +#define WAVE_FORMAT_OLISBC 0x1003 +#define WAVE_FORMAT_OLIOPR 0x1004 +#define WAVE_FORMAT_LH_CODEC 0x1100 +#define WAVE_FORMAT_NORRIS 0x1400 +#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500 +#define WAVE_FORMAT_DVM 0x2000 +#endif /* !WAVE_FORMAT_LUCENT_G723 */ +#define WAVE_FORMAT_OPUS 0x704F +#define WAVE_FORMAT_AAC_MS 0xA106 + +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE + + /** + * Audio Format Functions + */ + + FREERDP_API UINT32 audio_format_compute_time_length(const AUDIO_FORMAT* format, size_t size); + + FREERDP_API char* audio_format_get_tag_string(UINT16 wFormatTag); + + FREERDP_API void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format); + FREERDP_API void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats, + UINT16 count); + + FREERDP_API BOOL audio_format_read(wStream* s, AUDIO_FORMAT* format); + FREERDP_API BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format); + FREERDP_API BOOL audio_format_copy(const AUDIO_FORMAT* srcFormat, AUDIO_FORMAT* dstFormat); + FREERDP_API BOOL audio_format_compatible(const AUDIO_FORMAT* with, const AUDIO_FORMAT* what); + + FREERDP_API void audio_format_free(AUDIO_FORMAT* format); + FREERDP_API void audio_formats_free(AUDIO_FORMAT* formats, size_t count); + + WINPR_ATTR_MALLOC(audio_formats_free, 1) + FREERDP_API AUDIO_FORMAT* audio_format_new(void); + + WINPR_ATTR_MALLOC(audio_formats_free, 1) + FREERDP_API AUDIO_FORMAT* audio_formats_new(size_t count); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_AUDIO_H */ diff --git a/include/freerdp/codec/bitmap.h b/include/freerdp/codec/bitmap.h new file mode 100644 index 0000000..d64bbef --- /dev/null +++ b/include/freerdp/codec/bitmap.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Compressed Bitmap + * + * Copyright 2011 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 FREERDP_CODEC_BITMAP_H +#define FREERDP_CODEC_BITMAP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/color.h> + +#include <winpr/crt.h> +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API SSIZE_T freerdp_bitmap_compress(const void* in_data, UINT32 width, UINT32 height, + wStream* s, UINT32 bpp, UINT32 byte_limit, + UINT32 start_line, wStream* temp_s, UINT32 e); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_BITMAP_H */ diff --git a/include/freerdp/codec/bulk.h b/include/freerdp/codec/bulk.h new file mode 100644 index 0000000..6f20c80 --- /dev/null +++ b/include/freerdp/codec/bulk.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_BULK_H +#define FREERDP_CODEC_BULK_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +/* Level-2 Compression Flags */ + +#define PACKET_COMPRESSED 0x20 +#define PACKET_AT_FRONT 0x40 +#define PACKET_FLUSHED 0x80 + +/* Level-1 Compression Flags */ + +#define L1_PACKET_AT_FRONT 0x04 +#define L1_NO_COMPRESSION 0x02 +#define L1_COMPRESSED 0x01 +#define L1_INNER_COMPRESSION 0x10 + +#endif /* FREERDP_CODEC_BULK_H */ diff --git a/include/freerdp/codec/clear.h b/include/freerdp/codec/clear.h new file mode 100644 index 0000000..4f6ab2a --- /dev/null +++ b/include/freerdp/codec/clear.h @@ -0,0 +1,56 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ClearCodec Bitmap Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_CLEAR_H +#define FREERDP_CODEC_CLEAR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/nsc.h> +#include <freerdp/codec/color.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_CLEAR_CONTEXT CLEAR_CONTEXT; + + FREERDP_API int clear_compress(CLEAR_CONTEXT* clear, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize); + + FREERDP_API INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData, UINT32 SrcSize, + UINT32 nWidth, UINT32 nHeight, BYTE* pDstData, + UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, + const gdiPalette* palette); + + FREERDP_API BOOL clear_context_reset(CLEAR_CONTEXT* clear); + + FREERDP_API void clear_context_free(CLEAR_CONTEXT* clear); + + WINPR_ATTR_MALLOC(clear_context_free, 1) + FREERDP_API CLEAR_CONTEXT* clear_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_CLEAR_H */ diff --git a/include/freerdp/codec/color.h b/include/freerdp/codec/color.h new file mode 100644 index 0000000..10b35ef --- /dev/null +++ b/include/freerdp/codec/color.h @@ -0,0 +1,428 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Color Conversion Routines + * + * Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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 FREERDP_CODEC_COLOR_H +#define FREERDP_CODEC_COLOR_H + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define FREERDP_PIXEL_FORMAT_TYPE_A 0 +#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1 +#define FREERDP_PIXEL_FORMAT_TYPE_ABGR 2 +#define FREERDP_PIXEL_FORMAT_TYPE_RGBA 3 +#define FREERDP_PIXEL_FORMAT_TYPE_BGRA 4 + +#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) \ + (FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR) + +enum FREERDP_IMAGE_FLAGS +{ + FREERDP_FLIP_NONE = 0, + FREERDP_FLIP_VERTICAL = 1, + FREERDP_FLIP_HORIZONTAL = 2, + FREERDP_KEEP_DST_ALPHA = 4 +}; + +#define FREERDP_PIXEL_FORMAT(_bpp, _type, _a, _r, _g, _b) \ + ((_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b)) + +#define FREERDP_PIXEL_FORMAT_TYPE(_format) (((_format) >> 16) & 0x07) + +/*** Design considerations + * + * The format naming scheme is based on byte position in memory. + * RGBA for example names a byte array with red on positon 0, green on 1 etc. + * + * To read and write the appropriate format from / to memory use FreeRDPReadColor and + * FreeRDPWriteColor. + * + * The single pixel manipulation functions use an intermediate integer representation + * that must not be interpreted outside the functions as it is platform dependent. + * + * X for alpha channel denotes unused (but existing) alpha channel data. + */ + +/* 32bpp formats */ +#define PIXEL_FORMAT_ARGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8) +#define PIXEL_FORMAT_XRGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8) +#define PIXEL_FORMAT_ABGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8) +#define PIXEL_FORMAT_XBGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGRA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8) +#define PIXEL_FORMAT_BGRX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8) +#define PIXEL_FORMAT_RGBA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8) +#define PIXEL_FORMAT_RGBX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGRX32_DEPTH30 \ + FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 10, 10, 10) +#define PIXEL_FORMAT_RGBX32_DEPTH30 \ + FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 10, 10, 10) + +/* 24bpp formats */ +#define PIXEL_FORMAT_RGB24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGR24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8) + +/* 16bpp formats */ +#define PIXEL_FORMAT_RGB16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5) +#define PIXEL_FORMAT_BGR16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5) +#define PIXEL_FORMAT_ARGB15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5) +#define PIXEL_FORMAT_RGB15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5) +#define PIXEL_FORMAT_ABGR15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5) +#define PIXEL_FORMAT_BGR15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5) + +/* 8bpp formats */ +#define PIXEL_FORMAT_RGB8 FREERDP_PIXEL_FORMAT(8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0) + +/* 4 bpp formats */ +#define PIXEL_FORMAT_A4 FREERDP_PIXEL_FORMAT(4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0) + +/* 1bpp formats */ +#define PIXEL_FORMAT_MONO FREERDP_PIXEL_FORMAT(1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0) + +struct gdi_palette +{ + UINT32 format; + UINT32 palette[256]; +}; +typedef struct gdi_palette gdiPalette; + + /* Compare two color formats but ignore differences in alpha channel. + */ + FREERDP_API DWORD FreeRDPAreColorFormatsEqualNoAlpha(DWORD first, DWORD second); + + /* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */ + + /*** + * + * Get a string representation of a color + * + * @param format The pixel color format + * + * @return A string representation of format + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetColorFormatName(...) FreeRDPGetColorFormatName(__VA_ARGS__) +#endif + FREERDP_API const char* FreeRDPGetColorFormatName(UINT32 format); + + /*** + * + * Converts a pixel color in internal representation to its red, green, blue + * and alpha components. + * + * @param color The color in format internal representation + * @param format one of PIXEL_FORMAT_* color format defines + * @param _r red color value + * @param _g green color value + * @param _b blue color value + * @param _a alpha color value + * @param palette pallete to use (only used for 8 bit color!) + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define SplitColor(...) FreeRDPSplitColor(__VA_ARGS__) +#endif + FREERDP_API void FreeRDPSplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g, BYTE* _b, + BYTE* _a, const gdiPalette* palette); + + /*** + * + * Converts red, green, blue and alpha values to internal representation. + * + * @param format one of PIXEL_FORMAT_* color format defines + * @param r red color value + * @param g green color value + * @param b blue color value + * @param a alpha color value + * + * @return The pixel color in the desired format. Value is in internal + * representation. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetColor(...) FreeRDPGetColor(__VA_ARGS__) +#endif + FREERDP_API UINT32 FreeRDPGetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a); + + /*** + * + * Returns the number of bits the format format uses. + * + * @param format One of PIXEL_FORMAT_* defines + * + * @return The number of bits the format requires per pixel. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetBitsPerPixel(...) FreeRDPGetBitsPerPixel(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPGetBitsPerPixel(UINT32 format) + { + return (((format) >> 24) & 0x3F); + } + + /*** + * @param format one of PIXEL_FORMAT_* color format defines + * + * @return TRUE if the format has an alpha channel, FALSE otherwise. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ColorHasAlpha(...) FreeRDPColorHasAlpha(__VA_ARGS__) +#endif + static INLINE BOOL FreeRDPColorHasAlpha(UINT32 format) + { + UINT32 alpha = (((format) >> 12) & 0x0F); + + if (alpha == 0) + return FALSE; + + return TRUE; + } + + /*** + * + * Read a pixel from memory to internal representation + * + * @param src The source buffer + * @param format The PIXEL_FORMAT_* define the source buffer uses for encoding + * + * @return The pixel color in internal representation + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ReadColor(...) FreeRDPReadColor(__VA_ARGS__) +#endif + FREERDP_API UINT32 FreeRDPReadColor(const BYTE* WINPR_RESTRICT src, UINT32 format); + + /*** + * + * Write a pixel from internal representation to memory + * + * @param dst The destination buffer + * @param format The PIXEL_FORMAT_* define for encoding + * @param color The pixel color in internal representation + * + * @return TRUE if successful, FALSE otherwise + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define WriteColor(...) FreeRDPWriteColor(__VA_ARGS__) +#define WriteColorIgnoreAlpha(...) FreeRDPWriteColorIgnoreAlpha(__VA_ARGS__) +#endif + FREERDP_API BOOL FreeRDPWriteColor(BYTE* WINPR_RESTRICT dst, UINT32 format, UINT32 color); + FREERDP_API BOOL FreeRDPWriteColorIgnoreAlpha(BYTE* WINPR_RESTRICT dst, UINT32 format, + UINT32 color); + + /*** + * + * Converts a pixel in internal representation format srcFormat to internal + * representation format dstFormat + * + * @param color The pixel color in srcFormat representation + * @param srcFormat The PIXEL_FORMAT_* of color + * @param dstFormat The PIXEL_FORMAT_* of the return. + * @param palette pallete to use (only used for 8 bit color!) + * + * @return The converted pixel color in dstFormat representation + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ConvertColor(...) FreeRDPConvertColor(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPConvertColor(UINT32 color, UINT32 srcFormat, UINT32 dstFormat, + const gdiPalette* palette) + { + BYTE r = 0; + BYTE g = 0; + BYTE b = 0; + BYTE a = 0; + FreeRDPSplitColor(color, srcFormat, &r, &g, &b, &a, palette); + return FreeRDPGetColor(dstFormat, r, g, b, a); + } + + /*** + * + * Returns the number of bytes the format format uses. + * + * @param format One of PIXEL_FORMAT_* defines + * + * @return The number of bytes the format requires per pixel. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetBytesPerPixel(...) FreeRDPGetBytesPerPixel(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPGetBytesPerPixel(UINT32 format) + { + return (FreeRDPGetBitsPerPixel(format) + 7) / 8; + } + + /*** + * + * @param width width to copy in pixels + * @param height height to copy in pixels + * @param data source buffer, must be (nWidth + 7) / 8 bytes long + * + * @return A buffer allocated with winpr_aligned_malloc(width * height, 16) + * if successful, NULL otherwise. + */ + FREERDP_API BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param pSrcData source buffer, must be (nWidth + 7) / 8 bytes long + * @param backColor The background color in internal representation format + * @param foreColor The foreground color in internal representation format + * @param palette palette to use (only used for 8 bit color!) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_monochrome( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData, + UINT32 backColor, UINT32 foreColor, const gdiPalette* WINPR_RESTRICT palette); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param bitsColor icon's image data buffer + * @param cbBitsColor length of the image data buffer in bytes + * @param bitsMask icon's 1bpp image mask buffer + * @param cbBitsMask length of the image mask buffer in bytes + * @param colorTable icon's image color table + * @param cbColorTable length of the image color table buffer in bytes + * @param bpp color image data bits per pixel + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_icon_data( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT16 nWidth, UINT16 nHeight, const BYTE* WINPR_RESTRICT bitsColor, + UINT16 cbBitsColor, const BYTE* WINPR_RESTRICT bitsMask, UINT16 cbBitsMask, + const BYTE* WINPR_RESTRICT colorTable, UINT16 cbColorTable, UINT32 bpp); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param xorMask XOR mask buffer + * @param xorMaskLength XOR mask length in bytes + * @param andMask AND mask buffer + * @param andMaskLength AND mask length in bytes + * @param xorBpp XOR bits per pixel + * @param palette palette to use (only used for 8 bit color!) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_pointer_data( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT xorMask, + UINT32 xorMaskLength, const BYTE* WINPR_RESTRICT andMask, UINT32 andMaskLength, + UINT32 xorBpp, const gdiPalette* WINPR_RESTRICT palette); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param pSrcData source buffer + * @param SrcFormat source buffer format + * @param nSrcStep source buffer stride (line in bytes) 0 for default + * @param nXSrc source buffer x offset in pixels + * @param nYSrc source buffer y offset in pixels + * @param palette palette to use (only used for 8 bit color!) + * @param flags Image flipping flags FREERDP_FLIP_NONE et al + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, + UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, + const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep, + UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette, + UINT32 flags); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nDstWidth width of destination in pixels + * @param nDstHeight height of destination in pixels + * @param pSrcData source buffer + * @param SrcFormat source buffer format + * @param nSrcStep source buffer stride (line in bytes) 0 for default + * @param nXSrc source buffer x offset in pixels + * @param nYSrc source buffer y offset in pixels + * @param nSrcWidth width of source in pixels + * @param nSrcHeight height of source in pixels + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_scale(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, + UINT32 nDstWidth, UINT32 nDstHeight, + const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, + UINT32 nSrcWidth, UINT32 nSrcHeight); + + /*** + * + * @param pDstData destionation buffer + * @param DstFormat destionation buffer format + * @param nDstStep destionation buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param color Pixel color in DstFormat (internal representation format, + * use FreeRDPGetColor to create) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, + UINT32 nHeight, UINT32 color); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_COLOR_H */ diff --git a/include/freerdp/codec/dsp.h b/include/freerdp/codec/dsp.h new file mode 100644 index 0000000..8fbdad7 --- /dev/null +++ b/include/freerdp/codec/dsp.h @@ -0,0 +1,54 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Digital Sound Processing + * + * Copyright 2010-2011 Vic Lee + * + * 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 FREERDP_CODEC_DSP_H +#define FREERDP_CODEC_DSP_H + +#include <winpr/stream.h> + +#include <freerdp/api.h> +#include <freerdp/codec/audio.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_FREERDP_DSP_CONTEXT FREERDP_DSP_CONTEXT; + + FREERDP_API void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context); + + WINPR_ATTR_MALLOC(freerdp_dsp_context_free, 1) + FREERDP_API FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(BOOL encoder); + + FREERDP_API BOOL freerdp_dsp_supports_format(const AUDIO_FORMAT* format, BOOL encode); + FREERDP_API BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT* srcFormat, + const BYTE* data, size_t length, wStream* out); + FREERDP_API BOOL freerdp_dsp_decode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT* srcFormat, + const BYTE* data, size_t length, wStream* out); + + FREERDP_API BOOL freerdp_dsp_context_reset(FREERDP_DSP_CONTEXT* context, + const AUDIO_FORMAT* targetFormat, + UINT32 FramesPerPacket); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_DSP_H */ diff --git a/include/freerdp/codec/h264.h b/include/freerdp/codec/h264.h new file mode 100644 index 0000000..6ad96f9 --- /dev/null +++ b/include/freerdp/codec/h264.h @@ -0,0 +1,94 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * H.264 Bitmap Compression + * + * Copyright 2014 Mike McDonald <Mike.McDonald@software.dell.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 FREERDP_CODEC_H264_H +#define FREERDP_CODEC_H264_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/rdpgfx.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_H264_CONTEXT_SUBSYSTEM H264_CONTEXT_SUBSYSTEM; + typedef struct S_H264_CONTEXT H264_CONTEXT; + typedef struct S_YUV_CONTEXT YUV_CONTEXT; + + typedef enum + { + H264_RATECONTROL_VBR = 0, + H264_RATECONTROL_CQP + } H264_RATECONTROL_MODE; + + typedef enum + { + H264_CONTEXT_OPTION_RATECONTROL, + H264_CONTEXT_OPTION_BITRATE, + H264_CONTEXT_OPTION_FRAMERATE, + H264_CONTEXT_OPTION_QP + } H264_CONTEXT_OPTION; + + FREERDP_API void free_h264_metablock(RDPGFX_H264_METABLOCK* meta); + + FREERDP_API BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option, + UINT32 value); + FREERDP_API UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option); + + FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, + const RECTANGLE_16* regionRect, BYTE** ppDstData, + UINT32* pDstSize, RDPGFX_H264_METABLOCK* meta); + + FREERDP_API INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize, + BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, + UINT32 nDstWidth, UINT32 nDstHeight, + const RECTANGLE_16* regionRects, UINT32 numRegionRect); + + FREERDP_API INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, + BYTE version, const RECTANGLE_16* regionRect, BYTE* op, + BYTE** pDstData, UINT32* pDstSize, BYTE** pAuxDstData, + UINT32* pAuxDstSize, RDPGFX_H264_METABLOCK* meta, + RDPGFX_H264_METABLOCK* auxMeta); + + FREERDP_API INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op, + const RECTANGLE_16* regionRects, UINT32 numRegionRect, + const BYTE* pSrcData, UINT32 SrcSize, + const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect, + const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData, + DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth, + UINT32 nDstHeight, UINT32 codecId); + + FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height); + + FREERDP_API void h264_context_free(H264_CONTEXT* h264); + + WINPR_ATTR_MALLOC(h264_context_free, 1) + FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_H264_H */ diff --git a/include/freerdp/codec/interleaved.h b/include/freerdp/codec/interleaved.h new file mode 100644 index 0000000..964fb04 --- /dev/null +++ b/include/freerdp/codec/interleaved.h @@ -0,0 +1,60 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Interleaved RLE Bitmap Codec + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_INTERLEAVED_H +#define FREERDP_CODEC_INTERLEAVED_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/color.h> +#include <freerdp/codec/bitmap.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_BITMAP_INTERLEAVED_CONTEXT BITMAP_INTERLEAVED_CONTEXT; + + FREERDP_API BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, + const BYTE* pSrcData, UINT32 SrcSize, UINT32 nSrcWidth, + UINT32 nSrcHeight, UINT32 bpp, BYTE* pDstData, + UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, + const gdiPalette* palette); + + FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pDstData, + UINT32* pDstSize, UINT32 nWidth, UINT32 nHeight, + const BYTE* pSrcData, UINT32 SrcFormat, UINT32 nSrcStep, + UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette, + UINT32 bpp); + + FREERDP_API BOOL bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved); + + FREERDP_API void bitmap_interleaved_context_free(BITMAP_INTERLEAVED_CONTEXT* interleaved); + + WINPR_ATTR_MALLOC(bitmap_interleaved_context_free, 1) + FREERDP_API BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_INTERLEAVED_H */ diff --git a/include/freerdp/codec/jpeg.h b/include/freerdp/codec/jpeg.h new file mode 100644 index 0000000..b9621fd --- /dev/null +++ b/include/freerdp/codec/jpeg.h @@ -0,0 +1,38 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Compressed Bitmap + * + * Copyright 2012 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 FREERDP_CODEC_JPEG_H +#define FREERDP_CODEC_JPEG_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL jpeg_decompress(const BYTE* input, BYTE* output, int width, int height, + int size, int bpp); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_JPEG_H */ diff --git a/include/freerdp/codec/nsc.h b/include/freerdp/codec/nsc.h new file mode 100644 index 0000000..a0a266d --- /dev/null +++ b/include/freerdp/codec/nsc.h @@ -0,0 +1,78 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * NSCodec Codec + * + * Copyright 2011 Samsung, Author Jiten Pathy + * Copyright 2012 Vic Lee + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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 FREERDP_CODEC_NSCODEC_H +#define FREERDP_CODEC_NSCODEC_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> + +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + NSC_COLOR_LOSS_LEVEL, + NSC_ALLOW_SUBSAMPLING, + NSC_DYNAMIC_COLOR_FIDELITY, + NSC_COLOR_FORMAT + } NSC_PARAMETER; + + typedef struct S_NSC_CONTEXT NSC_CONTEXT; + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use nsc_context_set_parameters(NSC_COLOR_FORMAT)", + BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context, + UINT32 pixel_format)); +#endif + + FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* context, NSC_PARAMETER what, + UINT32 value); + + FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp, UINT32 width, + UINT32 height, const BYTE* data, UINT32 length, + BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStride, + UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, + UINT32 flip); + FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s, const BYTE* bmpdata, + UINT32 width, UINT32 height, UINT32 rowstride); + FREERDP_API BOOL nsc_decompose_message(NSC_CONTEXT* context, wStream* s, BYTE* bmpdata, + UINT32 x, UINT32 y, UINT32 width, UINT32 height, + UINT32 rowstride, UINT32 format, UINT32 flip); + + FREERDP_API BOOL nsc_context_reset(NSC_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API void nsc_context_free(NSC_CONTEXT* context); + + WINPR_ATTR_MALLOC(nsc_context_free, 1) + FREERDP_API NSC_CONTEXT* nsc_context_new(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_NSCODEC_H */ diff --git a/include/freerdp/codec/planar.h b/include/freerdp/codec/planar.h new file mode 100644 index 0000000..e29bce2 --- /dev/null +++ b/include/freerdp/codec/planar.h @@ -0,0 +1,75 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP6 Planar Codec + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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 FREERDP_CODEC_PLANAR_H +#define FREERDP_CODEC_PLANAR_H + +#include <winpr/crt.h> + +#include <freerdp/codec/color.h> +#include <freerdp/codec/bitmap.h> + +#define PLANAR_FORMAT_HEADER_CS (1 << 3) +#define PLANAR_FORMAT_HEADER_RLE (1 << 4) +#define PLANAR_FORMAT_HEADER_NA (1 << 5) +#define PLANAR_FORMAT_HEADER_CLL_MASK 0x07 + +#define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \ + (_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4) + +#define PLANAR_CONTROL_BYTE_RUN_LENGTH(_controlByte) (_controlByte & 0x0F) +#define PLANAR_CONTROL_BYTE_RAW_BYTES(_controlByte) ((_controlByte >> 4) & 0x0F) + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT; + + FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context, + const BYTE* data, UINT32 format, UINT32 width, + UINT32 height, UINT32 scanline, BYTE* dstData, + UINT32* pDstSize); + + FREERDP_API BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, + UINT32 width, UINT32 height); + + FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context); + + WINPR_ATTR_MALLOC(freerdp_bitmap_planar_context_free, 1) + FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 width, + UINT32 height); + + FREERDP_API void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* planar, BOOL bgr); + FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* planar, BOOL topdown); + + FREERDP_API BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, + UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, + BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep, + UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, + UINT32 nDstHeight, BOOL vFlip); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_PLANAR_H */ diff --git a/include/freerdp/codec/progressive.h b/include/freerdp/codec/progressive.h new file mode 100644 index 0000000..6593e63 --- /dev/null +++ b/include/freerdp/codec/progressive.h @@ -0,0 +1,76 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Progressive Codec Bitmap Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_PROGRESSIVE_H +#define FREERDP_CODEC_PROGRESSIVE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <winpr/wlog.h> +#include <winpr/collections.h> + +#include <freerdp/codec/rfx.h> +#include <freerdp/codec/color.h> +#include <freerdp/codec/region.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_PROGRESSIVE_CONTEXT PROGRESSIVE_CONTEXT; + + FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData, + UINT32 SrcSize, UINT32 SrcFormat, UINT32 Width, + UINT32 Height, UINT32 ScanLine, + const REGION16* invalidRegion, BYTE** ppDstData, + UINT32* pDstSize); + + FREERDP_API INT32 progressive_decompress(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData, + UINT32 SrcSize, BYTE* pDstData, UINT32 DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, + REGION16* invalidRegion, UINT16 surfaceId, + UINT32 frameId); + + FREERDP_API INT32 progressive_create_surface_context(PROGRESSIVE_CONTEXT* progressive, + UINT16 surfaceId, UINT32 width, + UINT32 height); + FREERDP_API int progressive_delete_surface_context(PROGRESSIVE_CONTEXT* progressive, + UINT16 surfaceId); + + FREERDP_API BOOL progressive_context_reset(PROGRESSIVE_CONTEXT* progressive); + + FREERDP_API void progressive_context_free(PROGRESSIVE_CONTEXT* progressive); + + WINPR_ATTR_MALLOC(progressive_context_free, 1) + FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new(BOOL Compressor); + + WINPR_ATTR_MALLOC(progressive_context_free, 1) + FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new_ex(BOOL Compressor, + UINT32 ThreadingFlags); + + FREERDP_API BOOL progressive_rfx_write_message_progressive_simple( + PROGRESSIVE_CONTEXT* progressive, wStream* s, const RFX_MESSAGE* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_PROGRESSIVE_H */ diff --git a/include/freerdp/codec/region.h b/include/freerdp/codec/region.h new file mode 100644 index 0000000..19239b6 --- /dev/null +++ b/include/freerdp/codec/region.h @@ -0,0 +1,148 @@ +/** + * Copyright © 2014 Thincast Technologies GmbH + * Copyright © 2014 Hardening <contact@hardening-consulting.com> + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef FREERDP_CODEC_REGION_H +#define FREERDP_CODEC_REGION_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_REGION16_DATA REGION16_DATA; + + typedef struct + { + RECTANGLE_16 extents; + REGION16_DATA* data; + } REGION16; + + /** computes if two rectangles are equal + * @param r1 first rectangle + * @param r2 second rectangle + * @return if the two rectangles are equal + */ + FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2); + + /** computes if two rectangles intersect + * @param r1 first rectangle + * @param r2 second rectangle + * @return if the two rectangles intersect + */ + FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2); + + /** computes the intersection of two rectangles + * @param r1 first rectangle + * @param r2 second rectangle + * @param dst resulting intersection + * @return if the two rectangles intersect + */ + FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1, const RECTANGLE_16* r2, + RECTANGLE_16* dst); + + /** initialize a region16 + * @param region the region to initialise + */ + FREERDP_API void region16_init(REGION16* region); + + /** @return the number of rectangles of this region16 */ + FREERDP_API int region16_n_rects(const REGION16* region); + + /** returns a pointer to rectangles and the number of rectangles in this region. + * nbRects can be set to NULL if not interested in the number of rectangles. + * @param region the input region + * @param nbRects if non-NULL returns the number of rectangles + * @return a pointer on the rectangles + */ + FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects); + + /** @return the extents rectangle of this region */ + FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region); + + /** returns if the rectangle is empty + * @param rect the rectangle to check + * @return if the rectangle is empty + */ + FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect); + + /** returns if the region is empty + * @param region the region to check + * @return if the region is empty + */ + FREERDP_API BOOL region16_is_empty(const REGION16* region); + + /** clears the region, the region is reset to a (0,0,0,0) region + * @param region the region to clear + */ + FREERDP_API void region16_clear(REGION16* region); + + /** dumps the region on stderr + * @param region the region to dump + */ + FREERDP_API void region16_print(const REGION16* region); + + /** copies the region to another region + * @param dst destination region + * @param src source region + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src); + + /** adds a rectangle in src and stores the resulting region in dst + * @param dst destination region + * @param src source region + * @param rect the rectangle to add + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src, + const RECTANGLE_16* rect); + + /** returns if a rectangle intersects the region + * @param src the region + * @param arg2 the rectangle + * @return if region and rectangle intersect + */ + FREERDP_API BOOL region16_intersects_rect(const REGION16* src, const RECTANGLE_16* arg2); + + /** computes the intersection between a region and a rectangle + * @param dst destination region + * @param src the source region + * @param arg2 the rectangle that intersects + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src, + const RECTANGLE_16* arg2); + + /** release internal data associated with this region + * @param region the region to release + */ + FREERDP_API void region16_uninit(REGION16* region); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_REGION_H */ diff --git a/include/freerdp/codec/rfx.h b/include/freerdp/codec/rfx.h new file mode 100644 index 0000000..2b122be --- /dev/null +++ b/include/freerdp/codec/rfx.h @@ -0,0 +1,144 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RemoteFX Codec + * + * Copyright 2011 Vic Lee + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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 FREERDP_CODEC_REMOTEFX_H +#define FREERDP_CODEC_REMOTEFX_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> +#include <freerdp/codec/region.h> + +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + RLGR1, + RLGR3 + } RLGR_MODE; + + typedef struct + { + UINT16 x; + UINT16 y; + UINT16 width; + UINT16 height; + } RFX_RECT; + + typedef struct + { + UINT16 x; + UINT16 y; + UINT32 width; + UINT32 height; + BYTE* data; + UINT32 scanline; + BOOL allocated; + BYTE quantIdxY; + BYTE quantIdxCb; + BYTE quantIdxCr; + UINT16 xIdx; + UINT16 yIdx; + UINT16 YLen; + UINT16 CbLen; + UINT16 CrLen; + BYTE* YData; + BYTE* CbData; + BYTE* CrData; + BYTE* YCbCrData; + } RFX_TILE; + + typedef struct S_RFX_MESSAGE_LIST RFX_MESSAGE_LIST; + typedef struct S_RFX_MESSAGE RFX_MESSAGE; + typedef struct S_RFX_CONTEXT RFX_CONTEXT; + + FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length, + UINT32 left, UINT32 top, BYTE* dst, UINT32 dstFormat, + UINT32 dstStride, UINT32 dstHeight, + REGION16* invalidRegion); + + FREERDP_API UINT32 rfx_message_get_frame_idx(const RFX_MESSAGE* message); + FREERDP_API const UINT32* rfx_message_get_quants(const RFX_MESSAGE* message, + UINT16* numQuantVals); + + FREERDP_API const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* message, + UINT16* numTiles); + FREERDP_API UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* message); + + FREERDP_API const RFX_RECT* rfx_message_get_rects(const RFX_MESSAGE* message, UINT16* numRects); + FREERDP_API UINT16 rfx_message_get_rect_count(const RFX_MESSAGE* message); + + FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message); + + FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects, + size_t num_rects, const BYTE* image_data, UINT32 width, + UINT32 height, UINT32 rowstride); + + FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, + size_t numRects, const BYTE* data, UINT32 width, + UINT32 height, size_t scanline); + + FREERDP_API RFX_MESSAGE_LIST* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, + size_t numRects, const BYTE* data, + UINT32 width, UINT32 height, UINT32 scanline, + size_t* numMessages, size_t maxDataSize); + FREERDP_API void rfx_message_list_free(RFX_MESSAGE_LIST* messages); + + FREERDP_API const RFX_MESSAGE* rfx_message_list_get(const RFX_MESSAGE_LIST* messages, + size_t idx); + + FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, + const RFX_MESSAGE* message); + + FREERDP_API void rfx_context_free(RFX_CONTEXT* context); + + WINPR_ATTR_MALLOC(rfx_context_free, 1) + FREERDP_API RFX_CONTEXT* rfx_context_new_ex(BOOL encoder, UINT32 ThreadingFlags); + + WINPR_ATTR_MALLOC(rfx_context_free, 1) + FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder); + + FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API BOOL rfx_context_set_mode(RFX_CONTEXT* context, RLGR_MODE mode); + FREERDP_API RLGR_MODE rfx_context_get_mode(RFX_CONTEXT* context); + + FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, UINT32 pixel_format); + FREERDP_API UINT32 rfx_context_get_pixel_format(RFX_CONTEXT* context); + + FREERDP_API void rfx_context_set_palette(RFX_CONTEXT* context, const BYTE* palette); + FREERDP_API const BYTE* rfx_context_get_palette(RFX_CONTEXT* context); + + FREERDP_API UINT32 rfx_context_get_frame_idx(const RFX_CONTEXT* context); + + FREERDP_API BOOL rfx_write_message_progressive_simple(RFX_CONTEXT* rfx, wStream* s, + const RFX_MESSAGE* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_REMOTEFX_H */ diff --git a/include/freerdp/codec/yuv.h b/include/freerdp/codec/yuv.h new file mode 100644 index 0000000..6a1ea17 --- /dev/null +++ b/include/freerdp/codec/yuv.h @@ -0,0 +1,65 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * YUV decoder + * + * Copyright 2017 David Fort <contact@hardening-consulting.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 FREERDP_CODEC_YUV_H +#define FREERDP_CODEC_YUV_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_YUV_CONTEXT YUV_CONTEXT; + + FREERDP_API BOOL yuv420_context_decode(YUV_CONTEXT* context, const BYTE* pYUVData[3], + const UINT32 iStride[3], UINT32 yuvHeight, + DWORD DstFormat, BYTE* dest, UINT32 nDstStep, + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + FREERDP_API BOOL yuv420_context_encode(YUV_CONTEXT* context, const BYTE* rgbData, + UINT32 srcStep, UINT32 srcFormat, + const UINT32 iStride[3], BYTE* yuvData[3], + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + + FREERDP_API BOOL yuv444_context_decode(YUV_CONTEXT* context, BYTE type, const BYTE* pYUVData[3], + const UINT32 iStride[3], UINT32 srcYuvHeight, + BYTE* pYUVDstData[3], const UINT32 iDstStride[3], + DWORD DstFormat, BYTE* dest, UINT32 nDstStep, + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + FREERDP_API BOOL yuv444_context_encode(YUV_CONTEXT* context, BYTE version, const BYTE* pSrcData, + UINT32 nSrcStep, UINT32 SrcFormat, + const UINT32 iStride[3], BYTE* pYUVLumaData[3], + BYTE* pYUVChromaData[3], const RECTANGLE_16* regionRects, + UINT32 numRegionRects); + + FREERDP_API BOOL yuv_context_reset(YUV_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API void yuv_context_free(YUV_CONTEXT* context); + + WINPR_ATTR_MALLOC(yuv_context_free, 1) + FREERDP_API YUV_CONTEXT* yuv_context_new(BOOL encoder, UINT32 ThreadingFlags); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_YUV_H */ diff --git a/include/freerdp/codec/zgfx.h b/include/freerdp/codec/zgfx.h new file mode 100644 index 0000000..53e211c --- /dev/null +++ b/include/freerdp/codec/zgfx.h @@ -0,0 +1,61 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ZGFX (RDP8) Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@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 FREERDP_CODEC_ZGFX_H +#define FREERDP_CODEC_ZGFX_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/bulk.h> + +#define ZGFX_SEGMENTED_SINGLE 0xE0 +#define ZGFX_SEGMENTED_MULTIPART 0xE1 + +#define ZGFX_PACKET_COMPR_TYPE_RDP8 0x04 + +#define ZGFX_SEGMENTED_MAXSIZE 65535 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_ZGFX_CONTEXT ZGFX_CONTEXT; + + FREERDP_API int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize, UINT32 flags); + FREERDP_API int zgfx_compress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags); + FREERDP_API int zgfx_compress_to_stream(ZGFX_CONTEXT* zgfx, wStream* sDst, + const BYTE* pUncompressed, UINT32 uncompressedSize, + UINT32* pFlags); + + FREERDP_API void zgfx_context_reset(ZGFX_CONTEXT* zgfx, BOOL flush); + + FREERDP_API void zgfx_context_free(ZGFX_CONTEXT* zgfx); + + WINPR_ATTR_MALLOC(zgfx_context_free, 1) + FREERDP_API ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_ZGFX_H */ |