1
0
Fork 0

Rewrite video capturing and fix some endian issues with all captures as well. Thanks jmarsh

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4314
This commit is contained in:
Peter Veenstra 2020-02-06 10:36:10 +00:00
parent 95a689013e
commit 987a48600d
6 changed files with 662 additions and 370 deletions

File diff suppressed because it is too large Load diff

View file

@ -153,7 +153,8 @@ INLINE int VideoCodec::PossibleBlock(int vx,int vy,FrameBlock * block) {
P * pnew=((P*)newframe)+block->start;;
for (int y=0;y<block->dy;y+=4) {
for (int x=0;x<block->dx;x+=4) {
int test=0-((pold[x]-pnew[x])&0x00ffffff);
int test=pold[x]-pnew[x];
test |= -test;
ret-=(test>>31);
}
pold+=pitch*4;
@ -169,7 +170,8 @@ INLINE int VideoCodec::CompareBlock(int vx,int vy,FrameBlock * block) {
P * pnew=((P*)newframe)+block->start;;
for (int y=0;y<block->dy;y++) {
for (int x=0;x<block->dx;x++) {
int test=0-((pold[x]-pnew[x])&0x00ffffff);
int test=pold[x]-pnew[x];
test |= -test;
ret-=(test>>31);
}
pold+=pitch;
@ -314,7 +316,7 @@ bool VideoCodec::PrepareCompressFrame(int flags, zmbv_format_t _format, char *
return true;
}
void VideoCodec::CompressLines(int lineCount, void *lineData[]) {
void VideoCodec::CompressLines(int lineCount, const void *lineData[]) {
int linePitch = pitch * pixelsize;
int lineWidth = width * pixelsize;
int i = 0;
@ -348,7 +350,7 @@ int VideoCodec::FinishCompressFrame( void ) {
AddXorFrame<short>();
break;
case ZMBV_FORMAT_32BPP:
AddXorFrame<long>();
AddXorFrame<int>();
break;
}
}
@ -469,7 +471,7 @@ bool VideoCodec::DecompressFrame(void * framedata, int size) {
UnXorFrame<short>();
break;
case ZMBV_FORMAT_32BPP:
UnXorFrame<long>();
UnXorFrame<int>();
break;
}
}
@ -524,18 +526,10 @@ void VideoCodec::Output_UpsideDown_24(void *output) {
}
void VideoCodec::FreeBuffers(void) {
if (blocks) {
delete[] blocks;blocks=0;
}
if (buf1) {
delete[] buf1;buf1=0;
}
if (buf2) {
delete[] buf2;buf2=0;
}
if (work) {
delete[] work;work=0;
}
delete[] blocks;blocks=NULL;
delete[] buf1;buf1=NULL;
delete[] buf2;buf2=NULL;
delete[] work;work=NULL;
}
@ -547,3 +541,7 @@ VideoCodec::VideoCodec() {
work = 0;
memset( &zstream, 0, sizeof(zstream));
}
VideoCodec::~VideoCodec() {
FreeBuffers();
}

View file

@ -105,12 +105,13 @@ private:
INLINE void CopyBlock(int vx, int vy,FrameBlock * block);
public:
VideoCodec();
~VideoCodec();
bool SetupCompress( int _width, int _height);
bool SetupDecompress( int _width, int _height);
zmbv_format_t BPPFormat( int bpp );
int NeededSize( int _width, int _height, zmbv_format_t _format);
void CompressLines(int lineCount, void *lineData[]);
void CompressLines(int lineCount, const void *lineData[]);
bool PrepareCompressFrame(int flags, zmbv_format_t _format, char * pal, void *writeBuf, int writeSize);
int FinishCompressFrame( void );
bool DecompressFrame(void * framedata, int size);

View file

@ -8,6 +8,8 @@
/* Define to 1 to enable screenshots, requires libpng */
#define C_SSHOT 1
/* Define to 1 to enable movie recording, requires zlib built without Z_SOLO */
#define C_SRECORD 1
/* Define to 1 to use opengl display output support */
#define C_OPENGL 1