mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[deprecate] rename planar_decompress
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <winpr/cast.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/config.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/codec/bitmap.h>
|
||||
|
||||
@@ -38,20 +39,6 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
static inline BYTE PLANAR_CONTROL_BYTE(UINT32 nRunLength, UINT32 cRawBytes)
|
||||
{
|
||||
return WINPR_ASSERTING_INT_CAST(UINT8, ((nRunLength & 0x0F) | ((cRawBytes & 0x0F) << 4)));
|
||||
}
|
||||
|
||||
static inline BYTE PLANAR_CONTROL_BYTE_RUN_LENGTH(UINT32 controlByte)
|
||||
{
|
||||
return (controlByte & 0x0F);
|
||||
}
|
||||
static inline BYTE PLANAR_CONTROL_BYTE_RAW_BYTES(UINT32 controlByte)
|
||||
{
|
||||
return ((controlByte >> 4) & 0x0F);
|
||||
}
|
||||
|
||||
typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
|
||||
|
||||
FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context,
|
||||
@@ -74,12 +61,21 @@ extern "C"
|
||||
FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
BOOL topdown);
|
||||
|
||||
FREERDP_API BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip);
|
||||
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
|
||||
WINPR_DEPRECATED_VAR("use freerdp_bitmap_decompress_planar instead",
|
||||
FREERDP_API BOOL planar_decompress(
|
||||
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize, UINT32 nSrcWidth,
|
||||
UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip));
|
||||
#endif
|
||||
|
||||
FREERDP_API BOOL freerdp_bitmap_decompress_planar(
|
||||
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar, const BYTE* WINPR_RESTRICT pSrcData,
|
||||
UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -96,6 +96,20 @@ struct S_BITMAP_PLANAR_CONTEXT
|
||||
BOOL topdown;
|
||||
};
|
||||
|
||||
static inline BYTE PLANAR_CONTROL_BYTE(UINT32 nRunLength, UINT32 cRawBytes)
|
||||
{
|
||||
return WINPR_ASSERTING_INT_CAST(UINT8, ((nRunLength & 0x0F) | ((cRawBytes & 0x0F) << 4)));
|
||||
}
|
||||
|
||||
static inline BYTE PLANAR_CONTROL_BYTE_RUN_LENGTH(UINT32 controlByte)
|
||||
{
|
||||
return (controlByte & 0x0F);
|
||||
}
|
||||
static inline BYTE PLANAR_CONTROL_BYTE_RAW_BYTES(UINT32 controlByte)
|
||||
{
|
||||
return ((controlByte >> 4) & 0x0F);
|
||||
}
|
||||
|
||||
static INLINE UINT32 planar_invert_format(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar, BOOL alpha,
|
||||
UINT32 DstFormat)
|
||||
{
|
||||
@@ -687,11 +701,25 @@ static BOOL planar_subsample_expand(const BYTE* WINPR_RESTRICT plane, size_t pla
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
|
||||
BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize, UINT32 nSrcWidth,
|
||||
UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip)
|
||||
{
|
||||
return freerdp_bitmap_decompress_planar(planar, pSrcData, SrcSize, nSrcWidth, nSrcHeight,
|
||||
pDstData, DstFormat, nDstStep, nXDst, nYDst, nDstWidth,
|
||||
nDstHeight, vFlip);
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL freerdp_bitmap_decompress_planar(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip)
|
||||
{
|
||||
BOOL useAlpha = FALSE;
|
||||
INT32 status = 0;
|
||||
|
||||
@@ -241,8 +241,9 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* encplanar, BITMAP_PLANAR_CONTEX
|
||||
if (!compressedBitmap || !decompressedBitmap)
|
||||
goto fail;
|
||||
|
||||
if (!planar_decompress(decplanar, compressedBitmap, dstSize, width, height, decompressedBitmap,
|
||||
dstFormat, 0, 0, 0, width, height, FALSE))
|
||||
if (!freerdp_bitmap_decompress_planar(decplanar, compressedBitmap, dstSize, width, height,
|
||||
decompressedBitmap, dstFormat, 0, 0, 0, width, height,
|
||||
FALSE))
|
||||
{
|
||||
(void)printf("failed to decompress experimental bitmap 01: width: %" PRIu32
|
||||
" height: %" PRIu32 "\n",
|
||||
@@ -321,8 +322,9 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
|
||||
if (!compressedBitmap)
|
||||
goto fail_loop;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, compressedSize, width, height,
|
||||
decompressedBitmap, dstFormat, 0, 0, 0, width, height, FALSE))
|
||||
if (!freerdp_bitmap_decompress_planar(planar, compressedBitmap, compressedSize, width,
|
||||
height, decompressedBitmap, dstFormat, 0, 0, 0,
|
||||
width, height, FALSE))
|
||||
goto fail_loop;
|
||||
|
||||
if (!CompareBitmap(decompressedBitmap, dstFormat, bmp, srcFormat, width, height))
|
||||
@@ -494,9 +496,9 @@ static BOOL FuzzPlanar(void)
|
||||
FreeRDPGetColorFormatName(DstFormat), nXDst, nYDst, nDstWidth, nDstHeight, nDstStep,
|
||||
sizeof(dstData));
|
||||
freerdp_planar_switch_bgr(planar, ((prand(2) % 2) != 0) ? TRUE : FALSE);
|
||||
planar_decompress(planar, data, dataSize, prand(4096), prand(4096), dstData, DstFormat,
|
||||
nDstStep, nXDst, nYDst, nDstWidth, nDstHeight,
|
||||
((prand(2) % 2) != 0) ? TRUE : FALSE);
|
||||
freerdp_bitmap_decompress_planar(planar, data, dataSize, prand(4096), prand(4096), dstData,
|
||||
DstFormat, nDstStep, nXDst, nYDst, nDstWidth, nDstHeight,
|
||||
((prand(2) % 2) != 0) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
|
||||
@@ -1324,9 +1324,9 @@ static int test_dump(int argc, char* argv[])
|
||||
{
|
||||
const UINT64 start = winpr_GetTickCount64NS();
|
||||
|
||||
if (!planar_decompress(codecs->planar, cmd.data, cmd.length, cmd.width,
|
||||
cmd.height, dst, DstFormat, stride, cmd.left, cmd.top,
|
||||
cmd.width, cmd.height, FALSE))
|
||||
if (!freerdp_bitmap_decompress_planar(
|
||||
codecs->planar, cmd.data, cmd.length, cmd.width, cmd.height, dst,
|
||||
DstFormat, stride, cmd.left, cmd.top, cmd.width, cmd.height, FALSE))
|
||||
success = -1;
|
||||
|
||||
const RECTANGLE_16 invalidRect = { .left = (UINT16)MIN(UINT16_MAX, cmd.left),
|
||||
|
||||
@@ -540,9 +540,10 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
if (!is_within_surface(surface, cmd))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
if (!planar_decompress(surface->codecs->planar, cmd->data, cmd->length, cmd->width, cmd->height,
|
||||
DstData, surface->format, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, FALSE))
|
||||
if (!freerdp_bitmap_decompress_planar(surface->codecs->planar, cmd->data, cmd->length,
|
||||
cmd->width, cmd->height, DstData, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top, cmd->width,
|
||||
cmd->height, FALSE))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
invalidRect.left = (UINT16)MIN(UINT16_MAX, cmd->left);
|
||||
|
||||
@@ -206,11 +206,11 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, const
|
||||
const BOOL fidelity =
|
||||
freerdp_settings_get_bool(context->settings, FreeRDP_DrawAllowDynamicColorFidelity);
|
||||
freerdp_planar_switch_bgr(context->codecs->planar, fidelity);
|
||||
if (!planar_decompress(context->codecs->planar, pSrcData, SrcSize, DstWidth, DstHeight,
|
||||
bitmap->data, bitmap->format, 0, 0, 0, DstWidth, DstHeight,
|
||||
TRUE))
|
||||
if (!freerdp_bitmap_decompress_planar(context->codecs->planar, pSrcData, SrcSize,
|
||||
DstWidth, DstHeight, bitmap->data, bitmap->format,
|
||||
0, 0, 0, DstWidth, DstHeight, TRUE))
|
||||
{
|
||||
WLog_ERR(TAG, "planar_decompress failed");
|
||||
WLog_ERR(TAG, "freerdp_bitmap_decompress_planar failed");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user