Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve serialization performance by creating a simple binary format for transform files. #97

Merged
merged 4 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include (GNUInstallDirs)
find_package(OpenMP)

set(MAJOR_VERSION 1)
set(MINOR_VERSION 1)
set(MINOR_VERSION 2)
set(PATCH_VERSION 0)
set(VIDSTAB_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}${PATCH_VERSION})

Expand Down
4 changes: 4 additions & 0 deletions src/motiondetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ int vsMotionDetectInit(VSMotionDetect* md, const VSMotionDetectConfig* conf, con
md->hasSeenOneFrame = 0;
md->frameNum = 0;

if(md->serializationMode != ASCII_SERIALIZATION_MODE && md->serializationMode != BINARY_SERIALIZATION_MODE) {
md->serializationMode = BINARY_SERIALIZATION_MODE;
}

// TODO: get rid of shakiness parameter in the long run
md->conf.shakiness = VS_MIN(10,VS_MAX(1,md->conf.shakiness));
md->conf.accuracy = VS_MIN(15,VS_MAX(1,md->conf.accuracy));
Expand Down
6 changes: 6 additions & 0 deletions src/motiondetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include "vsvector.h"
#include "frameinfo.h"

#define ASCII_SERIALIZATION_MODE 1
#define BINARY_SERIALIZATION_MODE 2

typedef struct _vsmotiondetectconfig {
/* meta parameter for maxshift and fieldsize between 1 and 15 */
int shakiness;
Expand Down Expand Up @@ -81,6 +84,7 @@ typedef struct _vsmotiondetect {
VSFrame prev; // frame buffer for last frame (copied)
short hasSeenOneFrame; // true if we have a valid previous frame
int initialized; // 1 if initialized and 2 if configured
int serializationMode; // 1 if ascii and 2 if binary

int frameNum;
} VSMotionDetect;
Expand All @@ -91,6 +95,8 @@ static const char vs_motiondetect_help[] = ""
" (translation, rotation) about subsequent frames."
" See also transform.\n"
"Options\n"
" 'fileformat' the type of file format used to write the transforms\n"
" 1: ascii (human readable) file format 2: binary (smaller) file format\n"
" 'result' path to the file used to write the transforms\n"
" (def:inputfile.stab)\n"
" 'shakiness' how shaky is the video and how quick is the camera?\n"
Expand Down
Loading