More color fixes.

This commit is contained in:
Armin Novak 2016-04-11 14:14:17 +02:00
parent df35c135d1
commit 24599af991
14 changed files with 839 additions and 1022 deletions

View File

@ -1175,15 +1175,18 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
return FALSE;
}
nsc_process_message(xfc->codecs->nsc, cmd->bpp, cmd->width, cmd->height,
cmd->bitmapData, cmd->bitmapDataLength);
if (!nsc_process_message(xfc->codecs->nsc, cmd->bpp, cmd->width, cmd->height,
cmd->bitmapData, cmd->bitmapDataLength,
xfc->bitmap_buffer, xfc->format, 0, 0, 0, cmd->width, cmd->height))
{
xf_unlock_x11(xfc, FALSE);
return FALSE;
}
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
pSrcData = xfc->codecs->nsc->BitmapData;
pDstData = xfc->bitmap_buffer;
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData,
PIXEL_FORMAT_BGRX32_VF, -1, 0, 0, xfc->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,

View File

@ -55,6 +55,8 @@ struct _CLEAR_CONTEXT
UINT32 seqNumber;
BYTE* TempBuffer;
UINT32 TempSize;
UINT32 nTempStep;
UINT32 TempFormat;
UINT32 format;
CLEAR_GLYPH_ENTRY GlyphCache[4000];
UINT32 VBarStorageCursor;

View File

@ -644,7 +644,6 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
case 16:
case 15:
color = ((UINT32)src[1] << 8) | src[0];
color = ((color >> 11) & 0x1F) | (color & 0x7E0) | ((color & 0x1F) << 11);
break;
case 8:
@ -679,7 +678,6 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
case 16:
case 15:
color = ((color >> 11) & 0x1F) | (color & 0x7E0) | ((color & 0x1F) << 11);
dst[1] = color >> 8;
dst[0] = color;
break;

View File

@ -89,7 +89,10 @@ FREERDP_API BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context,
UINT32 pixel_format);
FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
UINT32 width, UINT32 height,
const BYTE* data, UINT32 length);
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight);
FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s,
const BYTE* bmpdata,
UINT32 width, UINT32 height, UINT32 rowstride);

View File

@ -94,6 +94,9 @@ struct _BITMAP_PLANAR_CONTEXT
BYTE* rlePlanes[4];
BYTE* rlePlanesBuffer;
BYTE* pTempData;
UINT32 nTempStep;
};
#ifdef __cplusplus

View File

@ -234,16 +234,19 @@ struct _PROGRESSIVE_CONTEXT
extern "C" {
#endif
FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* progressive, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize);
FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* progressive,
BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize);
FREERDP_API UINT progressive_decompress(PROGRESSIVE_CONTEXT* progressive,
const BYTE* pSrcData, UINT32 SrcSize,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT16 surfaceId);
FREERDP_API INT32 progressive_decompress(PROGRESSIVE_CONTEXT* progressive,
const BYTE* pSrcData, UINT32 SrcSize,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT16 surfaceId);
FREERDP_API int progressive_create_surface_context(PROGRESSIVE_CONTEXT* progressive, UINT16 surfaceId, UINT32 width, UINT32 height);
FREERDP_API int progressive_delete_surface_context(PROGRESSIVE_CONTEXT* progressive, UINT16 surfaceId);
FREERDP_API INT32 progressive_create_surface_context(PROGRESSIVE_CONTEXT*
progressive, UINT16 surfaceId, UINT32 width, UINT32 height);
FREERDP_API int progressive_delete_surface_context(PROGRESSIVE_CONTEXT*
progressive, UINT16 surfaceId);
FREERDP_API BOOL progressive_context_reset(PROGRESSIVE_CONTEXT* progressive);

View File

