1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "objc2")]
extern_class!(
/// Configuration that you use to program Video Toolbox frame processor for low-latency frame interpolation.
///
/// This configuration can do either purely temporal interpolation (frame-rate conversion) or temporal and spatial
/// interpolation (scaling and frame-rate conversion). This processor requires a source frame and a previous frame. It
/// does temporal scaling, which interpolates frames between the previous frame and the source frame. When performing
/// both temporal and spatial interpolation, the processor can only perform 2x upscaling, and a single frame of temporal
/// interpolation. When performing spatial scaling, the processor produces upscaled intermediate frames and an upscaled
/// `sourceFrame`, but it does not upscale the previous reference frame you provided.
///
/// > Important: When calling ``VTFrameProcessor/startSessionWithConfiguration:error:`` to create a `VTLowLatencyFrameInterpolation`
/// session, ML model loading may take longer than a frame time. Avoid blocking the UI thread or stalling frame rendering
/// pipelines during this call.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtlowlatencyframeinterpolationconfiguration?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "objc2")]
pub struct VTLowLatencyFrameInterpolationConfiguration;
);
#[cfg(feature = "objc2")]
unsafe impl Send for VTLowLatencyFrameInterpolationConfiguration {}
#[cfg(feature = "objc2")]
unsafe impl Sync for VTLowLatencyFrameInterpolationConfiguration {}
#[cfg(feature = "objc2")]
extern_conformance!(
unsafe impl NSObjectProtocol for VTLowLatencyFrameInterpolationConfiguration {}
);
#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
extern_conformance!(
unsafe impl VTFrameProcessorConfiguration for VTLowLatencyFrameInterpolationConfiguration {}
);
#[cfg(feature = "objc2")]
impl VTLowLatencyFrameInterpolationConfiguration {
extern_methods!(
/// Creates a new low-latency frame interpolation configuration for frame-rate conversion.
///
/// The available interpolation points are the equal to the value of (2^x - 1), where x is equal to `numberOfInterpolatedFrames`.
/// For example,
/// - If you request 1 interpolated frame, 1 interpolation point at 0.5 is available.
/// - If you request 2 interpolated frames, 3 interpolation points at 0.25, 0.5 and 0.75 are available.
/// You don't need to use all available interpolation points. Setting a higher `numberOfInterpolatedFrames` increases
/// the resolution of interpolation in some cases, but also increases latency.
///
/// - Parameters:
/// - frameWidth: Width of source frame in pixels.
/// - frameHeight: Height of source frame in pixels.
/// - numberOfInterpolatedFrames: The number of uniformly spaced frames that you want to be used for interpolation.
#[unsafe(method(initWithFrameWidth:frameHeight:numberOfInterpolatedFrames:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFrameWidth_frameHeight_numberOfInterpolatedFrames(
this: Allocated<Self>,
frame_width: NSInteger,
frame_height: NSInteger,
number_of_interpolated_frames: NSInteger,
) -> Option<Retained<Self>>;
/// Creates a new low-latency frame interpolation configuration for spatial scaling and temporal scaling.
///
/// When you configure the processor for spatial scaling, the low-latency frame interpolation processor only supports 2x
/// spatial upscaling and a single frame of temporal interpolation at a 0.5 interpolation phase.
///
/// - Parameters:
/// - frameWidth: Width of source frame in pixels.
/// - frameHeight: Height of source frame in pixels.
/// - spatialScaleFactor: The requested spatial scale factor as an integer. Currently, the processor supports only 2x spatial scaling.
#[unsafe(method(initWithFrameWidth:frameHeight:spatialScaleFactor:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFrameWidth_frameHeight_spatialScaleFactor(
this: Allocated<Self>,
frame_width: NSInteger,
frame_height: NSInteger,
spatial_scale_factor: NSInteger,
) -> Option<Retained<Self>>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
/// Width of source frames in pixels.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(frameWidth))]
#[unsafe(method_family = none)]
pub unsafe fn frameWidth(&self) -> NSInteger;
/// Height of source frames in pixels.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(frameHeight))]
#[unsafe(method_family = none)]
pub unsafe fn frameHeight(&self) -> NSInteger;
/// Configured spatial scale factor as an integer.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(spatialScaleFactor))]
#[unsafe(method_family = none)]
pub unsafe fn spatialScaleFactor(&self) -> NSInteger;
/// Number of uniformly spaced frames for which you configured the processor.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(numberOfInterpolatedFrames))]
#[unsafe(method_family = none)]
pub unsafe fn numberOfInterpolatedFrames(&self) -> NSInteger;
#[cfg(feature = "objc2-foundation")]
/// Available supported pixel formats for current configuration.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(frameSupportedPixelFormats))]
#[unsafe(method_family = none)]
pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
#[cfg(feature = "objc2-foundation")]
/// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent source frames and reference frames.
///
/// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(sourcePixelBufferAttributes))]
#[unsafe(method_family = none)]
pub unsafe fn sourcePixelBufferAttributes(
&self,
) -> Retained<NSDictionary<NSString, AnyObject>>;
#[cfg(feature = "objc2-foundation")]
/// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent destination frames.
///
/// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(destinationPixelBufferAttributes))]
#[unsafe(method_family = none)]
pub unsafe fn destinationPixelBufferAttributes(
&self,
) -> Retained<NSDictionary<NSString, AnyObject>>;
/// Reports whether the system supports this processor.
#[unsafe(method(isSupported))]
#[unsafe(method_family = none)]
pub unsafe fn isSupported() -> bool;
);
}
#[cfg(feature = "objc2")]
extern_class!(
/// An object that contains both input and output parameters that the low-latency frame interpolation processor needs.
///
/// Use this object in the `processWithParameters` call of `VTFrameProcessor` class.
///
/// `VTLowLatencyFrameInterpolationParameters` are frame-level parameters.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtlowlatencyframeinterpolationparameters?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "objc2")]
pub struct VTLowLatencyFrameInterpolationParameters;
);
#[cfg(feature = "objc2")]
extern_conformance!(
unsafe impl NSObjectProtocol for VTLowLatencyFrameInterpolationParameters {}
);
#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
extern_conformance!(
unsafe impl VTFrameProcessorParameters for VTLowLatencyFrameInterpolationParameters {}
);
#[cfg(feature = "objc2")]
impl VTLowLatencyFrameInterpolationParameters {
extern_methods!(
#[cfg(all(feature = "VTFrameProcessorFrame", feature = "objc2-foundation"))]
/// Creates a new low-latency frame interpolation parameters object.
///
/// - Parameters:
/// - sourceFrame: Current frame to use for interpolation; must be non `nil`.
/// - previousFrame: Previous frame used for interpolation; must be non `nil`.
/// - interpolationPhase: Array of float numbers that indicate interpolation phase locations at which the processor
/// interpolates the frames. Must be greater than 0 and less than 1.0; for example 0.5 is midway between the previous
/// frame and the source frame. If you enable spatial scaling, the only supported interpolation phase is 0.5.
/// - destinationFrames: Caller-allocated array of `VTFrameProcessorFrame` to receive the interpolated frames. This
/// must have the same number of elements as the the `interpolationPhase`. If you enable spatial scaling, it must also
/// contain an element to hold the scaled version of sourceFrame.
#[unsafe(method(initWithSourceFrame:previousFrame:interpolationPhase:destinationFrames:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSourceFrame_previousFrame_interpolationPhase_destinationFrames(
this: Allocated<Self>,
source_frame: &VTFrameProcessorFrame,
previous_frame: &VTFrameProcessorFrame,
interpolation_phase: &NSArray<NSNumber>,
destination_frames: &NSArray<VTFrameProcessorFrame>,
) -> Option<Retained<Self>>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[cfg(feature = "VTFrameProcessorFrame")]
/// Source frame that you provided when creating the low-latency frame interpolation parameters object.
#[unsafe(method(sourceFrame))]
#[unsafe(method_family = none)]
pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
#[cfg(feature = "VTFrameProcessorFrame")]
/// Previous frame that you provided when creating the low-latency frame interpolation parameters object.
#[unsafe(method(previousFrame))]
#[unsafe(method_family = none)]
pub unsafe fn previousFrame(&self) -> Retained<VTFrameProcessorFrame>;
#[cfg(feature = "objc2-foundation")]
/// Array of interpolation phases that you provided when creating the low-latency frame interpolation parameters object.
#[unsafe(method(interpolationPhase))]
#[unsafe(method_family = none)]
pub unsafe fn interpolationPhase(&self) -> Retained<NSArray<NSNumber>>;
#[cfg(all(feature = "VTFrameProcessorFrame", feature = "objc2-foundation"))]
/// Array of destination frames that you provided when creating the low-latency frame interpolation parameters object.
#[unsafe(method(destinationFrames))]
#[unsafe(method_family = none)]
pub unsafe fn destinationFrames(&self) -> Retained<NSArray<VTFrameProcessorFrame>>;
);
}