Skip to main content

vmaf_head_sys/
bindings.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3#![allow(rustdoc::broken_intra_doc_links)]
4#![allow(rustdoc::bare_urls)]
5
6pub const VMAF_API_VERSION_MAJOR: u32 = 3;
7pub const VMAF_API_VERSION_MINOR: u32 = 2;
8pub const VMAF_API_VERSION_PATCH: u32 = 0;
9#[repr(C)]
10#[derive(Debug, Copy, Clone)]
11pub struct VmafFeatureDictionary {
12    _unused: [u8; 0],
13}
14unsafe extern "C" {
15    pub fn vmaf_feature_dictionary_set(
16        dict: *mut *mut VmafFeatureDictionary,
17        key: *const ::std::os::raw::c_char,
18        val: *const ::std::os::raw::c_char,
19    ) -> ::std::os::raw::c_int;
20}
21unsafe extern "C" {
22    pub fn vmaf_feature_dictionary_free(
23        dict: *mut *mut VmafFeatureDictionary,
24    ) -> ::std::os::raw::c_int;
25}
26#[repr(C)]
27#[derive(Debug, Copy, Clone)]
28pub struct VmafModel {
29    _unused: [u8; 0],
30}
31pub const VmafModelFlags_VMAF_MODEL_FLAGS_DEFAULT: VmafModelFlags = 0;
32pub const VmafModelFlags_VMAF_MODEL_FLAG_DISABLE_CLIP: VmafModelFlags = 1;
33pub const VmafModelFlags_VMAF_MODEL_FLAG_ENABLE_TRANSFORM: VmafModelFlags = 2;
34pub const VmafModelFlags_VMAF_MODEL_FLAG_DISABLE_TRANSFORM: VmafModelFlags = 4;
35pub type VmafModelFlags = ::std::os::raw::c_uint;
36#[repr(C)]
37#[derive(Debug, Copy, Clone)]
38pub struct VmafModelConfig {
39    pub name: *const ::std::os::raw::c_char,
40    pub flags: u64,
41}
42unsafe extern "C" {
43    pub fn vmaf_model_load(
44        model: *mut *mut VmafModel,
45        cfg: *mut VmafModelConfig,
46        version: *const ::std::os::raw::c_char,
47    ) -> ::std::os::raw::c_int;
48}
49unsafe extern "C" {
50    pub fn vmaf_model_load_from_path(
51        model: *mut *mut VmafModel,
52        cfg: *mut VmafModelConfig,
53        path: *const ::std::os::raw::c_char,
54    ) -> ::std::os::raw::c_int;
55}
56unsafe extern "C" {
57    pub fn vmaf_model_feature_overload(
58        model: *mut VmafModel,
59        feature_name: *const ::std::os::raw::c_char,
60        opts_dict: *mut VmafFeatureDictionary,
61    ) -> ::std::os::raw::c_int;
62}
63unsafe extern "C" {
64    pub fn vmaf_model_destroy(model: *mut VmafModel);
65}
66#[repr(C)]
67#[derive(Debug, Copy, Clone)]
68pub struct VmafModelCollection {
69    _unused: [u8; 0],
70}
71pub const VmafModelCollectionScoreType_VMAF_MODEL_COLLECTION_SCORE_UNKNOWN:
72    VmafModelCollectionScoreType = 0;
73pub const VmafModelCollectionScoreType_VMAF_MODEL_COLLECTION_SCORE_BOOTSTRAP:
74    VmafModelCollectionScoreType = 1;
75pub type VmafModelCollectionScoreType = ::std::os::raw::c_uint;
76#[repr(C)]
77#[derive(Debug, Copy, Clone)]
78pub struct VmafModelCollectionScore {
79    pub type_: VmafModelCollectionScoreType,
80    pub bootstrap: VmafModelCollectionScore__bindgen_ty_1,
81}
82#[repr(C)]
83#[derive(Debug, Copy, Clone)]
84pub struct VmafModelCollectionScore__bindgen_ty_1 {
85    pub bagging_score: f64,
86    pub stddev: f64,
87    pub ci: VmafModelCollectionScore__bindgen_ty_1__bindgen_ty_1,
88}
89#[repr(C)]
90#[derive(Debug, Copy, Clone)]
91pub struct VmafModelCollectionScore__bindgen_ty_1__bindgen_ty_1 {
92    pub p95: VmafModelCollectionScore__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1,
93}
94#[repr(C)]
95#[derive(Debug, Copy, Clone)]
96pub struct VmafModelCollectionScore__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
97    pub lo: f64,
98    pub hi: f64,
99}
100unsafe extern "C" {
101    pub fn vmaf_model_collection_load(
102        model: *mut *mut VmafModel,
103        model_collection: *mut *mut VmafModelCollection,
104        cfg: *mut VmafModelConfig,
105        version: *const ::std::os::raw::c_char,
106    ) -> ::std::os::raw::c_int;
107}
108unsafe extern "C" {
109    pub fn vmaf_model_collection_load_from_path(
110        model: *mut *mut VmafModel,
111        model_collection: *mut *mut VmafModelCollection,
112        cfg: *mut VmafModelConfig,
113        path: *const ::std::os::raw::c_char,
114    ) -> ::std::os::raw::c_int;
115}
116unsafe extern "C" {
117    pub fn vmaf_model_collection_feature_overload(
118        model: *mut VmafModel,
119        model_collection: *mut *mut VmafModelCollection,
120        feature_name: *const ::std::os::raw::c_char,
121        opts_dict: *mut VmafFeatureDictionary,
122    ) -> ::std::os::raw::c_int;
123}
124unsafe extern "C" {
125    pub fn vmaf_model_collection_destroy(model_collection: *mut VmafModelCollection);
126}
127pub const VmafPixelFormat_VMAF_PIX_FMT_UNKNOWN: VmafPixelFormat = 0;
128pub const VmafPixelFormat_VMAF_PIX_FMT_YUV420P: VmafPixelFormat = 1;
129pub const VmafPixelFormat_VMAF_PIX_FMT_YUV422P: VmafPixelFormat = 2;
130pub const VmafPixelFormat_VMAF_PIX_FMT_YUV444P: VmafPixelFormat = 3;
131pub const VmafPixelFormat_VMAF_PIX_FMT_YUV400P: VmafPixelFormat = 4;
132pub type VmafPixelFormat = ::std::os::raw::c_uint;
133#[repr(C)]
134#[derive(Debug, Copy, Clone)]
135pub struct VmafRef {
136    _unused: [u8; 0],
137}
138#[repr(C)]
139#[derive(Debug, Copy, Clone)]
140pub struct VmafPicture {
141    pub pix_fmt: VmafPixelFormat,
142    pub bpc: ::std::os::raw::c_uint,
143    pub w: [::std::os::raw::c_uint; 3usize],
144    pub h: [::std::os::raw::c_uint; 3usize],
145    pub stride: [isize; 3usize],
146    pub data: [*mut ::std::os::raw::c_void; 3usize],
147    pub ref_: *mut VmafRef,
148    pub priv_: *mut ::std::os::raw::c_void,
149}
150unsafe extern "C" {
151    pub fn vmaf_picture_alloc(
152        pic: *mut VmafPicture,
153        pix_fmt: VmafPixelFormat,
154        bpc: ::std::os::raw::c_uint,
155        w: ::std::os::raw::c_uint,
156        h: ::std::os::raw::c_uint,
157    ) -> ::std::os::raw::c_int;
158}
159unsafe extern "C" {
160    pub fn vmaf_picture_unref(pic: *mut VmafPicture) -> ::std::os::raw::c_int;
161}
162pub const VmafLogLevel_VMAF_LOG_LEVEL_NONE: VmafLogLevel = 0;
163pub const VmafLogLevel_VMAF_LOG_LEVEL_ERROR: VmafLogLevel = 1;
164pub const VmafLogLevel_VMAF_LOG_LEVEL_WARNING: VmafLogLevel = 2;
165pub const VmafLogLevel_VMAF_LOG_LEVEL_INFO: VmafLogLevel = 3;
166pub const VmafLogLevel_VMAF_LOG_LEVEL_DEBUG: VmafLogLevel = 4;
167pub type VmafLogLevel = ::std::os::raw::c_uint;
168pub const VmafOutputFormat_VMAF_OUTPUT_FORMAT_NONE: VmafOutputFormat = 0;
169pub const VmafOutputFormat_VMAF_OUTPUT_FORMAT_XML: VmafOutputFormat = 1;
170pub const VmafOutputFormat_VMAF_OUTPUT_FORMAT_JSON: VmafOutputFormat = 2;
171pub const VmafOutputFormat_VMAF_OUTPUT_FORMAT_CSV: VmafOutputFormat = 3;
172pub const VmafOutputFormat_VMAF_OUTPUT_FORMAT_SUB: VmafOutputFormat = 4;
173pub type VmafOutputFormat = ::std::os::raw::c_uint;
174pub const VmafPoolingMethod_VMAF_POOL_METHOD_UNKNOWN: VmafPoolingMethod = 0;
175pub const VmafPoolingMethod_VMAF_POOL_METHOD_MIN: VmafPoolingMethod = 1;
176pub const VmafPoolingMethod_VMAF_POOL_METHOD_MAX: VmafPoolingMethod = 2;
177pub const VmafPoolingMethod_VMAF_POOL_METHOD_MEAN: VmafPoolingMethod = 3;
178pub const VmafPoolingMethod_VMAF_POOL_METHOD_HARMONIC_MEAN: VmafPoolingMethod = 4;
179pub const VmafPoolingMethod_VMAF_POOL_METHOD_NB: VmafPoolingMethod = 5;
180pub type VmafPoolingMethod = ::std::os::raw::c_uint;
181#[doc = " @struct VmafConfiguration\n @brief  Configuration needed to initialize a `VmafContext`\n\n @param log_level   How verbose the logger is.\n\n @param n_threads   How many threads can be used to run\n                    feature extractors concurrently.\n\n @param n_subsample Compute scores only every N frames.\n                    Note that setting an even value for N can lead to\n                    inaccurate results. For more detail, see\n                    https://github.com/Netflix/vmaf/issues/1214\n\n @param cpumask     Restrict permitted CPU instruction sets.\n                    if cpumask & 1:  disable SSE2 / disable NEON (on arm64)\n                    if cpumask & 2:  disable SSE3/SSSE3\n                    if cpumask & 4:  disable SSE4.1\n                    if cpumask & 8:  disable AVX2\n                    if cpumask & 16: disable AVX512\n                    if cpumask & 32: disable AVX512ICL\n\n @param gpumask     Restrict permitted GPU operations.\n                    if gpumask: disable CUDA"]
182#[repr(C)]
183#[derive(Debug, Copy, Clone)]
184pub struct VmafConfiguration {
185    pub log_level: VmafLogLevel,
186    pub n_threads: ::std::os::raw::c_uint,
187    pub n_subsample: ::std::os::raw::c_uint,
188    pub cpumask: u64,
189    pub gpumask: u64,
190}
191#[repr(C)]
192#[derive(Debug, Copy, Clone)]
193pub struct VmafContext {
194    _unused: [u8; 0],
195}
196unsafe extern "C" {
197    #[doc = " Allocate and open a VMAF instance.\n\n @param vmaf The VMAF instance to open.\n             To be used in further libvmaf api calls.\n             $vmaf will be set to the allocated context.\n             Context should be cleaned up with `vmaf_close()` when finished.\n\n @param cfg  Configuration parameters.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
198    pub fn vmaf_init(vmaf: *mut *mut VmafContext, cfg: VmafConfiguration) -> ::std::os::raw::c_int;
199}
200unsafe extern "C" {
201    #[doc = " Register feature extractors required by a specific `VmafModel`.\n This may be called multiple times using different models.\n In this case, the registered feature extractors will form a set, and any\n features required by multiple models will only be extracted once.\n\n @param vmaf  The VMAF context allocated with `vmaf_init()`.\n\n @param model Opaque model context.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
202    pub fn vmaf_use_features_from_model(
203        vmaf: *mut VmafContext,
204        model: *mut VmafModel,
205    ) -> ::std::os::raw::c_int;
206}
207unsafe extern "C" {
208    #[doc = " Register feature extractors required by a specific `VmafModelCollection`\n Like `vmaf_use_features_from_model()`, this function may be called\n multiple times using different model collections.\n\n @param vmaf             The VMAF context allocated with `vmaf_init()`.\n\n @param model_collection Opaque model collection context.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
209    pub fn vmaf_use_features_from_model_collection(
210        vmaf: *mut VmafContext,
211        model_collection: *mut VmafModelCollection,
212    ) -> ::std::os::raw::c_int;
213}
214unsafe extern "C" {
215    #[doc = " Register specific feature extractor.\n Useful when a specific/additional feature is required, usually one which\n is not already provided by a model via `vmaf_use_features_from_model()`.\n This may be called multiple times. `VmafContext` will take ownership of the\n `VmafFeatureDictionary` (`opts_dict`). Use `vmaf_feature_dictionary_free()`\n only in the case of failure.\n\n @param vmaf         The VMAF context allocated with `vmaf_init()`.\n\n @param feature_name Name of feature.\n\n @param opts_dict    Feature extractor options set via\n                     `vmaf_feature_dictionary_set()`. If no special options\n                     are required this parameter can be set to NULL.\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
216    pub fn vmaf_use_feature(
217        vmaf: *mut VmafContext,
218        feature_name: *const ::std::os::raw::c_char,
219        opts_dict: *mut VmafFeatureDictionary,
220    ) -> ::std::os::raw::c_int;
221}
222unsafe extern "C" {
223    #[doc = " Import an external feature score.\n Useful when pre-computed feature scores are available.\n Also useful in the case where there is no libvmaf feature extractor\n implementation for a required feature.\n\n @param vmaf         The VMAF context allocated with `vmaf_init()`.\n\n @param feature_name Name of feature.\n\n @param value        Score.\n\n @param index        Picture index.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
224    pub fn vmaf_import_feature_score(
225        vmaf: *mut VmafContext,
226        feature_name: *const ::std::os::raw::c_char,
227        value: f64,
228        index: ::std::os::raw::c_uint,
229    ) -> ::std::os::raw::c_int;
230}
231unsafe extern "C" {
232    #[doc = " Read a pair of pictures and queue them for eventual feature extraction.\n This should be called after feature extractors are registered via\n `vmaf_use_features_from_model()` and/or `vmaf_use_feature()`.\n `VmafContext` will take ownership of both `VmafPicture`s (`ref` and `dist`)\n and `vmaf_picture_unref()`.\n\n When you're done reading pictures call this function again with both `ref`\n and `dist` set to NULL to flush all feature extractors.\n\n @param vmaf  The VMAF context allocated with `vmaf_init()`.\n\n @param ref   Reference picture.\n\n @param dist  Distorted picture.\n\n @param index Picture index.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
233    pub fn vmaf_read_pictures(
234        vmaf: *mut VmafContext,
235        ref_: *mut VmafPicture,
236        dist: *mut VmafPicture,
237        index: ::std::os::raw::c_uint,
238    ) -> ::std::os::raw::c_int;
239}
240unsafe extern "C" {
241    #[doc = " Predict VMAF score at specific index.\n\n @param vmaf   The VMAF context allocated with `vmaf_init()`.\n\n @param model  Opaque model context.\n\n @param index  Picture index.\n\n @param score  Predicted score.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
242    pub fn vmaf_score_at_index(
243        vmaf: *mut VmafContext,
244        model: *mut VmafModel,
245        score: *mut f64,
246        index: ::std::os::raw::c_uint,
247    ) -> ::std::os::raw::c_int;
248}
249unsafe extern "C" {
250    #[doc = " Predict VMAF score at specific index, using a model collection.\n\n @param vmaf              The VMAF context allocated with `vmaf_init()`.\n\n @param model_collection  Opaque model collection context.\n\n @param index             Picture index.\n\n @param score             Predicted score.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
251    pub fn vmaf_score_at_index_model_collection(
252        vmaf: *mut VmafContext,
253        model_collection: *mut VmafModelCollection,
254        score: *mut VmafModelCollectionScore,
255        index: ::std::os::raw::c_uint,
256    ) -> ::std::os::raw::c_int;
257}
258unsafe extern "C" {
259    #[doc = " Fetch feature score at specific index.\n\n @param vmaf          The VMAF context allocated with `vmaf_init()`.\n\n @param feature_name  Name of the feature to fetch.\n\n @param index         Picture index.\n\n @param score         Score.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
260    pub fn vmaf_feature_score_at_index(
261        vmaf: *mut VmafContext,
262        feature_name: *const ::std::os::raw::c_char,
263        score: *mut f64,
264        index: ::std::os::raw::c_uint,
265    ) -> ::std::os::raw::c_int;
266}
267unsafe extern "C" {
268    #[doc = " Pooled VMAF score for a specific interval.\n\n @param vmaf         The VMAF context allocated with `vmaf_init()`.\n\n @param model        Opaque model context.\n\n @param pool_method  Temporal pooling method to use.\n\n @param score        Pooled score.\n\n @param index_low    Low picture index of pooling interval.\n\n @param index_high   High picture index of pooling interval.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
269    pub fn vmaf_score_pooled(
270        vmaf: *mut VmafContext,
271        model: *mut VmafModel,
272        pool_method: VmafPoolingMethod,
273        score: *mut f64,
274        index_low: ::std::os::raw::c_uint,
275        index_high: ::std::os::raw::c_uint,
276    ) -> ::std::os::raw::c_int;
277}
278unsafe extern "C" {
279    #[doc = " Pooled VMAF score for a specific interval, using a model collection.\n\n @param vmaf              The VMAF context allocated with `vmaf_init()`.\n\n @param model_collection  Opaque model collection context.\n\n @param pool_method       Temporal pooling method to use.\n\n @param score             Pooled score.\n\n @param index_low         Low picture index of pooling interval.\n\n @param index_high        High picture index of pooling interval.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
280    pub fn vmaf_score_pooled_model_collection(
281        vmaf: *mut VmafContext,
282        model_collection: *mut VmafModelCollection,
283        pool_method: VmafPoolingMethod,
284        score: *mut VmafModelCollectionScore,
285        index_low: ::std::os::raw::c_uint,
286        index_high: ::std::os::raw::c_uint,
287    ) -> ::std::os::raw::c_int;
288}
289unsafe extern "C" {
290    #[doc = " Pooled feature score for a specific interval.\n\n @param vmaf          The VMAF context allocated with `vmaf_init()`.\n\n @param feature_name  Name of the feature to fetch.\n\n @param pool_method   Temporal pooling method to use.\n\n @param score         Pooled score.\n\n @param index_low     Low picture index of pooling interval.\n\n @param index_high    High picture index of pooling interval.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
291    pub fn vmaf_feature_score_pooled(
292        vmaf: *mut VmafContext,
293        feature_name: *const ::std::os::raw::c_char,
294        pool_method: VmafPoolingMethod,
295        score: *mut f64,
296        index_low: ::std::os::raw::c_uint,
297        index_high: ::std::os::raw::c_uint,
298    ) -> ::std::os::raw::c_int;
299}
300#[doc = " Picture Pool Configuration"]
301#[repr(C)]
302#[derive(Debug, Copy, Clone)]
303pub struct VmafPictureConfiguration {
304    pub pic_params: VmafPictureConfiguration__bindgen_ty_1,
305    pub pic_cnt: ::std::os::raw::c_uint,
306}
307#[repr(C)]
308#[derive(Debug, Copy, Clone)]
309pub struct VmafPictureConfiguration__bindgen_ty_1 {
310    pub w: ::std::os::raw::c_uint,
311    pub h: ::std::os::raw::c_uint,
312    pub bpc: ::std::os::raw::c_uint,
313    pub pix_fmt: VmafPixelFormat,
314}
315unsafe extern "C" {
316    #[doc = " Preallocate pictures for use with multi-threaded feature extraction.\n Pictures are allocated once and automatically returned to the pool when\n fully unref'd, avoiding repeated allocation/deallocation overhead.\n\n @param vmaf VMAF context allocated with `vmaf_init()`.\n\n @param cfg  Picture configuration including dimensions and pool size.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
317    pub fn vmaf_preallocate_pictures(
318        vmaf: *mut VmafContext,
319        cfg: VmafPictureConfiguration,
320    ) -> ::std::os::raw::c_int;
321}
322unsafe extern "C" {
323    #[doc = " Fetch a preallocated picture from the picture pool.\n The picture must be returned to the pool via vmaf_picture_unref() when done.\n Pictures automatically return to the pool when their reference count reaches zero.\n\n @param vmaf VMAF context initialized with `vmaf_preallocate_pictures()`.\n\n @param pic  Output picture from the pool.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
324    pub fn vmaf_fetch_preallocated_picture(
325        vmaf: *mut VmafContext,
326        pic: *mut VmafPicture,
327    ) -> ::std::os::raw::c_int;
328}
329unsafe extern "C" {
330    #[doc = " Close a VMAF instance and free all associated memory.\n\n @param vmaf The VMAF instance to close.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
331    pub fn vmaf_close(vmaf: *mut VmafContext) -> ::std::os::raw::c_int;
332}
333unsafe extern "C" {
334    #[doc = " Write VMAF stats to an output file.\n\n @param vmaf         The VMAF context allocated with `vmaf_init()`.\n\n @param output_path  Output file path.\n\n @param fmt          Output file format.\n                     See `enum VmafOutputFormat` for options.\n\n\n @return 0 on success, or < 0 (a negative errno code) on error."]
335    pub fn vmaf_write_output(
336        vmaf: *mut VmafContext,
337        output_path: *const ::std::os::raw::c_char,
338        fmt: VmafOutputFormat,
339    ) -> ::std::os::raw::c_int;
340}
341unsafe extern "C" {
342    #[doc = " Get libvmaf version."]
343    pub fn vmaf_version() -> *const ::std::os::raw::c_char;
344}