@ -56,9 +56,9 @@ static BYTE CLEAR_8BIT_MASKS[9] =
};
static void convert_color(BYTE* dst, UINT32 nDstStep, UINT32 DstFormat,
UINT32 nXDst, UINT32 nYDst,
const BYTE* src, UINT32 nSrcStep, UINT32 SrcFormat,
UINT32 nWidth, UINT32 nHeight)
UINT32 nXDst, UINT32 nYDst,
const BYTE* src, UINT32 nSrcStep, UINT32 SrcFormat,
UINT32 nWidth, UINT32 nHeight)
{
UINT32 x, y;
@ -75,38 +75,29 @@ static void convert_color(BYTE* dst, UINT32 nDstStep, UINT32 DstFormat,
&pDstLine[(nXDst + x) * GetBytesPerPixel(DstFormat)];
UINT32 color = ReadColor(pSrcPixel, SrcFormat);
color = ConvertColor(color, SrcFormat,
DstFormat, NULL);
DstFormat, NULL);
WriteColor(pDstPixel, DstFormat, color);
}
}
}
static BOOL clear_decompress_nscodec(NSC_CONTEXT* nsc, UINT32 width,
UINT32 height,
const BYTE* bitmapData, UINT32 bitmapDataByteCount,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDstRel, UINT32 nYDstRel)
UINT32 height,
const BYTE* bitmapData, UINT32 bitmapDataByteCount,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDstRel, UINT32 nYDstRel)
{
UINT32 nSrcStep;
if (nsc_process_message(nsc, 32, width, height, bitmapData,
bitmapDataByteCount) < 0)
return FALSE;
nSrcStep = width * GetBytesPerPixel(nsc->format);
convert_color(pDstData, nDstStep, DstFormat,
nXDstRel, nYDstRel,
nsc->BitmapData, nSrcStep, nsc->format,
width, height);
return TRUE;
return nsc_process_message(nsc, 32, width, height, bitmapData,
bitmapDataByteCount, pDstData, DstFormat,
nDstStep, nXDstRel, nYDstRel, width, height);
}
static BOOL clear_decompress_subcode_rlex(const BYTE* bitmapData,
UINT32 bitmapDataByteCount,
UINT32 width, UINT32 height,
BYTE* tmpBuffer, UINT32 nTmpBufferSize,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDstRel, UINT32 nYDstRel)
UINT32 bitmapDataByteCount,
UINT32 width, UINT32 height,
BYTE* tmpBuffer, UINT32 nTmpBufferSize,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDstRel, UINT32 nYDstRel)
{
UINT32 i;
UINT32 SrcFormat = PIXEL_FORMAT_BGR24;
@ -132,10 +123,10 @@ static BOOL clear_decompress_subcode_rlex(const BYTE* bitmapData,
for (i = 0; i < paletteCount; i++)
{
UINT32 color = GetColor(SrcFormat,
pSrcPixel8[2],
pSrcPixel8[1],
pSrcPixel8[0],
0xFF);
pSrcPixel8[2],
pSrcPixel8[1],
pSrcPixel8[0],
0xFF);
palette[i] = color;
pSrcPixel8 += GetBytesPerPixel(SrcFormat);
}
@ -154,7 +145,7 @@ static BOOL clear_decompress_subcode_rlex(const BYTE* bitmapData,
stopIndex = bitmapData[bitmapDataOffset] & CLEAR_8BIT_MASKS[numBits];
suiteDepth = (bitmapData[bitmapDataOffset] >> numBits) & CLEAR_8BIT_MASKS[(8 -
numBits)];
numBits)];
startIndex = stopIndex - suiteDepth;
bitmapDataOffset++;
runLengthFactor = (UINT32) bitmapData[bitmapDataOffset];
@ -217,18 +208,18 @@ static BOOL clear_decompress_subcode_rlex(const BYTE* bitmapData,
return -1055;
convert_color(pDstData, nDstStep, DstFormat,
nXDstRel, nYDstRel,
tmpBuffer, nSrcStep, SrcFormat,
width, height);
nXDstRel, nYDstRel,
tmpBuffer, nSrcStep, SrcFormat,
width, height);
return TRUE;
}
static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear,
const BYTE* residualData,
UINT32 residualByteCount, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst)
const BYTE* residualData,
UINT32 residualByteCount, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst)
{
UINT32 i;
UINT32 nSrcStep;
@ -264,8 +255,8 @@ static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear,
return -1015;
color = GetColor(clear->format, residualData[suboffset + 2],
residualData[suboffset + 1],
residualData[suboffset + 0], 0xFF);
residualData[suboffset + 1],
residualData[suboffset + 0], 0xFF);
suboffset += 3;
runLengthFactor = residualData[suboffset];
suboffset++;
@ -306,18 +297,18 @@ static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear,
return -1019;
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst,
clear->TempBuffer, nSrcStep, clear->format,
nWidth, nHeight);
nXDst, nYDst,
clear->TempBuffer, nSrcStep, clear->format,
nWidth, nHeight);
return TRUE;
}
static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
const BYTE* bandsData,
UINT32 bandsByteCount, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst)
const BYTE* bandsData,
UINT32 bandsByteCount, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst)
{
UINT32 i, y;
UINT32 count;
@ -359,9 +350,9 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
yEnd = *((UINT16*) &bandsData[suboffset + 6]);
suboffset += 8;
colorBkg = GetColor(clear->format, bandsData[suboffset + 2],
bandsData[suboffset + 1],
bandsData[suboffset + 0],
0xFF);
bandsData[suboffset + 1],
bandsData[suboffset + 0],
0xFF);
suboffset += 3;
if (xEnd < xStart)
@ -437,8 +428,8 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
BYTE* tmp;
vBarShortEntry->size = vBarShortEntry->count;
tmp = (BYTE*) realloc(
vBarShortEntry->pixels,
vBarShortEntry->count * GetBytesPerPixel(clear->format));
vBarShortEntry->pixels,
vBarShortEntry->count * GetBytesPerPixel(clear->format));
if (!tmp)
return -1;
@ -454,10 +445,10 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
BYTE* dstBuffer =
&vBarShortEntry->pixels[y * GetBytesPerPixel(clear->format)];
UINT32 color = GetColor(clear->format,
pSrcPixel8[2],
pSrcPixel8[1],
pSrcPixel8[0],
0xFF);
pSrcPixel8[2],
pSrcPixel8[1],
pSrcPixel8[0],
0xFF);
WriteColor(dstBuffer, clear->format, color);
pSrcPixel8 += 3;
}
@ -499,7 +490,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
BYTE* tmp;
vBarEntry->size = vBarEntry->count;
tmp = (BYTE*) realloc(vBarEntry->pixels,
vBarEntry->count * GetBytesPerPixel(clear->format));
vBarEntry->count * GetBytesPerPixel(clear->format));
if (!tmp)
return -1;
@ -535,13 +526,13 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
count = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;
pSrcPixel = &vBarShortEntry->pixels[(y - vBarYOn) * GetBytesPerPixel(
clear->format)];
clear->format)];
for (x = 0; x < count; x++)
{
UINT32 color;
color = ReadColor(&vBarShortEntry->pixels[x * GetBytesPerPixel(clear->format)],
clear->format);
clear->format);
WriteColor(dstBuffer, clear->format, color);
dstBuffer += GetBytesPerPixel(clear->format);
}
@ -571,10 +562,10 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
for (y = 0; y < count; y++)
{
BYTE* pDstPixel8 = &pDstData[((nYDstRel + y) * nDstStep) +
((nXDstRel + i) * GetBytesPerPixel(DstFormat))];
((nXDstRel + i) * GetBytesPerPixel(DstFormat))];
UINT32 color = ReadColor(pSrcPixel, clear->format);
color = ConvertColor(color, clear->format,
DstFormat, NULL);
DstFormat, NULL);
WriteColor(pDstPixel8, DstFormat, color);
pSrcPixel += GetBytesPerPixel(clear->format);
}
@ -585,9 +576,9 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
}
INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
UINT32 SrcSize,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight)
UINT32 SrcSize,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight)
{
BYTE seqNumber;
BYTE glyphFlags;
@ -658,9 +649,9 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
nSrcStep = nWidth * GetBytesPerPixel(clear->format);
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst,
glyphData, nSrcStep, clear->format,
nWidth, nHeight);
nXDst, nYDst,
glyphData, nSrcStep, clear->format,
nWidth, nHeight);
return 1; /* Finish */
}
}
@ -677,9 +668,9 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
if (residualByteCount > 0)
{
if (!clear_decompress_residual_data(clear,
&pSrcData[offset], residualByteCount,
SrcSize - offset, nWidth, nHeight,
pDstData, DstFormat, nDstStep, nXDst, nYDst))
&pSrcData[offset], residualByteCount,
SrcSize - offset, nWidth, nHeight,
pDstData, DstFormat, nDstStep, nXDst, nYDst))
return -1111;
offset += residualByteCount;
@ -688,9 +679,9 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
if (bandsByteCount > 0)
{
if (!clear_decompress_bands_data(clear,
&pSrcData[offset], bandsByteCount,
SrcSize - offset, nWidth, nHeight,
pDstData, DstFormat, nDstStep, nXDst, nYDst))
&pSrcData[offset], bandsByteCount,
SrcSize - offset, nWidth, nHeight,
pDstData, DstFormat, nDstStep, nXDst, nYDst))
return FALSE;
offset += bandsByteCount;
@ -762,27 +753,27 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
return -1045;
convert_color(pDstData, nDstStep, DstFormat,
nXDstRel, nYDstRel,
bitmapData, nSrcStep,
PIXEL_FORMAT_BGR24,
width, height);
nXDstRel, nYDstRel,
bitmapData, nSrcStep,
PIXEL_FORMAT_BGR24,
width, height);
}
else if (subcodecId == 1) /* NSCodec */
{
if (!clear_decompress_nscodec(clear->nsc, width, height,
bitmapData, bitmapDataByteCount,
pDstData, DstFormat, nDstStep,
nXDstRel, nYDstRel))
bitmapData, bitmapDataByteCount,
pDstData, DstFormat, nDstStep,
nXDstRel, nYDstRel))
return -1046;
}
else if (subcodecId == 2) /* CLEARCODEC_SUBCODEC_RLEX */
{
if (!clear_decompress_subcode_rlex(bitmapData,
bitmapDataByteCount,
width, height,
clear->TempBuffer, clear->TempSize,
pDstData, DstFormat, nDstStep,
nXDstRel, nYDstRel))
bitmapDataByteCount,
width, height,
clear->TempBuffer, clear->TempSize,
pDstData, DstFormat, nDstStep,
nXDstRel, nYDstRel))
return -1047;
}
else
@ -820,9 +811,9 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
glyphData = (BYTE*) glyphEntry->pixels;
nSrcStep = nWidth * GetBytesPerPixel(clear->format);
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst,
glyphData, nSrcStep, clear->format,
nWidth, nHeight);
nXDst, nYDst,
glyphData, nSrcStep, clear->format,
nWidth, nHeight);
}
if (offset != SrcSize)
@ -832,7 +823,7 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
}
int clear_compress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
BYTE** ppDstData, UINT32* pDstSize)
BYTE** ppDstData, UINT32* pDstSize)
{
return 1;
}

