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