mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-09 16:57:30 +09:00
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
This commit is contained in:
parent
bb61121b44
commit
48f6d2e034
1087 changed files with 154333 additions and 265310 deletions
28
third_party/aom/av1/encoder/palette.c
vendored
28
third_party/aom/av1/encoder/palette.c
vendored
|
|
@ -23,16 +23,14 @@
|
|||
#include "av1/encoder/k_means_template.h"
|
||||
#undef AV1_K_MEANS_DIM
|
||||
|
||||
static int float_comparer(const void *a, const void *b) {
|
||||
const float fa = *(const float *)a;
|
||||
const float fb = *(const float *)b;
|
||||
return (fa > fb) - (fa < fb);
|
||||
static int int_comparer(const void *a, const void *b) {
|
||||
return (*(int *)a - *(int *)b);
|
||||
}
|
||||
|
||||
int av1_remove_duplicates(float *centroids, int num_centroids) {
|
||||
int av1_remove_duplicates(int *centroids, int num_centroids) {
|
||||
int num_unique; // number of unique centroids
|
||||
int i;
|
||||
qsort(centroids, num_centroids, sizeof(*centroids), float_comparer);
|
||||
qsort(centroids, num_centroids, sizeof(*centroids), int_comparer);
|
||||
// Remove duplicates.
|
||||
num_unique = 1;
|
||||
for (i = 1; i < num_centroids; ++i) {
|
||||
|
|
@ -43,7 +41,6 @@ int av1_remove_duplicates(float *centroids, int num_centroids) {
|
|||
return num_unique;
|
||||
}
|
||||
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
static int delta_encode_cost(const int *colors, int num, int bit_depth,
|
||||
int min_val) {
|
||||
if (num <= 0) return 0;
|
||||
|
|
@ -116,15 +113,11 @@ int av1_get_palette_delta_bits_v(const PALETTE_MODE_INFO *const pmi,
|
|||
}
|
||||
return AOMMAX(av1_ceil_log2(max_d + 1), *min_bits);
|
||||
}
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
|
||||
int av1_palette_color_cost_y(const PALETTE_MODE_INFO *const pmi,
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
uint16_t *color_cache, int n_cache,
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
int bit_depth) {
|
||||
const int n = pmi->palette_size[0];
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
int out_cache_colors[PALETTE_MAX_SIZE];
|
||||
uint8_t cache_color_found[2 * PALETTE_MAX_SIZE];
|
||||
const int n_out_cache =
|
||||
|
|
@ -132,19 +125,13 @@ int av1_palette_color_cost_y(const PALETTE_MODE_INFO *const pmi,
|
|||
cache_color_found, out_cache_colors);
|
||||
const int total_bits =
|
||||
n_cache + delta_encode_cost(out_cache_colors, n_out_cache, bit_depth, 1);
|
||||
return total_bits * av1_cost_bit(128, 0);
|
||||
#else
|
||||
return bit_depth * n * av1_cost_bit(128, 0);
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
return av1_cost_literal(total_bits);
|
||||
}
|
||||
|
||||
int av1_palette_color_cost_uv(const PALETTE_MODE_INFO *const pmi,
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
uint16_t *color_cache, int n_cache,
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
int bit_depth) {
|
||||
const int n = pmi->palette_size[1];
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
int total_bits = 0;
|
||||
// U channel palette color cost.
|
||||
int out_cache_colors[PALETTE_MAX_SIZE];
|
||||
|
|
@ -163,8 +150,5 @@ int av1_palette_color_cost_uv(const PALETTE_MODE_INFO *const pmi,
|
|||
2 + bit_depth + (bits_v + 1) * (n - 1) - zero_count;
|
||||
const int bits_using_raw = bit_depth * n;
|
||||
total_bits += 1 + AOMMIN(bits_using_delta, bits_using_raw);
|
||||
return total_bits * av1_cost_bit(128, 0);
|
||||
#else
|
||||
return 2 * bit_depth * n * av1_cost_bit(128, 0);
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
return av1_cost_literal(total_bits);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue