Author: akhaldi
Date: Sat Apr 26 18:13:05 2014
New Revision: 63001
URL:
http://svn.reactos.org/svn/reactos?rev=63001&view=rev
Log:
[MSRLE32]
* Sync with Wine 1.7.17.
CORE-8080
Modified:
trunk/reactos/dll/win32/msrle32/msrle32.c
trunk/reactos/dll/win32/msrle32/msrle_private.h
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/msrle32/msrle32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msrle32/msrle32.…
==============================================================================
--- trunk/reactos/dll/win32/msrle32/msrle32.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msrle32/msrle32.c [iso-8859-1] Sat Apr 26 18:13:05 2014
@@ -39,7 +39,6 @@
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define SQR(a) ((a) * (a))
-#define QUALITY_to_DIST(q) (ICQUALITY_HIGH - q)
static inline WORD ColorCmp(WORD clr1, WORD clr2)
{
UINT a = clr1 - clr2;
@@ -257,7 +256,7 @@
}
size = (2 + a * (2 + ((a + 2) & ~2)) + b * (2 + ((b + 2) & ~2)));
- return size * lpbi->biHeight;
+ return size * lpbi->biHeight + 2;
}
/* lpP => current pos in previous frame
@@ -457,8 +456,7 @@
static INT MSRLE32_CompressRLE8Line(const CodecInfo *pi, const WORD *lpP,
const WORD *lpC, LPCBITMAPINFOHEADER lpbi,
- const BYTE *lpIn, LONG lDist,
- INT x, LPBYTE *ppOut,
+ const BYTE *lpIn, INT x, LPBYTE *ppOut,
DWORD *lpSizeImage)
{
LPBYTE lpOut = *ppOut;
@@ -472,13 +470,13 @@
pos = x;
clr = lpC[pos++];
for (count = 1; pos < lpbi->biWidth; count++) {
- if (ColorCmp(clr, lpC[pos++]) > lDist)
+ if (ColorCmp(clr, lpC[pos++]) > 0)
break;
}
if (count < 2) {
/* add some more pixels for absoluting if possible */
- count += countDiffRLE8(lpP, lpC - 1, lpC, pos-1, lDist, lpbi->biWidth);
+ count += countDiffRLE8(lpP, lpC - 1, lpC, pos-1, 0, lpbi->biWidth);
assert(count > 0);
@@ -547,7 +545,7 @@
LPBYTE lpOut, BOOL isKey)
{
LPWORD lpC;
- LONG lLine, lInLine, lDist;
+ LONG lLine, lInLine;
LPBYTE lpOutStart = lpOut;
/* pre-conditions */
@@ -556,7 +554,6 @@
assert(pi->pCurFrame != NULL);
lpC = pi->pCurFrame;
- lDist = QUALITY_to_DIST(pi->dwQuality);
lInLine = DIBWIDTHBYTES(*lpbiIn);
lLine = WIDTHBYTES(lpbiOut->biWidth * 16) / 2;
@@ -569,7 +566,7 @@
x = 0;
do {
- x = MSRLE32_CompressRLE4Line(pi, NULL, lpC, lpbiIn, lpIn, lDist, x,
+ x = MSRLE32_CompressRLE4Line(pi, NULL, lpC, lpbiIn, lpIn, 0, x,
&lpOut, &lpbiOut->biSizeImage);
} while (x < lpbiOut->biWidth);
@@ -603,7 +600,7 @@
if (jumpx == -1)
jumpx = x;
for (count = 0, pos = x; pos < lpbiOut->biWidth; pos++, count++) {
- if (ColorCmp(lpP[pos], lpC[pos]) > lDist)
+ if (ColorCmp(lpP[pos], lpC[pos]) > 0)
break;
}
@@ -663,7 +660,7 @@
if (x < lpbiOut->biWidth) {
/* skipped the 'same' things corresponding to previous frame */
- x = MSRLE32_CompressRLE4Line(pi, lpP, lpC, lpbiIn, lpIn, lDist, x,
+ x = MSRLE32_CompressRLE4Line(pi, lpP, lpC, lpbiIn, lpIn, 0, x,
&lpOut, &lpbiOut->biSizeImage);
}
} while (x < lpbiOut->biWidth);
@@ -701,7 +698,7 @@
LPBYTE lpOut, BOOL isKey)
{
LPWORD lpC;
- LONG lDist, lInLine, lLine;
+ LONG lInLine, lLine;
LPBYTE lpOutStart = lpOut;
assert(pi != NULL && lpbiOut != NULL);
@@ -709,7 +706,6 @@
assert(pi->pCurFrame != NULL);
lpC = pi->pCurFrame;
- lDist = QUALITY_to_DIST(pi->dwQuality);
lInLine = DIBWIDTHBYTES(*lpbiIn);
lLine = WIDTHBYTES(lpbiOut->biWidth * 16) / 2;
@@ -722,7 +718,7 @@
x = 0;
do {
- x = MSRLE32_CompressRLE8Line(pi, NULL, lpC, lpbiIn, lpIn, lDist, x,
+ x = MSRLE32_CompressRLE8Line(pi, NULL, lpC, lpbiIn, lpIn, x,
&lpOut, &lpbiOut->biSizeImage);
assert(lpOut == (lpOutStart + lpbiOut->biSizeImage));
} while (x < lpbiOut->biWidth);
@@ -757,7 +753,7 @@
if (jumpx == -1)
jumpx = x;
for (count = 0, pos = x; pos < lpbiOut->biWidth; pos++, count++) {
- if (ColorCmp(lpP[pos], lpC[pos]) > lDist)
+ if (ColorCmp(lpP[pos], lpC[pos]) > 0)
break;
}
@@ -804,7 +800,7 @@
if (x < lpbiOut->biWidth) {
/* skip the 'same' things corresponding to previous frame */
- x = MSRLE32_CompressRLE8Line(pi, lpP, lpC, lpbiIn, lpIn, lDist, x,
+ x = MSRLE32_CompressRLE8Line(pi, lpP, lpC, lpbiIn, lpIn, x,
&lpOut, &lpbiOut->biSizeImage);
assert(lpOut == (lpOutStart + lpbiOut->biSizeImage));
}
@@ -823,14 +819,16 @@
}
}
- /* add EOL -- will be changed to EOI */
+ /* add EOL */
lpbiOut->biSizeImage += 2;
*((LPWORD)lpOut) = 0;
lpOut += sizeof(WORD);
}
- /* change EOL to EOI -- end of image */
- lpOut[-1] = 1;
+ /* add EOI -- end of image */
+ lpbiOut->biSizeImage += 2;
+ *lpOut++ = 0;
+ *lpOut++ = 1;
assert(lpOut == (lpOutStart + lpbiOut->biSizeImage));
return ICERR_OK;
@@ -1144,7 +1142,6 @@
pi->fccHandler = icinfo->fccHandler;
pi->bCompress = FALSE;
- pi->dwQuality = MSRLE32_DEFAULTQUALITY;
pi->nPrevFrame = -1;
pi->pPrevFrame = pi->pCurFrame = NULL;
@@ -1193,21 +1190,6 @@
LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription,
sizeof(icinfo->szDescription)/sizeof(WCHAR));
return sizeof(ICINFO);
-}
-
-static LRESULT SetQuality(CodecInfo *pi, LONG lQuality)
-{
- /* pre-condition */
- assert(pi != NULL);
-
- if (lQuality == -1)
- lQuality = MSRLE32_DEFAULTQUALITY;
- else if (ICQUALITY_LOW > lQuality || lQuality > ICQUALITY_HIGH)
- return ICERR_BADPARAM;
-
- pi->dwQuality = (DWORD)lQuality;
-
- return ICERR_OK;
}
static LRESULT Configure(const CodecInfo *pi, HWND hWnd)
@@ -1438,6 +1420,7 @@
static LRESULT Compress(CodecInfo *pi, ICCOMPRESS* lpic, DWORD dwSize)
{
+ BOOL is_key;
int i;
TRACE("(%p,%p,%u)\n",pi,lpic,dwSize);
@@ -1486,24 +1469,22 @@
computeInternalFrame(pi, lpic->lpbiPrev, lpic->lpPrev);
/* swap buffers for current and previous frame */
- /* Don't free and alloc new -- costs to much time and they are of equal size !
*/
+ /* Don't free and alloc new -- costs too much time and they are of equal size !
*/
pTmp = pi->pPrevFrame;
pi->pPrevFrame = pi->pCurFrame;
pi->pCurFrame = pTmp;
pi->nPrevFrame = lpic->lFrameNum;
}
+ is_key = (lpic->dwFlags & ICCOMPRESS_KEYFRAME) != 0;
+
for (i = 0; i < 3; i++) {
- SetQuality(pi, lpic->dwQuality);
-
lpic->lpbiOutput->biSizeImage = 0;
if (lpic->lpbiOutput->biBitCount == 4)
- MSRLE32_CompressRLE4(pi, lpic->lpbiInput, lpic->lpInput,
- lpic->lpbiOutput, lpic->lpOutput, (lpic->dwFlags &
ICCOMPRESS_KEYFRAME) != 0);
+ MSRLE32_CompressRLE4(pi, lpic->lpbiInput, lpic->lpInput, lpic->lpbiOutput,
lpic->lpOutput, is_key);
else
- MSRLE32_CompressRLE8(pi, lpic->lpbiInput, lpic->lpInput,
- lpic->lpbiOutput, lpic->lpOutput, (lpic->dwFlags &
ICCOMPRESS_KEYFRAME) != 0);
+ MSRLE32_CompressRLE8(pi, lpic->lpbiInput, lpic->lpInput, lpic->lpbiOutput,
lpic->lpOutput, is_key);
if (lpic->dwFrameSize == 0 ||
lpic->lpbiOutput->biSizeImage < lpic->dwFrameSize)
@@ -1520,7 +1501,7 @@
if (lpic->dwFrameSize == 0 ||
lpic->lpbiOutput->biSizeImage < lpic->dwFrameSize) {
WARN("switched to keyframe, was small enough!\n");
- *lpic->lpdwFlags |= ICCOMPRESS_KEYFRAME;
+ is_key = TRUE;
*lpic->lpckid = MAKEAVICKID(cktypeDIBbits,
StreamFromFOURCC(*lpic->lpckid));
break;
@@ -1534,7 +1515,7 @@
}
{ /* swap buffer for current and previous frame */
- /* Don't free and alloc new -- costs to much time and they are of equal size !
*/
+ /* Don't free and alloc new -- costs too much time and they are of equal size !
*/
LPWORD pTmp = pi->pPrevFrame;
pi->pPrevFrame = pi->pCurFrame;
@@ -1542,6 +1523,8 @@
pi->nPrevFrame = lpic->lFrameNum;
}
+ /* FIXME: What is AVIIF_TWOCC? */
+ *lpic->lpdwFlags |= AVIIF_TWOCC | (is_key ? AVIIF_KEYFRAME : 0);
return ICERR_OK;
}
@@ -1850,14 +1833,6 @@
return ICERR_OK;
}
break;
- case ICM_GETQUALITY:
- if ((LPVOID)lParam1 != NULL) {
- *((LPDWORD)lParam1) = pi->dwQuality;
- return ICERR_OK;
- }
- break;
- case ICM_SETQUALITY:
- return SetQuality(pi, *(LPLONG)lParam1);
case ICM_COMPRESS_GET_FORMAT:
return CompressGetFormat(pi, (LPCBITMAPINFOHEADER)lParam1,
(LPBITMAPINFOHEADER)lParam2);
Modified: trunk/reactos/dll/win32/msrle32/msrle_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msrle32/msrle_pr…
==============================================================================
--- trunk/reactos/dll/win32/msrle32/msrle_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msrle32/msrle_private.h [iso-8859-1] Sat Apr 26 18:13:05 2014
@@ -38,7 +38,7 @@
#define IDS_DESCRIPTION 101
#define IDS_ABOUT 102
-#define MSRLE32_DEFAULTQUALITY (75 * ICQUALITY_HIGH) / 100
+#define MSRLE32_DEFAULTQUALITY (85 * ICQUALITY_HIGH) / 100
#define FOURCC_RLE mmioFOURCC('R','L','E',' ')
#define FOURCC_RLE4 mmioFOURCC('R','L','E','4')
@@ -50,7 +50,6 @@
typedef struct _CodecInfo {
FOURCC fccHandler;
- DWORD dwQuality;
BOOL bCompress;
LONG nPrevFrame;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Apr 26 18:13:05 2014
@@ -125,7 +125,7 @@
reactos/dll/win32/msisip # Synced to Wine-1.7.1
reactos/dll/win32/msisys.ocx # Synced to Wine-1.7.1
reactos/dll/win32/msnet32 # Synced to Wine-1.7.1
-reactos/dll/win32/msrle32 # Synced to Wine-1.7.1
+reactos/dll/win32/msrle32 # Synced to Wine-1.7.17
reactos/dll/win32/mssign32 # Synced to Wine-1.7.1
reactos/dll/win32/mssip32 # Synced to Wine-1.7.1
reactos/dll/win32/mstask # Synced to Wine-1.7.1