Skip to content

Commit

Permalink
refactor: revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiğithan Yiğit authored and nilfm99 committed Jan 29, 2025
1 parent 3115536 commit 855d7aa
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 71 deletions.
39 changes: 0 additions & 39 deletions libvmaf/include/libvmaf/libvmaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ int vmaf_feature_score_at_index(VmafContext *vmaf, const char *feature_name,
* Metadata structure.
*
* @param feature_name Name of the feature to fetch.
* vmaf going to take ownership of this string.
*
* @param picture_index Picture index.
*
Expand Down Expand Up @@ -286,31 +285,6 @@ typedef struct VmafMetadataConfiguration {
void *data;
} VmafMetadataConfiguration;


/**
* Metadata flags.
*
* Features can provide additional metrics about the score. To propagate those,
* the `VmafMetadataFlags` enum should be used for specifying which information should be
* propagated to the metadata.
*
* @param VMAF_METADATA_FLAG_NONE No flags.
*
* @param VMAF_METADATA_FLAG_FEATURE Include all indivual metrics.
*
* @param VMAF_METADATA_FLAG_MODEL Propagate only model score.
*
* @param VMAF_METADATA_FLAG_FEATURE_NAME Propagate only given feature name..
*
*/

enum VmafMetadataFlags {
VMAF_METADATA_FLAG_NONE = 0,
VMAF_METADATA_FLAG_FEATURE = 1 << 0,
VMAF_METADATA_FLAG_MODEL = 1 << 1,
VMAF_METADATA_FLAG_FEATURE_NAME = 1 << 2,
};

/**
* Register a callback to receive VMAF metadata.
*
Expand All @@ -324,19 +298,6 @@ enum VmafMetadataFlags {

int vmaf_register_metadata_handler(VmafContext *vmaf, VmafMetadataConfiguration cfg);

/**
* Get the number of registered metadata handlers.
*
* @param vmaf The VMAF context allocated with `vmaf_init()`.
*
* @param count Number of registered metadata handlers.
*
*
* @return 0 on success, or < 0 (a negative errno code) on error.
*/

int vmaf_get_metadata_handler_count(VmafContext *vmaf, unsigned *count);

/**
* Pooled VMAF score for a specific interval.
*
Expand Down
19 changes: 0 additions & 19 deletions libvmaf/src/feature/feature_collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,25 +296,6 @@ int vmaf_feature_collector_register_metadata(VmafFeatureCollector *feature_colle
return 0;
}

int vmaf_feature_collector_get_metadata_count(VmafFeatureCollector *feature_collector,
unsigned *count)
{
if (!feature_collector) return -EINVAL;
if (!count) return -EINVAL;

VmafCallbackList *metadata = feature_collector->metadata;
unsigned cnt = 0;
VmafCallbackItem *iter = metadata ? metadata->head : NULL;
while (iter) {
cnt++;
iter = iter->next;
}

*count = cnt;

return 0;
}

static FeatureVector *find_feature_vector(VmafFeatureCollector *fc,
const char *feature_name)
{
Expand Down
8 changes: 0 additions & 8 deletions libvmaf/src/libvmaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,6 @@ int vmaf_register_metadata_handler(VmafContext *vmaf, VmafMetadataConfiguration
return vmaf_feature_collector_register_metadata(vmaf->feature_collector, cfg);
}

int vmaf_get_metadata_handler_count(VmafContext *vmaf, unsigned *count)
{
if (!vmaf) return -EINVAL;
if (!count) return -EINVAL;

return vmaf_feature_collector_get_metadata_count(vmaf->feature_collector, count);
}

int vmaf_feature_score_at_index(VmafContext *vmaf, const char *feature_name,
double *score, unsigned index)
{
Expand Down
2 changes: 0 additions & 2 deletions libvmaf/src/metadata_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ int vmaf_metadata_destroy(VmafCallbackList *metadata)
VmafCallbackItem *iter = metadata->head;
while (iter) {
VmafCallbackItem *next = iter->next;
if (iter->metadata_cfg.feature_name)
free(iter->metadata_cfg.feature_name);
free(iter);
iter = next;
}
Expand Down
6 changes: 3 additions & 3 deletions libvmaf/test/test_predict.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static char* test_propagate_metadata()
};

VmafMetadataConfiguration m = {
.feature_name = strdup("vmaf"),
.feature_name = "vmaf",
.callback = set_meta,
.data = &meta_data,
};
Expand Down Expand Up @@ -146,7 +146,7 @@ static char* test_propagate_metadata()
vmaf_feature_collector_destroy(feature_collector);

m.data = NULL;
m.feature_name = strdup("vmaf");
m.feature_name = "vmaf";
err = vmaf_feature_collector_init(&feature_collector);
mu_assert("problem during vmaf_feature_collector_init", !err);

Expand All @@ -162,7 +162,7 @@ static char* test_propagate_metadata()
vmaf_feature_collector_destroy(feature_collector);

m.callback = NULL;
m.feature_name = strdup("vmaf");
m.feature_name = "vmaf";
err = vmaf_feature_collector_init(&feature_collector);
mu_assert("problem during vmaf_feature_collector_init", !err);

Expand Down

0 comments on commit 855d7aa

Please sign in to comment.