msrle32: Add support to decompress uncompressed frames.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2015-11-05 21:01:39 +08:00 committed by Alexandre Julliard
parent fa506e45bf
commit 30136b322e
3 changed files with 53 additions and 44 deletions

View File

@ -1596,7 +1596,7 @@ static LRESULT DecompressQuery(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
/* check input format if given */
if (lpbiIn != NULL) {
if (!isSupportedMRLE(lpbiIn))
if (!isSupportedMRLE(lpbiIn) && !isSupportedDIB(lpbiIn))
return ICERR_BADFORMAT;
}
@ -1645,6 +1645,8 @@ static LRESULT DecompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
if (pi->bDecompress)
DecompressEnd(pi);
if (lpbiIn->biCompression != BI_RGB)
{
rgbIn = (const RGBQUAD*)((const BYTE*)lpbiIn + lpbiIn->biSize);
rgbOut = (const RGBQUAD*)((const BYTE*)lpbiOut + lpbiOut->biSize);
@ -1687,7 +1689,7 @@ static LRESULT DecompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
memcpy(pi->palette_map, rgbIn, lpbiIn->biClrUsed * sizeof(RGBQUAD));
break;
};
}
pi->bDecompress = TRUE;
return ICERR_OK;
@ -1718,6 +1720,14 @@ static LRESULT Decompress(CodecInfo *pi, ICDECOMPRESS *pic, DWORD dwSize)
assert(pic->lpbiInput->biWidth == pic->lpbiOutput->biWidth);
assert(pic->lpbiInput->biHeight == pic->lpbiOutput->biHeight);
/* Uncompressed frame? */
if (pic->lpbiInput->biCompression == BI_RGB)
{
pic->lpbiOutput->biSizeImage = pic->lpbiInput->biSizeImage;
memcpy(pic->lpOutput, pic->lpInput, pic->lpbiOutput->biSizeImage);
return ICERR_OK;
}
pic->lpbiOutput->biSizeImage = DIBWIDTHBYTES(*pic->lpbiOutput) * pic->lpbiOutput->biHeight;
if (pic->lpbiInput->biBitCount == 4)
return MSRLE32_DecompressRLE4(pi, pic->lpbiOutput, pic->lpInput, pic->lpOutput);

View File

@ -132,7 +132,7 @@ static void test_raw_decompress(void)
for (i = 0; i < sizeof(codecs) / sizeof(codecs[0]); i++)
{
memset(bits, i + 0xAF, bih->biSizeImage);
todo_wine {
/* Check which codec is able to decompress uncompressed data */
hic = ICLocate(FCC('V', 'I', 'D', 'C'), codecs[i], bih, NULL, ICMODE_DECOMPRESS);
ok(hic != NULL, "Test[%d]: Expected non-NULL return\n", i);
@ -154,7 +154,6 @@ todo_wine {
hr = ICClose(hic);
ok(hr == ICERR_OK, "Test[%d]: Expected ICERR_OK, got %d\n", i, hr);
}
}
HeapFree(GetProcessHeap(), 0, bits);
HeapFree(GetProcessHeap(), 0, outbits);

View File

@ -212,7 +212,7 @@ static void test_Locate(void)
bi.biCompression = BI_RGB;
bo.biBitCount = bi.biBitCount = 8;
h = ICLocate(ICTYPE_VIDEO, 0, &bi, &bo, ICMODE_DECOMPRESS);
todo_wine ok(h != 0, "RGB8->RGB identity failed\n");
ok(h != 0, "RGB8->RGB identity failed\n");
if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n");
bi.biCompression = BI_RLE8;