diff --git a/libfreerdp/codec/progressive.c b/libfreerdp/codec/progressive.c index 9af579ff2..72f4a3e12 100644 --- a/libfreerdp/codec/progressive.c +++ b/libfreerdp/codec/progressive.c @@ -762,14 +762,13 @@ static INLINE size_t progressive_rfx_get_band_h_count(size_t level) return (64 + (1 << (level - 1))) >> level; } -static INLINE void progressive_rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT temp, size_t level) +static INLINE void progressive_rfx_dwt_2d_decode_block(INT16* buffer, INT16* temp, size_t level) { size_t nDstStepX; size_t nDstStepY; - INT16 *WINPR_RESTRICT HL, *WINPR_RESTRICT LH; - INT16 *WINPR_RESTRICT HH, *WINPR_RESTRICT LL; - INT16 *WINPR_RESTRICT L, *WINPR_RESTRICT H, *WINPR_RESTRICT LLx; + INT16 *HL, *LH; + INT16 *HH, *LL; + INT16 *L, *H, *LLx; const size_t nBandL = progressive_rfx_get_band_l_count(level); const size_t nBandH = progressive_rfx_get_band_h_count(level); @@ -801,7 +800,7 @@ static INLINE void progressive_rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buf nBandL + nBandH); } -void rfx_dwt_2d_extrapolate_decode(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT temp) +void rfx_dwt_2d_extrapolate_decode(INT16* buffer, INT16* temp) { WINPR_ASSERT(buffer); WINPR_ASSERT(temp); diff --git a/libfreerdp/codec/rfx_dwt.c b/libfreerdp/codec/rfx_dwt.c index 0164cee24..d6fe2d482 100644 --- a/libfreerdp/codec/rfx_dwt.c +++ b/libfreerdp/codec/rfx_dwt.c @@ -25,17 +25,13 @@ #include "rfx_dwt.h" -static void rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT idwt, - int subband_width) +static void rfx_dwt_2d_decode_block(INT16* buffer, INT16* idwt, size_t subband_width) { - INT16 *WINPR_RESTRICT dst, *WINPR_RESTRICT l, *WINPR_RESTRICT h; - INT16 *WINPR_RESTRICT l_dst, *WINPR_RESTRICT h_dst; - INT16 *WINPR_RESTRICT hl, *WINPR_RESTRICT lh, *WINPR_RESTRICT hh, *WINPR_RESTRICT ll; - int total_width; - int x, y; - int n; + INT16 *dst, *l, *h; + INT16 *l_dst, *h_dst; + INT16 *hl, *lh, *hh, *ll; - total_width = subband_width << 1; + const size_t total_width = subband_width << 1; /* Inverse DWT in horizontal direction, results in 2 sub-bands in L, H order in tmp buffer idwt. */ @@ -51,26 +47,28 @@ static void rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_R hh = buffer + subband_width * subband_width * 2; h_dst = idwt + subband_width * subband_width * 2; - for (y = 0; y < subband_width; y++) + for (size_t y = 0; y < subband_width; y++) { /* Even coefficients */ l_dst[0] = ll[0] - ((hl[0] + hl[0] + 1) >> 1); h_dst[0] = lh[0] - ((hh[0] + hh[0] + 1) >> 1); - for (n = 1; n < subband_width; n++) + for (size_t n = 1; n < subband_width; n++) { - x = n << 1; + const size_t x = n << 1; l_dst[x] = ll[n] - ((hl[n - 1] + hl[n] + 1) >> 1); h_dst[x] = lh[n] - ((hh[n - 1] + hh[n] + 1) >> 1); } /* Odd coefficients */ + size_t n = 0; for (n = 0; n < subband_width - 1; n++) { - x = n << 1; + const size_t x = n << 1; l_dst[x + 1] = (hl[n] << 1) + ((l_dst[x] + l_dst[x + 2]) >> 1); h_dst[x + 1] = (hh[n] << 1) + ((h_dst[x] + h_dst[x + 2]) >> 1); } - x = n << 1; + + const size_t x = n << 1; l_dst[x + 1] = (hl[n] << 1) + (l_dst[x]); h_dst[x + 1] = (hh[n] << 1) + (h_dst[x]); @@ -84,7 +82,7 @@ static void rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_R } /* Inverse DWT in vertical direction, results are stored in original buffer. */ - for (x = 0; x < total_width; x++) + for (size_t x = 0; x < total_width; x++) { l = idwt + x; h = idwt + x + subband_width * total_width; @@ -92,7 +90,7 @@ static void rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_R *dst = *l - ((*h * 2 + 1) >> 1); - for (n = 1; n < subband_width; n++) + for (size_t n = 1; n < subband_width; n++) { l += total_width; h += total_width; @@ -110,7 +108,7 @@ static void rfx_dwt_2d_decode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_R } } -void rfx_dwt_2d_decode(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer) +void rfx_dwt_2d_decode(INT16* buffer, INT16* dwt_buffer) { WINPR_ASSERT(buffer); WINPR_ASSERT(dwt_buffer); @@ -120,8 +118,7 @@ void rfx_dwt_2d_decode(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_b rfx_dwt_2d_decode_block(&buffer[0], dwt_buffer, 32); } -static void rfx_dwt_2d_encode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt, - UINT32 subband_width) +static void rfx_dwt_2d_encode_block(INT16* buffer, INT16* dwt, UINT32 subband_width) { INT16 *src, *l, *h; INT16 *l_src, *h_src; @@ -198,7 +195,7 @@ static void rfx_dwt_2d_encode_block(INT16* WINPR_RESTRICT buffer, INT16* WINPR_R } } -void rfx_dwt_2d_encode(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer) +void rfx_dwt_2d_encode(INT16* buffer, INT16* dwt_buffer) { WINPR_ASSERT(buffer); WINPR_ASSERT(dwt_buffer); diff --git a/libfreerdp/codec/rfx_dwt.h b/libfreerdp/codec/rfx_dwt.h index 445b1a1be..bd2104b6c 100644 --- a/libfreerdp/codec/rfx_dwt.h +++ b/libfreerdp/codec/rfx_dwt.h @@ -24,11 +24,8 @@ #include #include -FREERDP_LOCAL void rfx_dwt_2d_decode(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT dwt_buffer); -FREERDP_LOCAL void rfx_dwt_2d_encode(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT dwt_buffer); -FREERDP_LOCAL void rfx_dwt_2d_extrapolate_decode(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT dwt_buffer); +FREERDP_LOCAL void rfx_dwt_2d_decode(INT16* buffer, INT16* dwt_buffer); +FREERDP_LOCAL void rfx_dwt_2d_encode(INT16* buffer, INT16* dwt_buffer); +FREERDP_LOCAL void rfx_dwt_2d_extrapolate_decode(INT16* buffer, INT16* dwt_buffer); #endif /* FREERDP_LIB_CODEC_RFX_DWT_H */ diff --git a/libfreerdp/codec/rfx_neon.c b/libfreerdp/codec/rfx_neon.c index f44cbe712..4c4ab9fe1 100644 --- a/libfreerdp/codec/rfx_neon.c +++ b/libfreerdp/codec/rfx_neon.c @@ -67,17 +67,16 @@ static void rfx_quantization_decode_NEON(INT16* buffer, const UINT32* WINPR_REST static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) rfx_dwt_2d_decode_block_horiz_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRICT h, - INT16* WINPR_RESTRICT dst, int subband_width) + INT16* WINPR_RESTRICT dst, size_t subband_width) { - int y, n; INT16* l_ptr = l; INT16* h_ptr = h; INT16* dst_ptr = dst; - for (y = 0; y < subband_width; y++) + for (size_t y = 0; y < subband_width; y++) { /* Even coefficients */ - for (n = 0; n < subband_width; n += 8) + for (size_t n = 0; n < subband_width; n += 8) { // dst[2n] = l[n] - ((h[n-1] + h[n] + 1) >> 1); int16x8_t l_n = vld1q_s16(l_ptr); @@ -103,7 +102,7 @@ rfx_dwt_2d_decode_block_horiz_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRIC h_ptr -= subband_width; /* Odd coefficients */ - for (n = 0; n < subband_width; n += 8) + for (size_t n = 0; n < subband_width; n += 8) { // dst[2n + 1] = (h[n] << 1) + ((dst[2n] + dst[2n + 2]) >> 1); int16x8_t h_n = vld1q_s16(h_ptr); @@ -131,18 +130,17 @@ rfx_dwt_2d_decode_block_horiz_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRIC static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) rfx_dwt_2d_decode_block_vert_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRICT h, - INT16* WINPR_RESTRICT dst, int subband_width) + INT16* WINPR_RESTRICT dst, size_t subband_width) { - int x, n; INT16* l_ptr = l; INT16* h_ptr = h; INT16* dst_ptr = dst; - int total_width = subband_width + subband_width; + const size_t total_width = subband_width + subband_width; /* Even coefficients */ - for (n = 0; n < subband_width; n++) + for (size_t n = 0; n < subband_width; n++) { - for (x = 0; x < total_width; x += 8) + for (size_t x = 0; x < total_width; x += 8) { // dst[2n] = l[n] - ((h[n-1] + h[n] + 1) >> 1); int16x8_t l_n = vld1q_s16(l_ptr); @@ -172,9 +170,9 @@ rfx_dwt_2d_decode_block_vert_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRICT dst_ptr = dst + total_width; /* Odd coefficients */ - for (n = 0; n < subband_width; n++) + for (size_t n = 0; n < subband_width; n++) { - for (x = 0; x < total_width; x += 8) + for (size_t x = 0; x < total_width; x += 8) { // dst[2n + 1] = (h[n] << 1) + ((dst[2n] + dst[2n + 2]) >> 1); int16x8_t h_n = vld1q_s16(h_ptr); @@ -203,7 +201,7 @@ rfx_dwt_2d_decode_block_vert_NEON(INT16* WINPR_RESTRICT l, INT16* WINPR_RESTRICT static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) rfx_dwt_2d_decode_block_NEON(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT idwt, - int subband_width) + size_t subband_width) { INT16 *hl, *lh, *hh, *ll; INT16 *l_dst, *h_dst; @@ -224,7 +222,7 @@ rfx_dwt_2d_decode_block_NEON(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT rfx_dwt_2d_decode_block_vert_NEON(l_dst, h_dst, buffer, subband_width); } -static void rfx_dwt_2d_decode_NEON(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer) +static void rfx_dwt_2d_decode_NEON(INT16* buffer, INT16* dwt_buffer) { rfx_dwt_2d_decode_block_NEON(buffer + 3840, dwt_buffer, 8); rfx_dwt_2d_decode_block_NEON(buffer + 3072, dwt_buffer, 16); @@ -468,8 +466,7 @@ static INLINE size_t prfx_get_band_h_count(size_t level) return (64 + (1 << (level - 1))) >> level; } -static INLINE void rfx_dwt_2d_decode_extrapolate_block_neon(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT temp, +static INLINE void rfx_dwt_2d_decode_extrapolate_block_neon(INT16* buffer, INT16* temp, size_t level) { size_t nDstStepX; @@ -511,8 +508,7 @@ static INLINE void rfx_dwt_2d_decode_extrapolate_block_neon(INT16* WINPR_RESTRIC nBandL + nBandH); } -static void rfx_dwt_2d_extrapolate_decode_neon(INT16* WINPR_RESTRICT buffer, - INT16* WINPR_RESTRICT temp) +static void rfx_dwt_2d_extrapolate_decode_neon(INT16* buffer, INT16* temp) { WINPR_ASSERT(buffer); WINPR_ASSERT(temp); diff --git a/libfreerdp/codec/rfx_sse2.c b/libfreerdp/codec/rfx_sse2.c index 331c7ecc2..7841656e2 100644 --- a/libfreerdp/codec/rfx_sse2.c +++ b/libfreerdp/codec/rfx_sse2.c @@ -319,7 +319,7 @@ rfx_dwt_2d_decode_block_sse2(INT16* buffer, INT16* idwt, int subband_width) rfx_dwt_2d_decode_block_vert_sse2(l_dst, h_dst, buffer, subband_width); } -static void rfx_dwt_2d_decode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer) +static void rfx_dwt_2d_decode_sse2(INT16* buffer, INT16* dwt_buffer) { WINPR_ASSERT(buffer); WINPR_ASSERT(dwt_buffer); @@ -455,7 +455,7 @@ rfx_dwt_2d_encode_block_sse2(INT16* buffer, INT16* dwt, int subband_width) rfx_dwt_2d_encode_block_horiz_sse2(h_src, lh, hh, subband_width); } -static void rfx_dwt_2d_encode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer) +static void rfx_dwt_2d_encode_sse2(INT16* buffer, INT16* dwt_buffer) { WINPR_ASSERT(buffer); WINPR_ASSERT(dwt_buffer); diff --git a/libfreerdp/codec/rfx_types.h b/libfreerdp/codec/rfx_types.h index a9cd314da..5762b30e4 100644 --- a/libfreerdp/codec/rfx_types.h +++ b/libfreerdp/codec/rfx_types.h @@ -165,13 +165,11 @@ struct S_RFX_CONTEXT struct S_RFX_MESSAGE currentMessage; /* routines */ - void (*quantization_decode)(INT16* WINPR_RESTRICT buffer, - const UINT32* WINPR_RESTRICT quantization_values); - void (*quantization_encode)(INT16* WINPR_RESTRICT buffer, - const UINT32* WINPR_RESTRICT quantization_values); - void (*dwt_2d_decode)(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer); - void (*dwt_2d_extrapolate_decode)(INT16* WINPR_RESTRICT src, INT16* WINPR_RESTRICT temp); - void (*dwt_2d_encode)(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer); + void (*quantization_decode)(INT16* buffer, const UINT32* WINPR_RESTRICT quantization_values); + void (*quantization_encode)(INT16* buffer, const UINT32* WINPR_RESTRICT quantization_values); + void (*dwt_2d_decode)(INT16* buffer, INT16* dwt_buffer); + void (*dwt_2d_extrapolate_decode)(INT16* src, INT16* temp); + void (*dwt_2d_encode)(INT16* buffer, INT16* dwt_buffer); int (*rlgr_decode)(RLGR_MODE mode, const BYTE* WINPR_RESTRICT data, UINT32 data_size, INT16* WINPR_RESTRICT buffer, UINT32 buffer_size); int (*rlgr_encode)(RLGR_MODE mode, const INT16* WINPR_RESTRICT data, UINT32 data_size,