Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
- Updated `gyroflow_core`.
- Added option to "Disable Gyroflow Stretch".
- Added "Disable Gyroflow Stretch" to the cache key.
- Made "Stabilisation Overview" non animatable.
  • Loading branch information
latenitefilms committed Jul 16, 2023
1 parent 4853528 commit a3902e2
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 85 deletions.
2 changes: 1 addition & 1 deletion Source/Frameworks/gyroflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ argh = "*"
serde = "1.0"
serde_json = "1.0"
libc = "0.2"
gyroflow-core = { git = "https://github.com/gyroflow/gyroflow.git", default-features = false, rev = "6f60b83", features = ["bundle-lens-profiles"] }
gyroflow-core = { git = "https://github.com/gyroflow/gyroflow.git", default-features = false, rev = "eec8bb0", features = ["bundle-lens-profiles"] }
log = "0.4.17"
oslog = "0.2.0"
lazy_static = "1.4.0"
Expand Down
1 change: 1 addition & 0 deletions Source/Frameworks/gyroflow/inc/gyroflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const char* processFrame(
double input_rotation,
double video_rotation,
uint8_t fov_overview,
uint8_t disable_gyroflow_stretch,
void *in_mtl_texture,
void *out_mtl_texture,
void *command_queue
Expand Down
10 changes: 9 additions & 1 deletion Source/Frameworks/gyroflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ pub extern "C" fn processFrame(
input_rotation: f64,
video_rotation: f64,
fov_overview: u8,
disable_gyroflow_stretch: u8,
in_mtl_tex: *mut std::ffi::c_void,
out_mtl_tex: *mut std::ffi::c_void,
command_queue: *mut std::ffi::c_void,
Expand Down Expand Up @@ -332,7 +333,7 @@ pub extern "C" fn processFrame(
// Cache the manager:
//---------------------------------------------------------
let mut cache = MANAGER_CACHE.lock().unwrap();
let cache_key = format!("{path_string}{output_width}{output_height}{pixel_format_string}{unique_identifier_string}");
let cache_key = format!("{path_string}{output_width}{output_height}{pixel_format_string}{disable_gyroflow_stretch}{unique_identifier_string}");
let manager = if let Some(manager) = cache.get(&cache_key) {
//---------------------------------------------------------
// Already cached:
Expand All @@ -353,6 +354,13 @@ pub extern "C" fn processFrame(
let mut is_preset = false;
match manager.import_gyroflow_data(&data_slice, true, None, |_|(), Arc::new(AtomicBool::new(false)), &mut is_preset) {
Ok(_) => {
//---------------------------------------------------------
// Disable Gyroflow Stretch:
//---------------------------------------------------------
if disable_gyroflow_stretch != 0 {
manager.disable_lens_stretch();
}

//---------------------------------------------------------
// Set the Input Size:
//---------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion Source/Gyroflow/Plugin/GyroflowConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@

//---------------------------------------------------------
// Plugin Parameter Constants:
//
// NOTE TO FUTURE SELF: The reason the below numbers are
// out of order is to retain backwards
// compatibility with the original
// Mac App Store release.
//---------------------------------------------------------
enum {


/*
THIS IS WHAT GOES IN THE MOTION TEMPLATE:
<publishSettings>
<version>2</version>
<target object="10036" channel="./1" name=""/>
<target object="10036" channel="./3" name=""/>
<target object="10036" channel="./5" name="Import"/>
<target object="10036" channel="./90" name="Gyroflow Parameters"/>
<target object="10036" channel="./300" name="Tools"/>
Expand Down Expand Up @@ -66,6 +74,7 @@ enum {
kCB_ToolsSection = 300,

kCB_FieldOfViewOverview = 310,
kCB_DisableGyroflowStretch = 320,

//---------------------------------------------------------
// File Management:
Expand Down
2 changes: 2 additions & 0 deletions Source/Gyroflow/Plugin/GyroflowParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
NSNumber *videoRotation;

NSNumber *fovOverview;
NSNumber *disableGyroflowStretch;
}

@property (nonatomic, copy) NSString *uniqueIdentifier;
Expand All @@ -43,5 +44,6 @@
@property (nonatomic, copy) NSNumber *videoRotation;

@property (nonatomic, copy) NSNumber *fovOverview;
@property (nonatomic, copy) NSNumber *disableGyroflowStretch;

@end
64 changes: 34 additions & 30 deletions Source/Gyroflow/Plugin/GyroflowParameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ @implementation GyroflowParameters
@synthesize videoRotation;

@synthesize fovOverview;
@synthesize disableGyroflowStretch;

+ (BOOL)supportsSecureCoding
{
Expand All @@ -55,49 +56,52 @@ - (void)dealloc {
[videoRotation release];

[fovOverview release];
[disableGyroflowStretch release];

[super dealloc];
}

- (id)initWithCoder:(NSCoder *)decoder {
if (self = [super init]) {
self.uniqueIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"uniqueIdentifier"];
self.gyroflowPath = [decoder decodeObjectOfClass:[NSString class] forKey:@"gyroflowPath"];
self.gyroflowData = [decoder decodeObjectOfClass:[NSString class] forKey:@"gyroflowData"];
self.timestamp = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"timestamp"];
self.fov = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"fov"];
self.smoothness = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"smoothness"];
self.lensCorrection = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"lensCorrection"];

self.horizonLock = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"horizonLock"];
self.horizonRoll = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"horizonRoll"];
self.positionOffsetX = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"positionOffsetX"];
self.positionOffsetY = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"positionOffsetY"];
self.inputRotation = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"inputRotation"];
self.videoRotation = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"videoRotation"];

self.fovOverview = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"fovOverview"];
self.uniqueIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"uniqueIdentifier"];
self.gyroflowPath = [decoder decodeObjectOfClass:[NSString class] forKey:@"gyroflowPath"];
self.gyroflowData = [decoder decodeObjectOfClass:[NSString class] forKey:@"gyroflowData"];
self.timestamp = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"timestamp"];
self.fov = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"fov"];
self.smoothness = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"smoothness"];
self.lensCorrection = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"lensCorrection"];

self.horizonLock = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"horizonLock"];
self.horizonRoll = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"horizonRoll"];
self.positionOffsetX = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"positionOffsetX"];
self.positionOffsetY = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"positionOffsetY"];
self.inputRotation = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"inputRotation"];
self.videoRotation = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"videoRotation"];

self.fovOverview = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"fovOverview"];
self.disableGyroflowStretch = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"disableGyroflowStretch"];
}
return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:uniqueIdentifier forKey:@"uniqueIdentifier"];
[encoder encodeObject:gyroflowPath forKey:@"gyroflowPath"];
[encoder encodeObject:gyroflowData forKey:@"gyroflowData"];
[encoder encodeObject:timestamp forKey:@"timestamp"];
[encoder encodeObject:fov forKey:@"fov"];
[encoder encodeObject:smoothness forKey:@"smoothness"];
[encoder encodeObject:lensCorrection forKey:@"lensCorrection"];
[encoder encodeObject:uniqueIdentifier forKey:@"uniqueIdentifier"];
[encoder encodeObject:gyroflowPath forKey:@"gyroflowPath"];
[encoder encodeObject:gyroflowData forKey:@"gyroflowData"];
[encoder encodeObject:timestamp forKey:@"timestamp"];
[encoder encodeObject:fov forKey:@"fov"];
[encoder encodeObject:smoothness forKey:@"smoothness"];
[encoder encodeObject:lensCorrection forKey:@"lensCorrection"];

[encoder encodeObject:horizonLock forKey:@"horizonLock"];
[encoder encodeObject:horizonRoll forKey:@"horizonRoll"];
[encoder encodeObject:positionOffsetX forKey:@"positionOffsetX"];
[encoder encodeObject:positionOffsetY forKey:@"positionOffsetY"];
[encoder encodeObject:inputRotation forKey:@"inputRotation"];
[encoder encodeObject:videoRotation forKey:@"videoRotation"];
[encoder encodeObject:horizonLock forKey:@"horizonLock"];
[encoder encodeObject:horizonRoll forKey:@"horizonRoll"];
[encoder encodeObject:positionOffsetX forKey:@"positionOffsetX"];
[encoder encodeObject:positionOffsetY forKey:@"positionOffsetY"];
[encoder encodeObject:inputRotation forKey:@"inputRotation"];
[encoder encodeObject:videoRotation forKey:@"videoRotation"];

[encoder encodeObject:fovOverview forKey:@"fovOverview"];
[encoder encodeObject:fovOverview forKey:@"fovOverview"];
[encoder encodeObject:disableGyroflowStretch forKey:@"disableGyroflowStretch"];
}

@end
Loading

0 comments on commit a3902e2

Please sign in to comment.