diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index e29a095ca..3bd247b60 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -45,13 +45,8 @@ #include "rfx_quantization.h" #include "rfx_dwt.h" -#ifdef WITH_SSE2 #include "rfx_sse2.h" -#endif - -#ifdef WITH_NEON #include "rfx_neon.h" -#endif #ifndef RFX_INIT_SIMD #define RFX_INIT_SIMD(_rfx_context) do { } while (0) @@ -232,6 +227,8 @@ RFX_CONTEXT* rfx_context_new(void) context->dwt_2d_decode = rfx_dwt_2d_decode; context->dwt_2d_encode = rfx_dwt_2d_encode; + RFX_INIT_SIMD(context); + return context; } diff --git a/libfreerdp/codec/rfx_neon.c b/libfreerdp/codec/rfx_neon.c index 47ab07840..40683b91b 100644 --- a/libfreerdp/codec/rfx_neon.c +++ b/libfreerdp/codec/rfx_neon.c @@ -40,9 +40,7 @@ static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) rfx_quantization_decode_block_NEON(INT16 * buffer, const int buffer_size, const UINT32 factor) { - if (factor <= 6) - return; - int16x8_t quantFactors = vdupq_n_s16(factor - 6); + int16x8_t quantFactors = vdupq_n_s16(factor); int16x8_t* buf = (int16x8_t*)buffer; int16x8_t* buf_end = (int16x8_t*)(buffer + buffer_size); @@ -59,16 +57,18 @@ rfx_quantization_decode_block_NEON(INT16 * buffer, const int buffer_size, const void rfx_quantization_decode_NEON(INT16 * buffer, const UINT32 * quantization_values) { - rfx_quantization_decode_block_NEON(buffer, 1024, quantization_values[8]); /* HL1 */ - rfx_quantization_decode_block_NEON(buffer + 1024, 1024, quantization_values[7]); /* LH1 */ - rfx_quantization_decode_block_NEON(buffer + 2048, 1024, quantization_values[9]); /* HH1 */ - rfx_quantization_decode_block_NEON(buffer + 3072, 256, quantization_values[5]); /* HL2 */ - rfx_quantization_decode_block_NEON(buffer + 3328, 256, quantization_values[4]); /* LH2 */ - rfx_quantization_decode_block_NEON(buffer + 3584, 256, quantization_values[6]); /* HH2 */ - rfx_quantization_decode_block_NEON(buffer + 3840, 64, quantization_values[2]); /* HL3 */ - rfx_quantization_decode_block_NEON(buffer + 3904, 64, quantization_values[1]); /* LH3 */ - rfx_quantization_decode_block_NEON(buffer + 3968, 64, quantization_values[3]); /* HH3 */ - rfx_quantization_decode_block_NEON(buffer + 4032, 64, quantization_values[0]); /* LL3 */ + rfx_quantization_decode_block_NEON(buffer, 4096, 5); + + rfx_quantization_decode_block_NEON(buffer, 1024, quantization_values[8] - 6); /* HL1 */ + rfx_quantization_decode_block_NEON(buffer + 1024, 1024, quantization_values[7] - 6); /* LH1 */ + rfx_quantization_decode_block_NEON(buffer + 2048, 1024, quantization_values[9] - 6); /* HH1 */ + rfx_quantization_decode_block_NEON(buffer + 3072, 256, quantization_values[5] - 6); /* HL2 */ + rfx_quantization_decode_block_NEON(buffer + 3328, 256, quantization_values[4] - 6); /* LH2 */ + rfx_quantization_decode_block_NEON(buffer + 3584, 256, quantization_values[6] - 6); /* HH2 */ + rfx_quantization_decode_block_NEON(buffer + 3840, 64, quantization_values[2] - 6); /* HL3 */ + rfx_quantization_decode_block_NEON(buffer + 3904, 64, quantization_values[1] - 6); /* LH3 */ + rfx_quantization_decode_block_NEON(buffer + 3968, 64, quantization_values[3] - 6); /* HH3 */ + rfx_quantization_decode_block_NEON(buffer + 4032, 64, quantization_values[0] - 6); /* LL3 */ } diff --git a/libfreerdp/codec/rfx_neon.h b/libfreerdp/codec/rfx_neon.h index 4ec15b281..4a4edddf4 100644 --- a/libfreerdp/codec/rfx_neon.h +++ b/libfreerdp/codec/rfx_neon.h @@ -22,8 +22,6 @@ #include -#if defined(__ARM_NEON__) - void rfx_init_neon(RFX_CONTEXT * context); #ifndef RFX_INIT_SIMD @@ -32,7 +30,5 @@ void rfx_init_neon(RFX_CONTEXT * context); #endif #endif -#endif // __ARM_NEON__ - #endif /* __RFX_NEON_H */ diff --git a/libfreerdp/codec/rfx_sse2.h b/libfreerdp/codec/rfx_sse2.h index 2fc14fd47..f1ff20e6d 100644 --- a/libfreerdp/codec/rfx_sse2.h +++ b/libfreerdp/codec/rfx_sse2.h @@ -24,8 +24,10 @@ void rfx_init_sse2(RFX_CONTEXT* context); -#ifndef RFX_INIT_SIMD -#define RFX_INIT_SIMD(_rfx_context) rfx_init_sse2(_rfx_context) +#ifdef WITH_SSE2 + #ifndef RFX_INIT_SIMD + #define RFX_INIT_SIMD(_rfx_context) rfx_init_sse2(_rfx_context) + #endif #endif #endif /* __RFX_SSE2_H */