diff --git a/src/libs/zmbv/zmbv_vfw.cpp b/src/libs/zmbv/zmbv_vfw.cpp index 9b4c284d..1964546b 100644 --- a/src/libs/zmbv/zmbv_vfw.cpp +++ b/src/libs/zmbv/zmbv_vfw.cpp @@ -300,7 +300,29 @@ DWORD CodecInst::Compress(ICCOMPRESS* icinfo, DWORD dwSize) { if (icinfo->dwFlags & ICCOMPRESS_KEYFRAME) flags |= 1; - codec->PrepareCompressFrame( flags, format, 0, icinfo->lpOutput, 99999999); + char palette[256 * 4]; + char *pal = NULL; + + if (lpbiIn->biBitCount == 8) { + const int entries = icinfo->lpbiInput->biClrUsed ? icinfo->lpbiInput->biClrUsed : 256; + const char* srcpal = (char *)icinfo->lpbiInput + icinfo->lpbiInput->biSize; + char* dstpal = palette; + + memset(palette, 0, sizeof palette); + + for(int i=0; iPrepareCompressFrame( flags, format, pal, icinfo->lpOutput, 99999999); char *readPt = (char *)icinfo->lpInput + pitch*(lpbiIn->biHeight - 1); for(i = 0;ibiHeight;i++) { codec->CompressLines(1, (void **)&readPt );