View File

@ -1483,7 +1483,6 @@ static BOOL avc_yuv_to_rgb(H264_CONTEXT* h264, const RECTANGLE_16* regionRects,
roi.width = width;
roi.height = height;
// TODO: Color format converstion support!!!
if (use444)
{
if (prims->YUV444ToRGB_8u_P3AC4R(

View File

@ -46,35 +46,25 @@ static void nsc_decode(NSC_CONTEXT* context)
{
UINT16 x;
UINT16 y;
UINT16 rw;
BYTE shift;
BYTE* yplane;
BYTE* coplane;
BYTE* cgplane;
BYTE* aplane;
INT16 y_val;
INT16 co_val;
INT16 cg_val;
INT16 r_val;
INT16 g_val;
INT16 b_val;
BYTE* bmpdata;
bmpdata = context->BitmapData;
rw = ROUND_UP_TO(context->width, 8);
shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */
WLog_Print(context->priv->log, WLOG_DEBUG,
"NscDecode: width: %d height: %d ChromaSubsamplingLevel: %d",
context->width, context->height, context->ChromaSubsamplingLevel);
UINT16 rw = ROUND_UP_TO(context->width, 8);
BYTE shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */;
BYTE* bmpdata = context->BitmapData;
for (y = 0; y < context->height; y++)
{
const BYTE* yplane;
const BYTE* coplane;
const BYTE* cgplane;
const BYTE* aplane = context->priv->PlaneBuffers[3] + y * context->width; /* A */;
if (context->ChromaSubsamplingLevel)
{
yplane = context->priv->PlaneBuffers[0] + y * rw; /* Y */
coplane = context->priv->PlaneBuffers[1] + (y >> 1) * (rw >>
1); /* Co, supersampled */
1); /* Co, supersampled */
cgplane = context->priv->PlaneBuffers[2] + (y >> 1) * (rw >>
1); /* Cg, supersampled */
1); /* Cg, supersampled */
}
else
{
@ -83,16 +73,15 @@ static void nsc_decode(NSC_CONTEXT* context)
cgplane = context->priv->PlaneBuffers[2] + y * context->width; /* Cg */
}
aplane = context->priv->PlaneBuffers[3] + y * context->width; /* A */
for (x = 0; x < context->width; x++)
{
y_val = (INT16) * yplane;
co_val = (INT16)(INT8)(*coplane << shift);
cg_val = (INT16)(INT8)(*cgplane << shift);
r_val = y_val + co_val - cg_val;
g_val = y_val + cg_val;
b_val = y_val - co_val - cg_val;
INT16 y_val = (INT16) * yplane;
INT16 co_val = (INT16)(INT8)(*coplane << shift);
INT16 cg_val = (INT16)(INT8)(*cgplane << shift);
INT16 r_val = y_val + co_val - cg_val;
INT16 g_val = y_val + cg_val;
INT16 b_val = y_val - co_val - cg_val;
*bmpdata++ = MINMAX(b_val, 0, 0xFF);
*bmpdata++ = MINMAX(g_val, 0, 0xFF);
*bmpdata++ = MINMAX(r_val, 0, 0xFF);
@ -187,7 +176,7 @@ static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
Stream_Read_UINT8(s, context->ColorLossLevel); /* ColorLossLevel (1 byte) */
Stream_Read_UINT8(s,
context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
Stream_Seek(s, 2); /* Reserved (2 bytes) */
context->Planes = Stream_Pointer(s);
return TRUE;
@ -306,10 +295,10 @@ NSC_CONTEXT* nsc_context_new(void)
goto error_PlanePool;
PROFILER_CREATE(context->priv->prof_nsc_rle_decompress_data,
"nsc_rle_decompress_data");
"nsc_rle_decompress_data");
PROFILER_CREATE(context->priv->prof_nsc_decode, "nsc_decode");
PROFILER_CREATE(context->priv->prof_nsc_rle_compress_data,
"nsc_rle_compress_data");
"nsc_rle_compress_data");
PROFILER_CREATE(context->priv->prof_nsc_encode, "nsc_encode");
/* Default encoding parameters */
context->ColorLossLevel = 3;
@ -356,8 +345,12 @@ BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context, UINT32 pixel_format)
}
BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
UINT32 width, UINT32 height, const BYTE* data,
UINT32 length)
UINT32 width, UINT32 height,
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight)
{
wStream* s;
BOOL ret;
@ -366,6 +359,9 @@ BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
if (!s)
return FALSE;
if (nDstStride == 0)
nDstStride = nWidth * GetBytesPerPixel(DstFormat);
switch (bpp)
{
case 32:
@ -408,5 +404,11 @@ BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
PROFILER_ENTER(context->priv->prof_nsc_decode);
context->decode(context);
PROFILER_EXIT(context->priv->prof_nsc_decode);
if (!freerdp_image_copy(pDstData, DstFormat, nDstStride, nXDst, nYDst,
width, height, context->BitmapData,
PIXEL_FORMAT_BGRA32, -1, 0, 0, NULL))
return FALSE;
return TRUE;
}

View File

@ -34,7 +34,7 @@
#define TAG FREERDP_TAG("codec")
static int planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
int nWidth, int nHeight)
int nWidth, int nHeight)
{
int x, y;
int cRawBytes;
@ -83,10 +83,10 @@ static int planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
}
static int planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
BYTE* pDstData, INT32 nDstStep,
UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
UINT32 nChannel, BOOL vFlip)
BYTE* pDstData, INT32 nDstStep,
UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
UINT32 nChannel, BOOL vFlip)
{
UINT32 x, y;
BYTE* dstp;
@ -218,9 +218,9 @@ static int planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
}
static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
BOOL alpha, BOOL vFlip)
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
BOOL alpha, BOOL vFlip)
{
INT32 x, y;
INT32 beg, end, inc;
@ -247,7 +247,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
for (y = beg; y != end; y += inc)
{
BYTE* pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * GetBytesPerPixel(
DstFormat))];
DstFormat))];
for (x = 0; x < nWidth; x++)
{
@ -262,7 +262,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
for (y = beg; y != end; y += inc)
{
BYTE* pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * GetBytesPerPixel(
DstFormat))];
DstFormat))];
for (x = 0; x < nWidth; x++)
{
@ -277,10 +277,10 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
}
INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
const BYTE* pSrcData, UINT32 SrcSize,
BYTE** ppDstData, UINT32 DstFormat,
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
const BYTE* pSrcData, UINT32 SrcSize,
BYTE** ppDstData, UINT32 DstFormat,
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
{
BOOL cs;
BOOL rle;
@ -405,28 +405,28 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
{
planes[3] = srcp;
rleSizes[3] = planar_skip_plane_rle(planes[3], SrcSize - (planes[3] - pSrcData),
rawWidths[3], rawHeights[3]); /* AlphaPlane */
rawWidths[3], rawHeights[3]); /* AlphaPlane */
if (rleSizes[3] < 0)
return -1;
planes[0] = planes[3] + rleSizes[3];
rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData),
rawWidths[0], rawHeights[0]); /* RedPlane */
rawWidths[0], rawHeights[0]); /* RedPlane */
if (rleSizes[0] < 0)
return -1;
planes[1] = planes[0] + rleSizes[0];
rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData),
rawWidths[1], rawHeights[1]); /* GreenPlane */
rawWidths[1], rawHeights[1]); /* GreenPlane */
if (rleSizes[1] < 1)
return -1;
planes[2] = planes[1] + rleSizes[1];
rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData),
rawWidths[2], rawHeights[2]); /* BluePlane */
rawWidths[2], rawHeights[2]); /* BluePlane */
if (rleSizes[2] < 1)
return -1;
@ -435,21 +435,21 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
{
planes[0] = srcp;
rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData),
rawWidths[0], rawHeights[0]); /* RedPlane */
rawWidths[0], rawHeights[0]); /* RedPlane */
if (rleSizes[0] < 0)
return -1;
planes[1] = planes[0] + rleSizes[0];
rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData),
rawWidths[1], rawHeights[1]); /* GreenPlane */
rawWidths[1], rawHeights[1]); /* GreenPlane */
if (rleSizes[1] < 1)
return -1;
planes[2] = planes[1] + rleSizes[1];
rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData),
rawWidths[2], rawHeights[2]); /* BluePlane */
rawWidths[2], rawHeights[2]); /* BluePlane */
if (rleSizes[2] < 1)
return -1;
@ -463,13 +463,13 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep,
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
}
else /* NoAlpha */
{
planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep,
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
}
@ -478,63 +478,64 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
}
else /* RLE */
{
UINT32 TempFormat = PIXEL_FORMAT_ARGB32;
UINT32 TempFormat;
BYTE* pTempData = pDstData;
UINT32 nTempStep = nDstStep;
if (alpha)
TempFormat = PIXEL_FORMAT_BGRA32;
else
TempFormat = PIXEL_FORMAT_BGRX32;
if (DstFormat != TempFormat)
{
pTempData = malloc(nWidth * nHeight * 4);
if (!pTempData)
return -1;
pTempData = planar->pTempData;
nTempStep = planar->nTempStep;
}
if (alpha)
{
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
vFlip); /* AlphaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
vFlip); /* AlphaPlane */
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* RedPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* RedPlane */
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* GreenPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* GreenPlane */
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* BluePlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* BluePlane */
srcp += rleSizes[0] + rleSizes[1] + rleSizes[2] + rleSizes[3];
}
else /* NoAlpha */
{
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* RedPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* RedPlane */
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* GreenPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* GreenPlane */
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* BluePlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* BluePlane */
srcp += rleSizes[0] + rleSizes[1] + rleSizes[2];
}
if (pTempData != pDstData)
{
freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, nWidth, nHeight,
pTempData,
TempFormat, nTempStep, nXDst, nYDst, NULL);
free(pTempData);
pTempData,
TempFormat, nTempStep, nXDst, nYDst, NULL);
}
}
}
else /* YCoCg */
{
BYTE* pTempData;
UINT32 nTempStep = nDstStep;
BYTE* pTempData = planar->pTempData;
UINT32 nTempStep = planar->nTempStep;
UINT32 TempFormat = PIXEL_FORMAT_RGBA32;
pTempData = malloc(UncompressedSize);
if (!pTempData)
return -1;
@ -542,7 +543,6 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (cs)
{
WLog_ERR(TAG, "Chroma subsampling unimplemented");
free(pTempData);
return -1;
}
@ -551,13 +551,13 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
}
else /* NoAlpha */
{
planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
nXDst, nYDst, nWidth, nHeight, alpha, vFlip);
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
}
@ -569,37 +569,36 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
vFlip); /* AlphaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
vFlip); /* AlphaPlane */
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* LumaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* LumaPlane */
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* OrangeChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* OrangeChromaPlane */
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* GreenChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* GreenChromaPlane */
srcp += rleSizes[0] + rleSizes[1] + rleSizes[2] + rleSizes[3];
}
else /* NoAlpha */
{
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* LumaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
vFlip); /* LumaPlane */
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* OrangeChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
vFlip); /* OrangeChromaPlane */
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* GreenChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
vFlip); /* GreenChromaPlane */
srcp += rleSizes[0] + rleSizes[1] + rleSizes[2];
}
}
prims->YCoCgToRGB_8u_AC4R(pTempData, nTempStep, pDstData, DstFormat, nDstStep,
nWidth, nHeight, cll, alpha);
free(pTempData);
nWidth, nHeight, cll, alpha);
}
status = (SrcSize == (srcp - pSrcData)) ? 1 : -1;
@ -607,8 +606,8 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
}
static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format,
UINT32 width, UINT32 height,
UINT32 scanline, BYTE** planes)
UINT32 width, UINT32 height,
UINT32 scanline, BYTE** planes)
{
INT32 i, j, k;
UINT32* pixel;
@ -621,7 +620,7 @@ static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format,
for (j = 0; j < width; j++)
{
*pixel = GetColor(format, planes[1][k], planes[2][k],
planes[3][k], planes[0][k]);
planes[3][k], planes[0][k]);
pixel++;
k++;
}
@ -745,9 +744,9 @@ static UINT32 freerdp_bitmap_planar_write_rle_bytes(
}
static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
UINT32 inBufferSize,
BYTE* pOutBuffer,
UINT32 outBufferSize)
UINT32 inBufferSize,
BYTE* pOutBuffer,
UINT32 outBufferSize)
{
BYTE symbol;
const BYTE* pInput;
@ -789,9 +788,9 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
{
pBytes = pInput - (cRawBytes + nRunLength + 1);
nBytesWritten = freerdp_bitmap_planar_write_rle_bytes(
pBytes, cRawBytes,
nRunLength, pOutput,
outBufferSize);
pBytes, cRawBytes,
nRunLength, pOutput,
outBufferSize);
nRunLength = 0;
if (!nBytesWritten || (nBytesWritten > outBufferSize))
@ -813,7 +812,7 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
{
pBytes = pInput - (cRawBytes + nRunLength);
nBytesWritten = freerdp_bitmap_planar_write_rle_bytes(pBytes,
cRawBytes, nRunLength, pOutput, outBufferSize);
cRawBytes, nRunLength, pOutput, outBufferSize);
if (!nBytesWritten)
return 0;
@ -828,8 +827,8 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
}
BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane,
UINT32 width, UINT32 height,
BYTE* outPlane, UINT32* dstSize)
UINT32 width, UINT32 height,
BYTE* outPlane, UINT32* dstSize)
{
UINT32 index;
const BYTE* pInput;
@ -859,7 +858,7 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane,
while (outBufferSize)
{
nBytesWritten = freerdp_bitmap_planar_encode_rle_bytes(
pInput, width, pOutput, outBufferSize);
pInput, width, pOutput, outBufferSize);
if ((!nBytesWritten) || (nBytesWritten > outBufferSize))
return NULL;
@ -894,7 +893,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[0] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(
inPlanes[0], width, height, outPlanes, &dstSizes[0]))
inPlanes[0], width, height, outPlanes, &dstSizes[0]))
return 0;
outPlanes += dstSizes[0];
@ -905,7 +904,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[1] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[1], width, height,
outPlanes, &dstSizes[1]))
outPlanes, &dstSizes[1]))
return 0;
outPlanes += dstSizes[1];
@ -914,7 +913,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[2] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[2], width, height,
outPlanes, &dstSizes[2]))
outPlanes, &dstSizes[2]))
return 0;
outPlanes += dstSizes[2];
@ -923,7 +922,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[3] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[3], width, height,
outPlanes, &dstSizes[3]))
outPlanes, &dstSizes[3]))
return 0;
outPlanes += dstSizes[3];
@ -932,8 +931,8 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
}
BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane,
UINT32 width, UINT32 height,
BYTE* outPlane)
UINT32 width, UINT32 height,
BYTE* outPlane)
{
char s2c;
INT32 delta;
@ -968,15 +967,15 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane,
}
BOOL freerdp_bitmap_planar_delta_encode_planes(const BYTE** inPlanes,
UINT32 width, UINT32 height,
BYTE* outPlanes[4])
UINT32 width, UINT32 height,
BYTE* outPlanes[4])
{
UINT32 i;
for (i = 0; i < 4; i++)
{
outPlanes[i] = freerdp_bitmap_planar_delta_encode_plane(
inPlanes[i], width, height, outPlanes[i]);
inPlanes[i], width, height, outPlanes[i]);
if (!outPlanes[i])
return FALSE;
@ -986,9 +985,9 @@ BOOL freerdp_bitmap_planar_delta_encode_planes(const BYTE** inPlanes,
}
BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
const BYTE* data, UINT32 format,
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* dstData, UINT32* pDstSize)
const BYTE* data, UINT32 format,
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* dstData, UINT32* pDstSize)
{
UINT32 size;
BYTE* dstp;
@ -1002,20 +1001,20 @@ BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
planeSize = width * height;
if (!freerdp_split_color_planes(data, format, width, height, scanline,
context->planes))
context->planes))
return NULL;
if (context->AllowRunLengthEncoding)
{
if (!freerdp_bitmap_planar_delta_encode_planes(
(const BYTE**)context->planes, width, height,
context->deltaPlanes))
(const BYTE**)context->planes, width, height,
context->deltaPlanes))
return NULL;;
if (freerdp_bitmap_planar_compress_planes_rle(
(const BYTE**)context->deltaPlanes, width, height,
context->rlePlanesBuffer, dstSizes,
context->AllowSkipAlpha) > 0)
(const BYTE**)context->deltaPlanes, width, height,
context->rlePlanesBuffer, dstSizes,
context->AllowSkipAlpha) > 0)
{
int offset = 0;
FormatHeader |= PLANAR_FORMAT_HEADER_RLE;
@ -1167,9 +1166,11 @@ BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
context->maxHeight = maxHeight;
context->maxPlaneSize = context->maxWidth * context->maxHeight;
context->planesBuffer = malloc(context->maxPlaneSize * 4);
context->nTempStep = maxWidth * 4;
context->pTempData = malloc(context->maxPlaneSize * 4);
if (!context->planesBuffer)
goto error_planesBuffer;
if (!context->planesBuffer || !context->planesBuffer)
goto error;
context->planes[0] = &context->planesBuffer[context->maxPlaneSize * 0];
context->planes[1] = &context->planesBuffer[context->maxPlaneSize * 1];
@ -1178,27 +1179,26 @@ BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
context->deltaPlanesBuffer = malloc(context->maxPlaneSize * 4);
if (!context->deltaPlanesBuffer)
goto error_deltaPlanesBuffer;
goto error;
context->deltaPlanes[0] = &context->deltaPlanesBuffer[context->maxPlaneSize *
0];
0];
context->deltaPlanes[1] = &context->deltaPlanesBuffer[context->maxPlaneSize *
1];
1];
context->deltaPlanes[2] = &context->deltaPlanesBuffer[context->maxPlaneSize *
2];
2];
context->deltaPlanes[3] = &context->deltaPlanesBuffer[context->maxPlaneSize *
3];
3];
context->rlePlanesBuffer = malloc(context->maxPlaneSize * 4);
if (!context->rlePlanesBuffer)
goto error_rlePlanesBuffer;
goto error;
return context;
error_rlePlanesBuffer:
error:
free(context->pTempData);
free(context->deltaPlanesBuffer);
error_deltaPlanesBuffer:
free(context->planesBuffer);
error_planesBuffer:
free(context);
return NULL;
}
@ -1208,6 +1208,7 @@ void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context)
if (!context)
return;
free(context->pTempData);
free(context->planesBuffer);
free(context->deltaPlanesBuffer);
free(context->rlePlanesBuffer);

