/src/FreeRDP/libfreerdp/codec/rfx_differential.h
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * FreeRDP: A Remote Desktop Protocol Implementation |
3 | | * RemoteFX Codec Library - Differential Encoding |
4 | | * |
5 | | * Copyright 2011 Vic Lee |
6 | | * |
7 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | * you may not use this file except in compliance with the License. |
9 | | * You may obtain a copy of the License at |
10 | | * |
11 | | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | | * |
13 | | * Unless required by applicable law or agreed to in writing, software |
14 | | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | * See the License for the specific language governing permissions and |
17 | | * limitations under the License. |
18 | | */ |
19 | | |
20 | | #ifndef FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H |
21 | | #define FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H |
22 | | |
23 | | #include <freerdp/codec/rfx.h> |
24 | | #include <freerdp/api.h> |
25 | | |
26 | | static INLINE void rfx_differential_decode(INT16* WINPR_RESTRICT buffer, size_t size) |
27 | 0 | { |
28 | 0 | INT16* ptr = buffer; |
29 | 0 | INT16* end = &buffer[size - 1]; |
30 | |
|
31 | 0 | while (ptr != end) |
32 | 0 | { |
33 | 0 | ptr[1] += ptr[0]; |
34 | 0 | ptr++; |
35 | 0 | } |
36 | 0 | } Unexecuted instantiation: progressive.c:rfx_differential_decode Unexecuted instantiation: rfx_decode.c:rfx_differential_decode Unexecuted instantiation: rfx_encode.c:rfx_differential_decode |
37 | | |
38 | | static INLINE void rfx_differential_encode(INT16* WINPR_RESTRICT buffer, size_t size) |
39 | 0 | { |
40 | 0 | INT16 n1 = buffer[0]; |
41 | 0 | for (size_t x = 0; x < size - 1; x++) |
42 | 0 | { |
43 | 0 | INT16* dst = &buffer[x + 1]; |
44 | 0 | const INT16 n2 = *dst; |
45 | 0 | *dst -= n1; |
46 | 0 | n1 = n2; |
47 | 0 | } |
48 | 0 | } Unexecuted instantiation: progressive.c:rfx_differential_encode Unexecuted instantiation: rfx_decode.c:rfx_differential_encode Unexecuted instantiation: rfx_encode.c:rfx_differential_encode |
49 | | |
50 | | #endif /* FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H */ |