1
0
Fork 0

Revert "Rewrite video capturing and (…)" r4314

This reverts commit 987a48600d.
This commit is contained in:
Patryk Obara 2020-02-08 14:52:48 +01:00
parent 9264bbf969
commit b7029dac06
6 changed files with 379 additions and 671 deletions

View file

@ -439,12 +439,12 @@ else
fi
AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng])
AC_ARG_ENABLE(screenshots,AC_HELP_STRING([--disable-screenshots],[Disable screenshots]),enable_screenshots=no,enable_screenshots=yes)
AC_CHECK_HEADER(png.h,have_png_h=yes,have_png_h=no)
AC_CHECK_LIB(png, png_get_io_ptr, have_png_lib=yes, have_png_lib=no,-lz)
AC_ARG_ENABLE(screenshots,AC_HELP_STRING([--disable-screenshots],[Disable screenshots and movie recording]),,enable_screenshots=yes)
AC_CHECK_HEADER(png.h,have_png_h=yes,)
AC_CHECK_LIB(png, png_get_io_ptr, have_png_lib=yes, ,-lz)
AC_MSG_CHECKING([whether screenshots will be enabled])
if test x$enable_screenshots = xyes; then
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
LIBS="$LIBS -lpng -lz"
AC_DEFINE(C_SSHOT,1)
AC_MSG_RESULT([yes])
@ -455,25 +455,6 @@ else
AC_MSG_RESULT([no])
fi
AH_TEMPLATE(C_SRECORD,[Define to 1 to enable movie recording, requires zlib built without Z_SOLO])
AC_ARG_ENABLE(recording,AC_HELP_STRING([--disable-recording],[Disable movie recording]),,enable_recording=yes)
AC_CHECK_HEADER(zlib.h,have_zlib_h=yes)
AC_CHECK_LIB(z,compress,have_z_lib=yes,,)
AC_MSG_CHECKING([whether recording will be enabled])
if test x$enable_recording = xyes; then
if test x$have_z_lib = xyes -a x$have_zlib_h = xyes ; then
if test x$enable_screenshots = xno -o x$have_png_h = xno -o x$have_png_lib = xno ; then
LIBS="$LIBS -lz"
fi
AC_DEFINE(C_SRECORD,1)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, can't find zlib.])
fi
else
AC_MSG_RESULT([no])
fi
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net])
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL_net])
AC_CHECK_HEADER(SDL_net.h,have_sdl_net_h=yes,)

View file

@ -45,10 +45,10 @@ bool TS_Get_Address(Bitu& tsaddr, Bitu& tsirq, Bitu& tsdma);
extern Bit8u adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
void CAPTURE_AddWave(Bit32u freq, Bitu len, Bit16s * data);
void CAPTURE_AddWave(Bit32u freq, Bit32u len, Bit16s * data);
#define CAPTURE_FLAG_DBLW 0x1
#define CAPTURE_FLAG_DBLH 0x2
void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, const Bit8u * data, const Bit8u * pal);
void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal);
void CAPTURE_AddMidi(bool sysex, Bitu len, Bit8u * data);
#endif

File diff suppressed because it is too large Load diff

View file

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

View file

@ -105,13 +105,12 @@ 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, const void *lineData[]);
void CompressLines(int lineCount, 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,8 +8,6 @@
/* 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