File diff suppressed because it is too large Load Diff

View File

@ -149,7 +149,7 @@ static void rfx_profiler_print(RFX_CONTEXT* context)
PROFILER_PRINT_FOOTER;
}
void rfx_tile_init(RFX_TILE* tile)
static void rfx_tile_init(RFX_TILE* tile)
{
if (tile)
{
@ -164,7 +164,7 @@ void rfx_tile_init(RFX_TILE* tile)
}
}
RFX_TILE* rfx_decoder_tile_new()
static RFX_TILE* rfx_decoder_tile_new(void)
{
RFX_TILE* tile = NULL;
@ -181,7 +181,7 @@ RFX_TILE* rfx_decoder_tile_new()
return tile;
}
void rfx_decoder_tile_free(RFX_TILE* tile)
static void rfx_decoder_tile_free(RFX_TILE* tile)
{
if (tile)
{
@ -192,12 +192,12 @@ void rfx_decoder_tile_free(RFX_TILE* tile)
}
}
RFX_TILE* rfx_encoder_tile_new()
static RFX_TILE* rfx_encoder_tile_new()
{
return (RFX_TILE*)calloc(1, sizeof(RFX_TILE));
}
void rfx_encoder_tile_free(RFX_TILE* tile)
static void rfx_encoder_tile_free(RFX_TILE* tile)
{
free(tile);
}
@ -733,8 +733,9 @@ struct _RFX_TILE_PROCESS_WORK_PARAM
};
typedef struct _RFX_TILE_PROCESS_WORK_PARAM RFX_TILE_PROCESS_WORK_PARAM;
void CALLBACK rfx_process_message_tile_work_callback(PTP_CALLBACK_INSTANCE
instance, void* context, PTP_WORK work)
static void CALLBACK rfx_process_message_tile_work_callback(
PTP_CALLBACK_INSTANCE
instance, void* context, PTP_WORK work)
{
RFX_TILE_PROCESS_WORK_PARAM* param = (RFX_TILE_PROCESS_WORK_PARAM*) context;
rfx_decode_rgb(param->context, param->tile, param->tile->data, 64 * 4);

View File

@ -1094,7 +1094,7 @@ static BOOL gdi_surface_bits(rdpContext* context,
cmd->bitmapDataLength,
cmd->destLeft, cmd->destTop,
pDstData, gdi->dstFormat,
gdi->width, gdi->height, NULL))
cmd->width, cmd->height, NULL))
{
WLog_ERR(TAG, "Failed to process RemoteFX message");
return FALSE;
@ -1106,14 +1106,14 @@ static BOOL gdi_surface_bits(rdpContext* context,
gdi->width, gdi->height))
return FALSE;
nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength);
if (!nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength, gdi->bitmap_buffer,
gdi->dstFormat,
0, 0, 0, cmd->width, cmd->height))
return FALSE;
pDstData = gdi->bitmap_buffer;
pSrcData = gdi->codecs->nsc->BitmapData;
freerdp_image_copy(pDstData, gdi->dstFormat, -1, 0, 0,
cmd->width, cmd->height, pSrcData,
PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
gdi->dstFormat, 0,

File diff suppressed because it is too large Load Diff