Skip to main content

ohos_video_processing_engine_sys/image_processing/
image_processing_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::image_processing_types::{
7    ImageProcessing_ColorSpaceInfo, ImageProcessing_ErrorCode, OH_ImageProcessing,
8};
9use ohos_sys_opaque_types::{OH_AVFormat, OH_PixelmapNative};
10
11extern "C" {
12    /// Initialize global environment for image processing.
13    ///
14    /// This function is optional.
15    ///
16    /// Typically, this function is called once when the host process is started to initialize the global environment for
17    /// image processing, which can reduce the time of [`OH_ImageProcessing_Create`].
18    ///
19    /// To deinitialize global environment, call [`OH_ImageProcessing_DeinitializeEnvironment`].
20    ///
21    ///
22    /// # Returns
23    ///
24    /// * [`IMAGE_PROCESSING_SUCCESS`] if initialization is successful.
25    ///
26    /// [`IMAGE_PROCESSING_ERROR_INITIALIZE_FAILED`] if initialization is failed.
27    ///
28    /// You can check if the device GPU is working properly.
29    ///
30    /// Available since API-level: 13
31    #[cfg(feature = "api-13")]
32    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
33    pub fn OH_ImageProcessing_InitializeEnvironment() -> ImageProcessing_ErrorCode;
34    /// Deinitialize global environment for image processing.
35    ///
36    /// This function is required if [`OH_ImageProcessing_InitializeEnvironment`] is called. Typically, this
37    /// function is called when the host process is about to exit to deinitialize the global environment, which is
38    /// initialized by calling [`OH_ImageProcessing_InitializeEnvironment`].
39    ///
40    /// If there is some image processing instance existing, this function should not be called.
41    ///
42    /// If the [`OH_ImageProcessing_InitializeEnvironment`] is not called, this function should not be called.
43    ///
44    ///
45    /// # Returns
46    ///
47    /// * [`IMAGE_PROCESSING_SUCCESS`] if deinitialization is successful.
48    ///
49    /// [`IMAGE_PROCESSING_ERROR_OPERATION_NOT_PERMITTED`] if some image processing instance is not destroyed or
50    /// [`OH_ImageProcessing_InitializeEnvironment`] is not called.
51    ///
52    ///
53    /// Available since API-level: 13
54    #[cfg(feature = "api-13")]
55    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
56    pub fn OH_ImageProcessing_DeinitializeEnvironment() -> ImageProcessing_ErrorCode;
57    /// Query whether the image color space conversion is supported.
58    ///
59    /// # Arguments
60    ///
61    /// * `sourceImageInfo` - Input image color space information pointer.
62    ///
63    /// * `destinationImageInfo` - Output image color space information pointer.
64    ///
65    /// # Returns
66    ///
67    /// * <b>true</b> if the color space conversion is supported.
68    ///
69    /// <b>false</b> if the the color space conversion is unsupported.
70    ///
71    /// Available since API-level: 13
72    #[cfg(feature = "api-13")]
73    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
74    pub fn OH_ImageProcessing_IsColorSpaceConversionSupported(
75        sourceImageInfo: *const ImageProcessing_ColorSpaceInfo,
76        destinationImageInfo: *const ImageProcessing_ColorSpaceInfo,
77    ) -> bool;
78    /// Query whether the image composition is supported.
79    ///
80    /// # Arguments
81    ///
82    /// * `sourceImageInfo` - Input image color space information pointer.
83    ///
84    /// * `sourceGainmapInfo` - Input gainmap color space information pointer.
85    ///
86    /// * `destinationImageInfo` - Output image color space information pointer.
87    ///
88    /// # Returns
89    ///
90    /// * <b>true</b> if the image composition is supported.
91    ///
92    /// <b>false</b> if the image composition is unsupported.
93    ///
94    /// Available since API-level: 13
95    #[cfg(feature = "api-13")]
96    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
97    pub fn OH_ImageProcessing_IsCompositionSupported(
98        sourceImageInfo: *const ImageProcessing_ColorSpaceInfo,
99        sourceGainmapInfo: *const ImageProcessing_ColorSpaceInfo,
100        destinationImageInfo: *const ImageProcessing_ColorSpaceInfo,
101    ) -> bool;
102    /// Query whether the image decomposition is supported.
103    ///
104    /// # Arguments
105    ///
106    /// * `sourceImageInfo` - Input image color space information pointer.
107    ///
108    /// * `destinationImageInfo` - Output image color space information pointer.
109    ///
110    /// * `destinationGainmapInfo` - Output gainmap information pointer.
111    ///
112    /// # Returns
113    ///
114    /// * <b>true</b> if the image decomposition is supported.
115    ///
116    /// <b>false</b> if the image decomposition is unsupported.
117    ///
118    /// Available since API-level: 13
119    #[cfg(feature = "api-13")]
120    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
121    pub fn OH_ImageProcessing_IsDecompositionSupported(
122        sourceImageInfo: *const ImageProcessing_ColorSpaceInfo,
123        destinationImageInfo: *const ImageProcessing_ColorSpaceInfo,
124        destinationGainmapInfo: *const ImageProcessing_ColorSpaceInfo,
125    ) -> bool;
126    /// Query whether the image metadata generation is supported.
127    ///
128    /// # Arguments
129    ///
130    /// * `sourceImageInfo` - Input image color space information pointer.
131    ///
132    /// # Returns
133    ///
134    /// * <b>true</b> if the image metadata generation is supported..
135    ///
136    /// <b>false</b> if the image metadata generation is unsupported.
137    ///
138    /// Available since API-level: 13
139    #[cfg(feature = "api-13")]
140    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
141    pub fn OH_ImageProcessing_IsMetadataGenerationSupported(
142        sourceImageInfo: *const ImageProcessing_ColorSpaceInfo,
143    ) -> bool;
144    /// Create an image processing instance.
145    ///
146    /// # Arguments
147    ///
148    /// * `imageProcessor` - Output parameter. The *imageProcessor points to a new image processing object.
149    /// The *imageProcessor must be null before passed in.
150    ///
151    /// * `type` - Use IMAGE_PROCESSING_TYPE_XXX to specify the processing type. The processing type of the instance can not
152    /// be changed.
153    ///
154    /// # Returns
155    ///
156    /// * [`IMAGE_PROCESSING_SUCCESS`] if creating an image processing successfully.
157    ///
158    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the type is not supported. For example, if metadata
159    /// generation is not supported by vendor, it returns unsupported processing.
160    ///
161    /// [`IMAGE_PROCESSING_ERROR_CREATE_FAILED`] if failed to create an image processing.
162    ///
163    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or <b>*</b>instance is <b>not</b> null.
164    ///
165    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if type is invalid.
166    ///
167    ///
168    /// Available since API-level: 13
169    #[cfg(feature = "api-13")]
170    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
171    pub fn OH_ImageProcessing_Create(
172        imageProcessor: *mut *mut OH_ImageProcessing,
173        type_: i32,
174    ) -> ImageProcessing_ErrorCode;
175    /// Destroy the image processing instance.
176    ///
177    /// # Arguments
178    ///
179    /// * `imageProcessor` - An image processing instance pointer. It is recommended setting the
180    /// instance pointer to null after the instance is destroyed.
181    ///
182    /// # Returns
183    ///
184    /// * [`IMAGE_PROCESSING_SUCCESS`] if the instance is destroyed successfully.
185    ///
186    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
187    ///
188    /// Available since API-level: 13
189    #[cfg(feature = "api-13")]
190    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
191    pub fn OH_ImageProcessing_Destroy(
192        imageProcessor: *mut OH_ImageProcessing,
193    ) -> ImageProcessing_ErrorCode;
194    /// Set parameter for image processing.
195    ///
196    /// Add parameter identified by the specified parameter key.
197    ///
198    /// # Arguments
199    ///
200    /// * `imageProcessor` - An image processing instance pointer.
201    ///
202    /// * `parameter` - The parameter for image processing.
203    ///
204    /// # Returns
205    ///
206    /// * [`IMAGE_PROCESSING_SUCCESS`] if setting parameter is successful.
207    ///
208    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
209    ///
210    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the parameter is null.
211    ///
212    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of the parameter is invalid. For example, the parameter
213    /// contains unsupported parameter key or value.
214    ///
215    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
216    ///
217    /// Available since API-level: 13
218    #[cfg(feature = "api-13")]
219    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
220    pub fn OH_ImageProcessing_SetParameter(
221        imageProcessor: *mut OH_ImageProcessing,
222        parameter: *const OH_AVFormat,
223    ) -> ImageProcessing_ErrorCode;
224    /// Get parameter of image processing.
225    ///
226    /// Get parameter identified by the specified parameter key.
227    ///
228    /// # Arguments
229    ///
230    /// * `imageProcessor` - An image processing instance pointer.
231    ///
232    /// * `parameter` - The parameter used by the image processing instance.
233    ///
234    /// # Returns
235    ///
236    /// * [`IMAGE_PROCESSING_SUCCESS`] if getting parameter is successful.
237    ///
238    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
239    ///
240    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the parameter is null.
241    ///
242    ///
243    /// Available since API-level: 13
244    #[cfg(feature = "api-13")]
245    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
246    pub fn OH_ImageProcessing_GetParameter(
247        imageProcessor: *mut OH_ImageProcessing,
248        parameter: *mut OH_AVFormat,
249    ) -> ImageProcessing_ErrorCode;
250    /// Conversion between single-layer images.
251    ///
252    /// The function generate the destinationImage from sourceImage. It include the colorspace conversion from
253    /// HDR image to SDR image, SDR image to HDR image, SDR image to SDR image and HDR image to HDR image.
254    ///
255    /// # Arguments
256    ///
257    /// * `imageProcessor` - An image processing instance pointer. The instance should be created with
258    /// type [`IMAGE_PROCESSING_TYPE_COLOR_SPACE_CONVERSION`].
259    ///
260    /// * `sourceImage` - Input image pointer.
261    ///
262    /// * `destinationImage` - Output image pointer.
263    ///
264    /// # Returns
265    ///
266    /// * [`IMAGE_PROCESSING_SUCCESS`] if processing image is successful.
267    ///
268    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
269    ///
270    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the image is null.
271    ///
272    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of image is invalid. For example, the color space
273    /// of the image is unsupported.
274    ///
275    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the processing is not supported.
276    ///
277    /// [`IMAGE_PROCESSING_ERROR_PROCESS_FAILED`] if processing error occurs.
278    ///
279    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
280    ///
281    /// Available since API-level: 13
282    #[cfg(feature = "api-13")]
283    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
284    pub fn OH_ImageProcessing_ConvertColorSpace(
285        imageProcessor: *mut OH_ImageProcessing,
286        sourceImage: *mut OH_PixelmapNative,
287        destinationImage: *mut OH_PixelmapNative,
288    ) -> ImageProcessing_ErrorCode;
289    /// Composition from dual-layer HDR images to single-layer HDR images.
290    ///
291    /// The function generate the destinationImage from sourceImage and sourceGainmap.
292    ///
293    /// # Arguments
294    ///
295    /// * `imageProcessor` - An image processing instance pointer. The instance should be created with
296    /// type [`IMAGE_PROCESSING_TYPE_COMPOSITION`].
297    ///
298    /// * `sourceImage` - Input image pointer.
299    ///
300    /// * `sourceGainmap` - Input gainmap pointer.
301    ///
302    /// * `destinationImage` - Output image pointer.
303    ///
304    /// # Returns
305    ///
306    /// * [`IMAGE_PROCESSING_SUCCESS`] if processing image is successful.
307    ///
308    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
309    ///
310    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the image is null.
311    ///
312    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of image is invalid. For example, the color space
313    /// of the image is unsupported.
314    ///
315    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the processing is not supported.
316    ///
317    /// [`IMAGE_PROCESSING_ERROR_PROCESS_FAILED`] if processing error occurs.
318    ///
319    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
320    ///
321    /// Available since API-level: 13
322    #[cfg(feature = "api-13")]
323    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
324    pub fn OH_ImageProcessing_Compose(
325        imageProcessor: *mut OH_ImageProcessing,
326        sourceImage: *mut OH_PixelmapNative,
327        sourceGainmap: *mut OH_PixelmapNative,
328        destinationImage: *mut OH_PixelmapNative,
329    ) -> ImageProcessing_ErrorCode;
330    /// Decomposition from single-layer HDR images to dual-layer HDR images.
331    ///
332    /// The function generate the destinationImage and destinationGainmap from sourceImage.
333    ///
334    /// # Arguments
335    ///
336    /// * `imageProcessor` - An image processing instance pointer. The instance should be created with
337    /// type [`IMAGE_PROCESSING_TYPE_DECOMPOSITION`].
338    ///
339    /// * `sourceImage` - Input image pointer.
340    ///
341    /// * `destinationImage` - Output image pointer.
342    ///
343    /// * `destinationGainmap` - Output gainmap pointer.
344    ///
345    /// # Returns
346    ///
347    /// * [`IMAGE_PROCESSING_SUCCESS`] if processing image is successful.
348    ///
349    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
350    ///
351    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the image is null.
352    ///
353    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of image is invalid. For example, the color space
354    /// of the image is unsupported.
355    ///
356    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the processing is not supported.
357    ///
358    /// [`IMAGE_PROCESSING_ERROR_PROCESS_FAILED`] if processing error occurs.
359    ///
360    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
361    ///
362    /// Available since API-level: 13
363    #[cfg(feature = "api-13")]
364    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
365    pub fn OH_ImageProcessing_Decompose(
366        imageProcessor: *mut OH_ImageProcessing,
367        sourceImage: *mut OH_PixelmapNative,
368        destinationImage: *mut OH_PixelmapNative,
369        destinationGainmap: *mut OH_PixelmapNative,
370    ) -> ImageProcessing_ErrorCode;
371    /// Metadata Generation for HDR images.
372    ///
373    /// The function generate metadata for the sourceImage.
374    ///
375    /// # Arguments
376    ///
377    /// * `imageProcessor` - An image processing instance pointer. The instance should be created with
378    /// type [`IMAGE_PROCESSING_TYPE_METADATA_GENERATION`].
379    ///
380    /// * `sourceImage` - Input image pointer.
381    ///
382    /// # Returns
383    ///
384    /// * [`IMAGE_PROCESSING_SUCCESS`] if processing image is successful.
385    ///
386    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
387    ///
388    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the image is null.
389    ///
390    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of image is invalid. For example, the color space
391    /// of the image is unsupported.
392    ///
393    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the processing is not supported.
394    ///
395    /// [`IMAGE_PROCESSING_ERROR_PROCESS_FAILED`] if processing error occurs.
396    ///
397    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
398    ///
399    /// Available since API-level: 13
400    #[cfg(feature = "api-13")]
401    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
402    pub fn OH_ImageProcessing_GenerateMetadata(
403        imageProcessor: *mut OH_ImageProcessing,
404        sourceImage: *mut OH_PixelmapNative,
405    ) -> ImageProcessing_ErrorCode;
406    /// Clarity enhancement for images.
407    ///
408    /// The function generate the destinationImage from sourceImage with necessary scaling operation according to the size
409    /// preset in the sourceImage and destinationImage. Different levels of scaling methonds are provided to balance
410    /// performance and image quality.
411    ///
412    /// # Arguments
413    ///
414    /// * `imageProcessor` - An image processing instance pointer. The instance should be created with
415    /// type [`IMAGE_PROCESSING_TYPE_DETAIL_ENHANCER`].
416    ///
417    /// * `sourceImage` - Input image pointer.
418    ///
419    /// * `destinationImage` - Output image pointer.
420    ///
421    /// # Returns
422    ///
423    /// * [`IMAGE_PROCESSING_SUCCESS`] if processing image is successful.
424    ///
425    /// [`IMAGE_PROCESSING_ERROR_INVALID_INSTANCE`] if instance is null or not an image processing instance.
426    ///
427    /// [`IMAGE_PROCESSING_ERROR_INVALID_PARAMETER`] if the image is null.
428    ///
429    /// [`IMAGE_PROCESSING_ERROR_INVALID_VALUE`] if some property of image is invalid. For example, the color space
430    /// of the image is unsupported.
431    ///
432    /// [`IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING`] if the processing is not supported.
433    ///
434    /// [`IMAGE_PROCESSING_ERROR_PROCESS_FAILED`] if processing error occurs.
435    ///
436    /// [`IMAGE_PROCESSING_ERROR_NO_MEMORY`] if memory allocation failed.
437    ///
438    /// Available since API-level: 13
439    #[cfg(feature = "api-13")]
440    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
441    pub fn OH_ImageProcessing_EnhanceDetail(
442        imageProcessor: *mut OH_ImageProcessing,
443        sourceImage: *mut OH_PixelmapNative,
444        destinationImage: *mut OH_PixelmapNative,
445    ) -> ImageProcessing_ErrorCode;
446}