[codec,nsc] add INLINE and restrict keywords

This commit is contained in:
akallabeth 2024-05-30 00:48:48 +02:00
parent b672539365
commit fd592b9cf1
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
6 changed files with 47 additions and 35 deletions

View File

@ -280,7 +280,8 @@ typedef struct gdi_palette gdiPalette;
* @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);
FREERDP_API BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height,
const BYTE* WINPR_RESTRICT data);
/***
*

View File

@ -50,21 +50,25 @@ extern "C"
UINT32 pixel_format));
#endif
FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* context, NSC_PARAMETER what,
UINT32 value);
FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* WINPR_RESTRICT 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,
FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* WINPR_RESTRICT 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* WINPR_RESTRICT context,
wStream* WINPR_RESTRICT s,
const BYTE* WINPR_RESTRICT bmpdata, UINT32 width,
UINT32 height, UINT32 rowstride);
FREERDP_API BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context,
wStream* WINPR_RESTRICT s, BYTE* WINPR_RESTRICT 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 BOOL nsc_context_reset(NSC_CONTEXT* WINPR_RESTRICT context, UINT32 width,
UINT32 height);
FREERDP_API void nsc_context_free(NSC_CONTEXT* context);

View File

@ -51,7 +51,7 @@ static INLINE DWORD FreeRDPAreColorFormatsEqualNoAlpha_int(DWORD first, DWORD se
return (first & mask) == (second & mask);
}
BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data)
BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* WINPR_RESTRICT data)
{
/*
* converts a 1-bit-per-pixel glyph to a one-byte-per-pixel glyph:

View File

@ -46,7 +46,7 @@
} while (0)
#endif
static BOOL nsc_decode(NSC_CONTEXT* context)
static BOOL nsc_decode(NSC_CONTEXT* WINPR_RESTRICT context)
{
UINT16 rw = 0;
BYTE shift = 0;
@ -188,7 +188,7 @@ static BOOL nsc_rle_decode(const BYTE* WINPR_RESTRICT in, size_t inSize, BYTE* W
return TRUE;
}
static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context)
static BOOL nsc_rle_decompress_data(NSC_CONTEXT* WINPR_RESTRICT context)
{
if (!context)
return FALSE;
@ -236,7 +236,7 @@ static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context)
return TRUE;
}
static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
static BOOL nsc_stream_initialize(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s)
{
WINPR_ASSERT(context);
WINPR_ASSERT(context->priv);
@ -265,7 +265,7 @@ static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
return Stream_CheckAndLogRequiredLengthWLog(context->priv->log, s, total);
}
static BOOL nsc_context_initialize(NSC_CONTEXT* context, wStream* s)
static BOOL nsc_context_initialize(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s)
{
if (!nsc_stream_initialize(context, s))
return FALSE;
@ -317,7 +317,7 @@ static BOOL nsc_context_initialize(NSC_CONTEXT* context, wStream* s)
return TRUE;
}
static void nsc_profiler_print(NSC_CONTEXT_PRIV* priv)
static void nsc_profiler_print(NSC_CONTEXT_PRIV* WINPR_RESTRICT priv)
{
WINPR_UNUSED(priv);
@ -329,7 +329,7 @@ static void nsc_profiler_print(NSC_CONTEXT_PRIV* priv)
PROFILER_PRINT_FOOTER
}
BOOL nsc_context_reset(NSC_CONTEXT* context, UINT32 width, UINT32 height)
BOOL nsc_context_reset(NSC_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height)
{
if (!context)
return FALSE;

View File

@ -54,9 +54,10 @@ typedef struct
UINT8 ChromaSubsamplingLevel;
} NSC_MESSAGE;
static BOOL nsc_write_message(NSC_CONTEXT* context, wStream* s, const NSC_MESSAGE* message);
static BOOL nsc_write_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
const NSC_MESSAGE* WINPR_RESTRICT message);
static BOOL nsc_context_initialize_encode(NSC_CONTEXT* context)
static BOOL nsc_context_initialize_encode(NSC_CONTEXT* WINPR_RESTRICT context)
{
UINT32 length = 0;
UINT32 tempWidth = 0;
@ -109,7 +110,8 @@ fail:
return FALSE;
}
static BOOL nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data, UINT32 scanline)
static BOOL nsc_encode_argb_to_aycocg(NSC_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT data, UINT32 scanline)
{
UINT16 y = 0;
UINT16 rw = 0;
@ -268,7 +270,7 @@ static BOOL nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data, UI
return TRUE;
}
static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
static BOOL nsc_encode_subsampling(NSC_CONTEXT* WINPR_RESTRICT context)
{
UINT32 tempWidth = 0;
UINT32 tempHeight = 0;
@ -312,7 +314,8 @@ static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
return TRUE;
}
BOOL nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)
BOOL nsc_encode(NSC_CONTEXT* WINPR_RESTRICT context, const BYTE* WINPR_RESTRICT bmpdata,
UINT32 rowstride)
{
if (!context || !bmpdata || (rowstride == 0))
return FALSE;
@ -329,7 +332,8 @@ BOOL nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)
return TRUE;
}
static UINT32 nsc_rle_encode(const BYTE* in, BYTE* out, UINT32 originalSize)
static UINT32 nsc_rle_encode(const BYTE* WINPR_RESTRICT in, BYTE* WINPR_RESTRICT out,
UINT32 originalSize)
{
UINT32 left = 0;
UINT32 runlength = 1;
@ -383,7 +387,7 @@ static UINT32 nsc_rle_encode(const BYTE* in, BYTE* out, UINT32 originalSize)
return planeSize;
}
static void nsc_rle_compress_data(NSC_CONTEXT* context)
static void nsc_rle_compress_data(NSC_CONTEXT* WINPR_RESTRICT context)
{
UINT32 planeSize = 0;
UINT32 originalSize = 0;
@ -412,8 +416,8 @@ static void nsc_rle_compress_data(NSC_CONTEXT* context)
}
}
static UINT32 nsc_compute_byte_count(NSC_CONTEXT* context, UINT32* ByteCount, UINT32 width,
UINT32 height)
static UINT32 nsc_compute_byte_count(NSC_CONTEXT* WINPR_RESTRICT context,
UINT32* WINPR_RESTRICT ByteCount, UINT32 width, UINT32 height)
{
UINT32 tempWidth = 0;
UINT32 tempHeight = 0;
@ -440,7 +444,8 @@ static UINT32 nsc_compute_byte_count(NSC_CONTEXT* context, UINT32* ByteCount, UI
return maxPlaneSize;
}
BOOL nsc_write_message(NSC_CONTEXT* context, wStream* s, const NSC_MESSAGE* message)
BOOL nsc_write_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
const NSC_MESSAGE* WINPR_RESTRICT message)
{
UINT32 totalPlaneByteCount = 0;
totalPlaneByteCount = message->LumaPlaneByteCount + message->OrangeChromaPlaneByteCount +
@ -476,8 +481,9 @@ BOOL nsc_write_message(NSC_CONTEXT* context, wStream* s, const NSC_MESSAGE* mess
return TRUE;
}
BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s, const BYTE* WINPR_RESTRICT data,
UINT32 width, UINT32 height, UINT32 scanline)
BOOL nsc_compose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
const BYTE* WINPR_RESTRICT data, UINT32 width, UINT32 height,
UINT32 scanline)
{
BOOL rc = 0;
NSC_MESSAGE message = { 0 };
@ -515,9 +521,9 @@ BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s, const BYTE* WINPR_RES
return nsc_write_message(context, s, &message);
}
BOOL nsc_decompose_message(NSC_CONTEXT* context, wStream* s, BYTE* WINPR_RESTRICT bmpdata, UINT32 x,
UINT32 y, UINT32 width, UINT32 height, UINT32 rowstride, UINT32 format,
UINT32 flip)
BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
BYTE* WINPR_RESTRICT bmpdata, UINT32 x, UINT32 y, UINT32 width,
UINT32 height, UINT32 rowstride, UINT32 format, UINT32 flip)
{
size_t size = Stream_GetRemainingLength(s);

View File

@ -24,6 +24,7 @@
#include <freerdp/api.h>
FREERDP_LOCAL BOOL nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride);
FREERDP_LOCAL BOOL nsc_encode(NSC_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT bmpdata, UINT32 rowstride);
#endif /* FREERDP_LIB_CODEC_NSC_ENCODE_H */