Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose builtin models #1129

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions libvmaf/include/libvmaf/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ typedef struct VmafModelCollectionScore {
} bootstrap;
} VmafModelCollectionScore;

typedef struct VmafBuiltInModel {
const char *version;
const char *data;
const int *data_len;
} VmafBuiltInModel;
ThatNerdUKnow marked this conversation as resolved.
Show resolved Hide resolved

/**
* Iterate through all built in vmaf models
*
* @param prev previous model. NULL to get the first model
*
* @return next model or NULL after the last model
*
*/
const VmafBuiltInModel *vmaf_built_in_model_next(const VmafBuiltInModel *prev);

int vmaf_model_collection_load(VmafModel **model,
VmafModelCollection **model_collection,
VmafModelConfig *cfg,
Expand Down
13 changes: 7 additions & 6 deletions libvmaf/src/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
#include "read_json_model.h"
#include "svm.h"

typedef struct VmafBuiltInModel {
const char *version;
const char *data;
const int *data_len;
} VmafBuiltInModel;

#if VMAF_BUILT_IN_MODELS
#if VMAF_FLOAT_FEATURES
extern const char src_vmaf_float_v0_6_1neg_json;
Expand Down Expand Up @@ -316,3 +310,10 @@ int vmaf_model_collection_feature_overload(VmafModel *model,
return err;
}

const VmafBuiltInModel *vmaf_built_in_model_next(const VmafBuiltInModel *prev){
ThatNerdUKnow marked this conversation as resolved.
Show resolved Hide resolved
if(!prev)
return &built_in_models[0];
if(prev - built_in_models < BUILT_IN_MODEL_CNT)
return prev + 1;
return NULL;
}
10 changes: 10 additions & 0 deletions libvmaf/src/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ typedef struct VmafModelCollection {
const char *name;
} VmafModelCollection;

/**
* Iterate through all built in vmaf models
*
* @param prev previous model. NULL to get the first model
*
* @return next model or NULL after the last model
*
*/
const VmafBuiltInModel *vmaf_built_in_model_next(const VmafBuiltInModel *prev);

char *vmaf_model_generate_name(VmafModelConfig *cfg);

int vmaf_model_collection_append(VmafModelCollection **model_collection,
Expand Down