mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-09 16:57:30 +09:00
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
This commit is contained in:
parent
debbee1e2a
commit
992c6637e3
429 changed files with 76047 additions and 40937 deletions
40
third_party/aom/av1/encoder/palette.h
vendored
40
third_party/aom/av1/encoder/palette.h
vendored
|
|
@ -18,17 +18,49 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AV1_K_MEANS_RENAME(func, dim) func##_dim##dim
|
||||
|
||||
void AV1_K_MEANS_RENAME(av1_calc_indices, 1)(const float *data,
|
||||
const float *centroids,
|
||||
uint8_t *indices, int n, int k);
|
||||
void AV1_K_MEANS_RENAME(av1_calc_indices, 2)(const float *data,
|
||||
const float *centroids,
|
||||
uint8_t *indices, int n, int k);
|
||||
void AV1_K_MEANS_RENAME(av1_k_means, 1)(const float *data, float *centroids,
|
||||
uint8_t *indices, int n, int k,
|
||||
int max_itr);
|
||||
void AV1_K_MEANS_RENAME(av1_k_means, 2)(const float *data, float *centroids,
|
||||
uint8_t *indices, int n, int k,
|
||||
int max_itr);
|
||||
|
||||
// Given 'n' 'data' points and 'k' 'centroids' each of dimension 'dim',
|
||||
// calculate the centroid 'indices' for the data points.
|
||||
void av1_calc_indices(const float *data, const float *centroids,
|
||||
uint8_t *indices, int n, int k, int dim);
|
||||
static INLINE void av1_calc_indices(const float *data, const float *centroids,
|
||||
uint8_t *indices, int n, int k, int dim) {
|
||||
if (dim == 1) {
|
||||
AV1_K_MEANS_RENAME(av1_calc_indices, 1)(data, centroids, indices, n, k);
|
||||
} else if (dim == 2) {
|
||||
AV1_K_MEANS_RENAME(av1_calc_indices, 2)(data, centroids, indices, n, k);
|
||||
} else {
|
||||
assert(0 && "Untemplated k means dimension");
|
||||
}
|
||||
}
|
||||
|
||||
// Given 'n' 'data' points and an initial guess of 'k' 'centroids' each of
|
||||
// dimension 'dim', runs up to 'max_itr' iterations of k-means algorithm to get
|
||||
// updated 'centroids' and the centroid 'indices' for elements in 'data'.
|
||||
// Note: the output centroids are rounded off to nearest integers.
|
||||
void av1_k_means(const float *data, float *centroids, uint8_t *indices, int n,
|
||||
int k, int dim, int max_itr);
|
||||
static INLINE void av1_k_means(const float *data, float *centroids,
|
||||
uint8_t *indices, int n, int k, int dim,
|
||||
int max_itr) {
|
||||
if (dim == 1) {
|
||||
AV1_K_MEANS_RENAME(av1_k_means, 1)(data, centroids, indices, n, k, max_itr);
|
||||
} else if (dim == 2) {
|
||||
AV1_K_MEANS_RENAME(av1_k_means, 2)(data, centroids, indices, n, k, max_itr);
|
||||
} else {
|
||||
assert(0 && "Untemplated k means dimension");
|
||||
}
|
||||
}
|
||||
|
||||
// Given a list of centroids, returns the unique number of centroids 'k', and
|
||||
// puts these unique centroids in first 'k' indices of 'centroids' array.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue