| /* |
| * Copyright (c) 2021, Alliance for Open Media. All rights reserved |
| * |
| * This source code is subject to the terms of the BSD 3-Clause Clear License |
| * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear |
| * License was not distributed with this source code in the LICENSE file, you |
| * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the |
| * Alliance for Open Media Patent License 1.0 was not distributed with this |
| * source code in the PATENTS file, you can obtain it at |
| * aomedia.org/license/patent-license/. |
| */ |
| |
| // This tool is a gadget for offline probability training. |
| // A binary executable aom_entropy_optimizer will be generated in tools/. It |
| // parses a binary file consisting of counts written in the format of |
| // FRAME_COUNTS in entropymode.h, and computes optimized probability tables |
| // and CDF tables, which will be written to a new c file optimized_probs.c |
| // according to format in the codebase. |
| // |
| // Command line: ./aom_entropy_optimizer [directory of the count file] |
| // |
| // The input file can either be generated by encoding a single clip by |
| // turning on entropy_stats experiment, or be collected at a larger scale at |
| // which a python script which will be provided soon can be used to aggregate |
| // multiple stats output. |
| |
| #include <assert.h> |
| #include <stdio.h> |
| |
| #include "av1/common/enums.h" |
| #include "config/aom_config.h" |
| |
| #include "av1/encoder/encoder.h" |
| |
| #define STRING_MAX 2048 // should be large but limited to copy CDF name |
| #define SPACES_PER_TAB 2 |
| #define CDF_MAX_SIZE 16 |
| |
| typedef unsigned int aom_count_type; |
| // A log file recording parsed counts |
| static FILE *logfile; // TODO(yuec): make it a command line option |
| |
| static void counts_to_cdf(const aom_count_type *counts, aom_cdf_prob *cdf, |
| int modes) { |
| int64_t csum[CDF_MAX_SIZE]; |
| assert(modes <= CDF_MAX_SIZE); |
| |
| csum[0] = counts[0] + 1; |
| for (int i = 1; i < modes; ++i) csum[i] = counts[i] + 1 + csum[i - 1]; |
| |
| for (int i = 0; i < modes; ++i) fprintf(logfile, "%d ", counts[i]); |
| fprintf(logfile, "\n"); |
| |
| int64_t sum = csum[modes - 1]; |
| const int64_t round_shift = sum >> 1; |
| for (int i = 0; i < modes; ++i) { |
| cdf[i] = (csum[i] * CDF_PROB_TOP + round_shift) / sum; |
| cdf[i] = AOMMIN(cdf[i], CDF_PROB_TOP - (modes - 1 + i) * 4); |
| cdf[i] = (i == 0) ? AOMMAX(cdf[i], 4) : AOMMAX(cdf[i], cdf[i - 1] + 4); |
| } |
| } |
| |
| static int parse_counts_for_cdf_opt(aom_count_type **ct_ptr, |
| FILE *const probsfile, int tabs, |
| int dim_of_cts, int *cts_each_dim) { |
| if (dim_of_cts < 1) { |
| fprintf(stderr, "The dimension of a counts vector should be at least 1!\n"); |
| return 1; |
| } |
| const int total_modes = cts_each_dim[0]; |
| if (dim_of_cts == 1) { |
| assert(total_modes <= CDF_MAX_SIZE); |
| aom_cdf_prob cdfs[CDF_MAX_SIZE]; |
| aom_count_type *counts1d = *ct_ptr; |
| |
| counts_to_cdf(counts1d, cdfs, total_modes); |
| (*ct_ptr) += total_modes; |
| |
| if (tabs > 0) fprintf(probsfile, "%*c", tabs * SPACES_PER_TAB, ' '); |
| fprintf(probsfile, "AOM_CDF%d(", total_modes); |
| for (int k = 0; k < total_modes - 1; ++k) { |
| fprintf(probsfile, "%d", cdfs[k]); |
| if (k < total_modes - 2) fprintf(probsfile, ", "); |
| } |
| fprintf(probsfile, ")"); |
| } else { |
| for (int k = 0; k < total_modes; ++k) { |
| int tabs_next_level; |
| |
| if (dim_of_cts == 2) |
| fprintf(probsfile, "%*c{ ", tabs * SPACES_PER_TAB, ' '); |
| else |
| fprintf(probsfile, "%*c{\n", tabs * SPACES_PER_TAB, ' '); |
| tabs_next_level = dim_of_cts == 2 ? 0 : tabs + 1; |
| |
| if (parse_counts_for_cdf_opt(ct_ptr, probsfile, tabs_next_level, |
| dim_of_cts - 1, cts_each_dim + 1)) { |
| return 1; |
| } |
| |
| if (dim_of_cts == 2) { |
| if (k == total_modes - 1) |
| fprintf(probsfile, " }\n"); |
| else |
| fprintf(probsfile, " },\n"); |
| } else { |
| if (k == total_modes - 1) |
| fprintf(probsfile, "%*c}\n", tabs * SPACES_PER_TAB, ' '); |
| else |
| fprintf(probsfile, "%*c},\n", tabs * SPACES_PER_TAB, ' '); |
| } |
| } |
| } |
| return 0; |
| } |
| |
| // helper function to estimate RAM/ROM memory for CDfs/sytax entries |
| // only called when --memory is given as an input to the program |
| static void count_memory(int *cts_each_dim, int dim_of_cts, char *prefix, |
| int has_rom_multiplier, int *total_count, int *dim_arr, |
| int minus_entries, char *cdf_category) { |
| int mfactor = 15; // number of bits used per context per symbol - 1 |
| int moffset = 5; // bits offset for RAM |
| int tot_count = 1; // total bit counts per syntax |
| int ctx_count = 0; // total context count per syntax |
| #if CONFIG_ENTROPY_PARA |
| int para_bits = 9; // additional ROM bits needed by PARA |
| #endif |
| |
| if (dim_arr == NULL) { |
| int dim_last = cts_each_dim[dim_of_cts - 1]; |
| for (int i = 0; i < dim_of_cts - 1; i++) { |
| tot_count *= cts_each_dim[i]; |
| } |
| tot_count -= minus_entries; |
| ctx_count = tot_count; |
| tot_count = tot_count * ((dim_last - 1) * mfactor + moffset); |
| } else { |
| int total_entries = 0; |
| if (dim_of_cts == 4) { |
| ctx_count += cts_each_dim[0] * cts_each_dim[1] * cts_each_dim[2]; |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| for (int d2_idx = 0; d2_idx < cts_each_dim[2]; ++d2_idx) { |
| int num_of_modes = dim_arr[d0_idx]; |
| if (num_of_modes > 0) { |
| total_entries += ((num_of_modes - 1) * mfactor + moffset); |
| } |
| } |
| } |
| } |
| tot_count = total_entries; |
| } else if (dim_of_cts == 3) { |
| ctx_count += cts_each_dim[0] * cts_each_dim[1]; |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| int num_of_modes = dim_arr[d0_idx]; |
| if (num_of_modes > 0) { |
| total_entries += ((num_of_modes - 1) * mfactor + moffset); |
| } |
| } |
| } |
| tot_count = total_entries; |
| } |
| } |
| |
| char string[STRING_MAX]; |
| strcpy(string, prefix); |
| char *subs = strstr(string, "_prob ") + 6; |
| char *token = strtok(subs, "["); |
| |
| if (subs != NULL) { |
| printf("%-48.48s ", token); |
| if (!has_rom_multiplier) { |
| printf("RAM %6d bits %-8.2f bytes %-5.2f kbytes ", tot_count, |
| ((float)tot_count) / 8.0, ((float)tot_count) / 8.0 / 1024.0); |
| #if CONFIG_ENTROPY_PARA |
| int rom_count = tot_count + ctx_count * para_bits; |
| printf("ROM %6d bits %-8.2f bytes %-5.2f kbytes ", rom_count, |
| ((float)rom_count) / 8.0, ((float)rom_count) / 8.0 / 1024.0); |
| #else |
| printf("ROM %6d bits %-8.2f bytes %-5.2f kbytes ", tot_count, |
| ((float)tot_count) / 8.0, ((float)tot_count) / 8.0 / 1024.0); |
| #endif |
| *total_count += tot_count; |
| } else { |
| printf("RAM %6d bits %-8.2f bytes %-5.2f kbytes ", tot_count / 4, |
| ((float)tot_count) / 8.0 / 4.0, |
| ((float)tot_count) / 8.0 / 1024.0 / 4); |
| #if CONFIG_ENTROPY_PARA |
| int rom_count = tot_count + ctx_count * para_bits; |
| printf("ROM %6d bits %-8.2f bytes %-5.2f kbytes ", rom_count, |
| ((float)rom_count) / 8.0, ((float)rom_count) / 8.0 / 1024.0); |
| #else |
| printf("ROM %6d bits %-8.2f bytes %-5.2f kbytes ", tot_count, |
| ((float)tot_count) / 8.0, ((float)tot_count) / 8.0 / 1024.0); |
| #endif |
| *total_count += tot_count / 4; |
| ctx_count /= 4; |
| } |
| printf(" CTXs %-4.1d %-4.12s \n", ctx_count, cdf_category); |
| } |
| } |
| |
| /* Optimize CDF entries with CDF memory counter |
| * counts : Pointer to relevent syntax counts from |
| * probsfile : Pointer to probability output |
| * dim_of_cts : Dimension of the CDF table including |
| * prefix : Prefix for CDF name as defined in the standard |
| * has_rom_multiplier : Whether the ROM counts need to be multiplied with |
| * TOKEN_Q_CDFS |
| * total_cnt : Variable to keep track of total bits across all syntax |
| * minus_entries : Some CDF tables have unused context entries that need |
| * to be subtracted simply count the unused contexts |
| * (excluding the symbol counts) |
| * mem_wanted : Whether to optimize CDF entries or run in |
| * memory computation mode instead |
| * cdf_category : Input char array to assign CDF to a category |
| */ |
| static void optimize_cdf_table(aom_count_type *counts, FILE *const probsfile, |
| int dim_of_cts, int *cts_each_dim, char *prefix, |
| int has_rom_multiplier, int *total_cnt, |
| int minus_entries, bool mem_wanted, |
| char *cdf_category) { |
| if (mem_wanted) { |
| count_memory(cts_each_dim, dim_of_cts, prefix, has_rom_multiplier, |
| total_cnt, NULL, minus_entries, cdf_category); |
| return; |
| } |
| |
| aom_count_type *ct_ptr = counts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| if (parse_counts_for_cdf_opt(&ct_ptr, probsfile, 1, dim_of_cts, |
| cts_each_dim)) { |
| fprintf(probsfile, "Optimizer failed!\n"); |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| #if !CONFIG_UV_CFL |
| static void optimize_uv_mode(aom_count_type *counts, FILE *const probsfile, |
| int dim_of_cts, int *cts_each_dim, char *prefix) { |
| aom_count_type *ct_ptr = counts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| fprintf(logfile, "%s\n", prefix); |
| cts_each_dim[2] = UV_INTRA_MODES - 1; |
| for (int k = 0; k < cts_each_dim[1]; ++k) { |
| fprintf(probsfile, "%*c{ ", 2 * SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, dim_of_cts - 2, |
| cts_each_dim + 2); |
| if (k + 1 == cts_each_dim[1]) { |
| fprintf(probsfile, " }\n"); |
| } else { |
| fprintf(probsfile, " },\n"); |
| } |
| ++ct_ptr; |
| } |
| fprintf(probsfile, "%*c},\n", SPACES_PER_TAB, ' '); |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| cts_each_dim[2] = UV_INTRA_MODES; |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 2, dim_of_cts - 1, |
| cts_each_dim + 1); |
| fprintf(probsfile, "%*c}\n", SPACES_PER_TAB, ' '); |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| #endif |
| |
| /* See optimize_cdf_table for usage. |
| modes_each_ctx: input symbol counts per each context row |
| */ |
| static void optimize_cdf_table_var_modes_2d(aom_count_type *counts, |
| FILE *const probsfile, |
| int dim_of_cts, int *cts_each_dim, |
| int *modes_each_ctx, char *prefix, |
| int has_rom_multiplier, |
| int *total_cnt, bool mem_wanted, |
| char *cdf_category) { |
| aom_count_type *ct_ptr = counts; |
| if (mem_wanted) { |
| count_memory(cts_each_dim, dim_of_cts, prefix, has_rom_multiplier, |
| total_cnt, modes_each_ctx, 0, cdf_category); |
| return; |
| } |
| assert(dim_of_cts == 2); |
| (void)dim_of_cts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| int num_of_modes = modes_each_ctx[d0_idx]; |
| |
| if (num_of_modes > 0) { |
| fprintf(probsfile, "%*c{ ", SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, 1, &num_of_modes); |
| ct_ptr += cts_each_dim[1] - num_of_modes; |
| fprintf(probsfile, " },\n"); |
| } else { |
| fprintf(probsfile, "%*c{ 0 },\n", SPACES_PER_TAB, ' '); |
| fprintf(logfile, "dummy cdf, no need to optimize\n"); |
| ct_ptr += cts_each_dim[1]; |
| } |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| /* See optimize_cdf_table for usage. |
| modes_each_ctx: input symbol counts per each context row |
| */ |
| static void optimize_cdf_table_var_modes_3d(aom_count_type *counts, |
| FILE *const probsfile, |
| int dim_of_cts, int *cts_each_dim, |
| int *modes_each_ctx, char *prefix, |
| int has_rom_multiplier, |
| int *total_cnt, bool mem_wanted, |
| char *cdf_category) { |
| if (mem_wanted) { |
| count_memory(cts_each_dim, dim_of_cts, prefix, has_rom_multiplier, |
| total_cnt, modes_each_ctx, 0, cdf_category); |
| return; |
| } |
| aom_count_type *ct_ptr = counts; |
| |
| assert(dim_of_cts == 3); |
| (void)dim_of_cts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| int num_of_modes = modes_each_ctx[d0_idx]; |
| |
| if (num_of_modes > 0) { |
| fprintf(probsfile, "%*c{ ", 2 * SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, 1, &num_of_modes); |
| ct_ptr += cts_each_dim[2] - num_of_modes; |
| fprintf(probsfile, " },\n"); |
| } else { |
| fprintf(probsfile, "%*c{ 0 },\n", 2 * SPACES_PER_TAB, ' '); |
| fprintf(logfile, "dummy cdf, no need to optimize\n"); |
| ct_ptr += cts_each_dim[2]; |
| } |
| } |
| fprintf(probsfile, "%*c},\n", SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| /* See optimize_cdf_table for usage. |
| modes_each_ctx: input symbol counts per each context row |
| */ |
| static void optimize_cdf_table_var_modes_4d(aom_count_type *counts, |
| FILE *const probsfile, |
| int dim_of_cts, int *cts_each_dim, |
| int *modes_each_ctx, char *prefix, |
| int has_rom_multiplier, |
| int *total_cnt, bool mem_wanted, |
| char *cdf_category) { |
| if (mem_wanted) { |
| count_memory(cts_each_dim, dim_of_cts, prefix, has_rom_multiplier, |
| total_cnt, modes_each_ctx, 0, cdf_category); |
| return; |
| } |
| aom_count_type *ct_ptr = counts; |
| |
| assert(dim_of_cts == 4); |
| (void)dim_of_cts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| fprintf(probsfile, "%*c{\n", 2 * SPACES_PER_TAB, ' '); |
| for (int d2_idx = 0; d2_idx < cts_each_dim[2]; ++d2_idx) { |
| int num_of_modes = modes_each_ctx[d0_idx]; |
| |
| if (num_of_modes > 0) { |
| fprintf(probsfile, "%*c{ ", 3 * SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, 1, &num_of_modes); |
| ct_ptr += cts_each_dim[3] - num_of_modes; |
| fprintf(probsfile, " },\n"); |
| } else { |
| fprintf(probsfile, "%*c{ 0 },\n", 3 * SPACES_PER_TAB, ' '); |
| fprintf(logfile, "dummy cdf, no need to optimize\n"); |
| ct_ptr += cts_each_dim[3]; |
| } |
| } |
| fprintf(probsfile, "%*c},\n", 2 * SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "%*c},\n", SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| // Like optimize_cdf_table_var_modes_3d, but the number of modes varies across |
| // the context dimension. |
| static void optimize_cdf_table_var_modes_3d_inner( |
| aom_count_type *counts, FILE *const probsfile, int dim_of_cts, |
| int *cts_each_dim, int *modes_each_ctx, char *prefix) { |
| aom_count_type *ct_ptr = counts; |
| |
| assert(dim_of_cts == 3); |
| (void)dim_of_cts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| int num_of_modes = modes_each_ctx[d1_idx]; |
| |
| if (num_of_modes > 0) { |
| fprintf(probsfile, "%*c{ ", 2 * SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, 1, &num_of_modes); |
| ct_ptr += cts_each_dim[2] - num_of_modes; |
| fprintf(probsfile, " },\n"); |
| } else { |
| fprintf(probsfile, "%*c{ 0 },\n", 2 * SPACES_PER_TAB, ' '); |
| fprintf(logfile, "dummy cdf, no need to optimize\n"); |
| ct_ptr += cts_each_dim[2]; |
| } |
| } |
| fprintf(probsfile, "%*c},\n", SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| // Like optimize_cdf_table_var_modes_4d, but the number of modes varies across |
| // the last dimension. |
| static void optimize_cdf_table_var_modes_4d_inner( |
| aom_count_type *counts, FILE *const probsfile, int dim_of_cts, |
| int *cts_each_dim, int *modes_each_ctx, char *prefix) { |
| aom_count_type *ct_ptr = counts; |
| |
| assert(dim_of_cts == 4); |
| (void)dim_of_cts; |
| |
| fprintf(probsfile, "%s = {\n", prefix); |
| fprintf(logfile, "%s\n", prefix); |
| |
| for (int d0_idx = 0; d0_idx < cts_each_dim[0]; ++d0_idx) { |
| fprintf(probsfile, "%*c{\n", SPACES_PER_TAB, ' '); |
| for (int d1_idx = 0; d1_idx < cts_each_dim[1]; ++d1_idx) { |
| fprintf(probsfile, "%*c{\n", 2 * SPACES_PER_TAB, ' '); |
| for (int d2_idx = 0; d2_idx < cts_each_dim[2]; ++d2_idx) { |
| int num_of_modes = modes_each_ctx[d2_idx]; |
| |
| if (num_of_modes > 0) { |
| fprintf(probsfile, "%*c{ ", 3 * SPACES_PER_TAB, ' '); |
| parse_counts_for_cdf_opt(&ct_ptr, probsfile, 0, 1, &num_of_modes); |
| ct_ptr += cts_each_dim[3] - num_of_modes; |
| fprintf(probsfile, " },\n"); |
| } else { |
| fprintf(probsfile, "%*c{ 0 },\n", 3 * SPACES_PER_TAB, ' '); |
| fprintf(logfile, "dummy cdf, no need to optimize\n"); |
| ct_ptr += cts_each_dim[3]; |
| } |
| } |
| fprintf(probsfile, "%*c},\n", 2 * SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "%*c},\n", SPACES_PER_TAB, ' '); |
| } |
| fprintf(probsfile, "};\n\n"); |
| fprintf(logfile, "============================\n"); |
| } |
| |
| int main(int argc, const char **argv) { |
| if (argc < 2) { |
| fprintf(stderr, "Please specify the input stats file! or type --memory\n"); |
| exit(EXIT_FAILURE); |
| } |
| |
| FRAME_COUNTS fc; |
| FILE *statsfile; |
| FILE *probsfile; |
| |
| const bool mem_wanted = !strcmp("--memory", argv[1]); |
| |
| if (mem_wanted) { |
| printf("Computing Syntax/CDF Memory, probability won't be optimized. \n"); |
| statsfile = NULL; |
| probsfile = NULL; |
| } else { |
| statsfile = fopen(argv[1], "rb"); |
| if (statsfile == NULL) { |
| fprintf(stderr, "Failed to open input stat file!\n"); |
| exit(EXIT_FAILURE); |
| } else { |
| const size_t bytes = fread(&fc, sizeof(FRAME_COUNTS), 1, statsfile); |
| if (!bytes) { |
| fclose(statsfile); |
| return 1; |
| } |
| } |
| probsfile = fopen("optimized_probs.c", "w"); |
| if (probsfile == NULL) { |
| fprintf(stderr, |
| "Failed to create output file for optimized entropy tables!\n"); |
| exit(EXIT_FAILURE); |
| } |
| logfile = fopen("aom_entropy_optimizer_parsed_counts.log", "w"); |
| if (logfile == NULL) { |
| fprintf(stderr, "Failed to create log file for parsed counts!\n"); |
| exit(EXIT_FAILURE); |
| } |
| } |
| |
| int cts_each_dim[10]; |
| int total_count = 0; |
| #if CONFIG_AIMC |
| cts_each_dim[0] = INTRA_MODE_SETS; |
| optimize_cdf_table(&fc.y_mode_set_idx[0], probsfile, 1, cts_each_dim, |
| "const aom_cdf_prob " |
| "default_y_mode_set_cdf[CDF_SIZE(INTRA_MODE_SETS)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| cts_each_dim[0] = Y_MODE_CONTEXTS; |
| cts_each_dim[1] = FIRST_MODE_COUNT; |
| optimize_cdf_table( |
| &fc.y_mode_idx_0[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob " |
| "default_y_first_mode_cdf[Y_MODE_CONTEXTS][CDF_SIZE(FIRST_MODE_COUNT)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| cts_each_dim[0] = Y_MODE_CONTEXTS; |
| cts_each_dim[1] = SECOND_MODE_COUNT; |
| optimize_cdf_table(&fc.y_mode_idx_1[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob " |
| "default_y_second_mode_cdf[Y_MODE_CONTEXTS][CDF_SIZE(" |
| "SECOND_MODE_COUNT)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #else |
| /* Intra mode (keyframe luma) */ |
| cts_each_dim[0] = KF_MODE_CONTEXTS; |
| cts_each_dim[1] = KF_MODE_CONTEXTS; |
| cts_each_dim[2] = INTRA_MODES; |
| optimize_cdf_table(&fc.kf_y_mode[0][0][0], probsfile, 3, cts_each_dim, |
| "const aom_cdf_prob\n" |
| "default_kf_y_mode_cdf[KF_MODE_CONTEXTS][KF_MODE_CONTEXTS]" |
| "[CDF_SIZE(INTRA_MODES)]"); |
| |
| cts_each_dim[0] = DIRECTIONAL_MODES; |
| cts_each_dim[1] = 2 * MAX_ANGLE_DELTA + 1; |
| optimize_cdf_table(&fc.angle_delta[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_angle_delta_cdf" |
| "[DIRECTIONAL_MODES][CDF_SIZE(2 * MAX_ANGLE_DELTA + 1)]"); |
| |
| /* Intra mode (non-keyframe luma) */ |
| cts_each_dim[0] = BLOCK_SIZE_GROUPS; |
| cts_each_dim[1] = INTRA_MODES; |
| optimize_cdf_table( |
| &fc.y_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob\n" |
| "default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)]"); |
| #endif |
| /* Intra mode (chroma) */ |
| #if CONFIG_UV_CFL |
| cts_each_dim[0] = UV_MODE_CONTEXTS; |
| cts_each_dim[1] = UV_INTRA_MODES - 1; |
| optimize_cdf_table(&fc.uv_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_uv_mode_cdf[UV_MODE_CONTEXTS]" |
| "[CDF_SIZE(UV_INTRA_MODES - 1)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| cts_each_dim[0] = CFL_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.cfl_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_cfl_cdf[CFL_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #else |
| cts_each_dim[0] = CFL_ALLOWED_TYPES; |
| #if CONFIG_AIMC |
| cts_each_dim[1] = UV_MODE_CONTEXTS; |
| #else |
| cts_each_dim[1] = INTRA_MODES; |
| #endif |
| cts_each_dim[2] = UV_INTRA_MODES; |
| int uvmode_each_ctx[2] = { 13, 14 }; |
| optimize_uv_mode(&fc.uv_mode[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_uv_mode_cdf[CFL_ALLOWED_TYPES][INTRA_MODES]" |
| "[CDF_SIZE(UV_INTRA_MODES)]", |
| 0, &total_count, uvmode_each_ctx, mem_wanted, "Intra"); |
| #endif // CONFIG_UV_CFL |
| |
| #if CONFIG_IMPROVED_INTRA_DIR_PRED |
| /* MRL index */ |
| cts_each_dim[0] = MRL_INDEX_CONTEXTS; |
| cts_each_dim[1] = MRL_LINE_NUMBER; |
| optimize_cdf_table(&fc.mrl_index[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_mrl_index_cdf" |
| "[MRL_INDEX_CONTEXTS][CDF_SIZE(MRL_LINE_NUMBER)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif // CONFIG_EXT_DIR |
| |
| /* cctx type */ |
| cts_each_dim[0] = EXT_TX_SIZES; |
| cts_each_dim[1] = CCTX_CONTEXTS; |
| cts_each_dim[2] = CCTX_TYPES; |
| optimize_cdf_table( |
| &fc.cctx_type[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_cctx_type_cdf[EXT_TX_SIZES]" |
| "[CCTX_CONTEXTS][CDF_SIZE(CCTX_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Transforms"); |
| |
| #if CONFIG_INTER_SDP |
| cts_each_dim[0] = INTER_SDP_BSIZE_GROUP; |
| cts_each_dim[1] = REGION_TYPES; |
| optimize_cdf_table(&fc.region_type[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_region_type_cdf" |
| "[INTER_SDP_BSIZE_GROUP][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #endif // CONFIG_INTER_SDP |
| |
| #if CONFIG_EXT_RECUR_PARTITIONS |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = PARTITION_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &fc.do_split[0][0][0], probsfile, 3, cts_each_dim, |
| "static aom_cdf_prob default_do_split_cdf" |
| "[PARTITION_STRUCTURE_NUM][PARTITION_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 40, mem_wanted, |
| "Partitions"); // minus unused context entries |
| #if CONFIG_BLOCK_256 |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = SQUARE_SPLIT_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &fc.do_square_split[0][0][0], probsfile, 3, cts_each_dim, |
| "static aom_cdf_prob default_do_square_split_cdf" |
| "[PARTITION_STRUCTURE_NUM][SQUARE_SPLIT_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = PARTITION_CONTEXTS; |
| cts_each_dim[2] = 2; |
| #endif // CONFIG_BLOCK_256 |
| optimize_cdf_table( |
| &fc.rect_type[0][0][0], probsfile, 3, cts_each_dim, |
| "static aom_cdf_prob default_rect_type_cdf" |
| "[PARTITION_STRUCTURE_NUM][PARTITION_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 96, mem_wanted, |
| "Partitions"); // minus unused context entries |
| |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = NUM_RECT_PARTS; |
| cts_each_dim[2] = PARTITION_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.do_ext_partition[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static aom_cdf_prob default_do_ext_partition_cdf" |
| "[PARTITION_STRUCTURE_NUM][NUM_RECT_PARTS][PARTITION_" |
| "CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 264, mem_wanted, |
| "Partitions"); // minus unused context entries |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = NUM_RECT_PARTS; |
| cts_each_dim[2] = PARTITION_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.do_uneven_4way_partition[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static aom_cdf_prob default_do_uneven_4way_partition_cdf" |
| "[PARTITION_STRUCTURE_NUM][NUM_RECT_PARTS][PARTITION_" |
| "CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 320, mem_wanted, |
| "Partitions"); // minus unused context entries |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = NUM_RECT_PARTS; |
| cts_each_dim[2] = PARTITION_CONTEXTS; |
| cts_each_dim[3] = NUM_UNEVEN_4WAY_PARTS; |
| optimize_cdf_table( |
| &fc.uneven_4way_partition_type[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static aom_cdf_prob default_uneven_4way_partition_type_cdf" |
| "[PARTITION_STRUCTURE_NUM][NUM_RECT_PARTS][PARTITION_" |
| "CONTEXTS][CDF_SIZE(NUM_UNEVEN_4WAY_PARTS)]", |
| 0, &total_count, 320, mem_wanted, |
| "Partitions"); // minus unused context entries |
| #else |
| /* block partition */ |
| cts_each_dim[0] = PARTITION_STRUCTURE_NUM; |
| cts_each_dim[1] = PARTITION_CONTEXTS; |
| cts_each_dim[2] = EXT_PARTITION_TYPES; |
| int part_types_each_ctx[PARTITION_CONTEXTS] = { 4, 4, 4, 4, 10, 10, 10, |
| 10, 10, 10, 10, 10, 10, 10, |
| 10, 10, 8, 8, 8, 8 }; |
| optimize_cdf_table_var_modes_3d_inner( |
| &fc.partition[0][0][0], probsfile, 3, cts_each_dim, part_types_each_ctx, |
| "static const aom_cdf_prob " |
| "default_partition_cdf[PARTITION_STRUCTURE_NUM][PARTITION_CONTEXTS]" |
| "[CDF_SIZE(EXT_PARTITION_TYPES)]"); |
| #endif // CONFIG_EXT_RECUR_PARTITIONS |
| |
| cts_each_dim[0] = DELTA_Q_PROBS + 1; |
| optimize_cdf_table(&fc.delta_q_cnts[0], probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob default_delta_q_cdf" |
| "[CDF_SIZE(DELTA_Q_PROBS + 1)]", |
| 0, &total_count, 0, mem_wanted, "Other"); |
| |
| cts_each_dim[0] = FRAME_LF_COUNT; |
| cts_each_dim[1] = DELTA_LF_PROBS + 1; |
| optimize_cdf_table(&fc.delta_lf_multi_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_delta_lf_multi_cdf" |
| "[FRAME_LF_COUNT][CDF_SIZE(DELTA_Q_PROBS + 1)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| cts_each_dim[0] = DELTA_Q_PROBS + 1; |
| optimize_cdf_table(&fc.delta_lf_cnts[0], probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob default_delta_lf_cdf" |
| "[CDF_SIZE(DELTA_Q_PROBS + 1)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| #if CONFIG_INTER_IST |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = STX_TYPES; |
| optimize_cdf_table(&fc.stx_cnts[0][0][0], probsfile, 3, cts_each_dim, |
| "static aom_cdf_prob default_stx_cdf" |
| "[2][TX_SIZES][CDF_SIZE(STX_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Transforms"); |
| #else |
| cts_each_dim[0] = TX_SIZES; |
| cts_each_dim[1] = STX_TYPES; |
| optimize_cdf_table(&fc.stx_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_stx_cdf" |
| "[TX_SIZES][CDF_SIZE(STX_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Transforms"); |
| #endif // CONFIG_INTER_IST |
| |
| #if CONFIG_IST_ANY_SET |
| #if CONFIG_INTRA_TX_IST_PARSE |
| cts_each_dim[0] = IST_DIR_SIZE; |
| optimize_cdf_table(&fc.stx_set_cnts[0], probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob default_most_probable_stx_set_cdf" |
| "[CDF_SIZE(IST_DIR_SIZE)]", |
| 0, &total_count, 0, mem_wanted, "Transforms"); |
| #else |
| cts_each_dim[0] = IST_DIR_SIZE; |
| cts_each_dim[1] = IST_DIR_SIZE; |
| optimize_cdf_table(&fc.stx_set_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_stx_set_cdf" |
| "[TX_SIZES][CDF_SIZE(STX_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Transforms"); |
| #endif |
| #endif |
| |
| cts_each_dim[0] = NUM_MV_PREC_MPP_CONTEXT; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.pb_mv_mpp_flag_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_pb_mv_most_probable_precision_cdf" |
| "[NUM_MV_PREC_MPP_CONTEXT][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = MV_PREC_DOWN_CONTEXTS; |
| cts_each_dim[1] = NUM_PB_FLEX_QUALIFIED_MAX_PREC; |
| cts_each_dim[2] = FLEX_MV_COSTS_SIZE; |
| optimize_cdf_table(&fc.pb_mv_precision_cnts[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "static aom_cdf_prob default_pb_mv_precision_cdf" |
| "[MV_PREC_DOWN_CONTEXTS][NUM_PB_FLEX_QUALIFIED_MAX_PREC]" |
| "[CDF_SIZE(FLEX_MV_COSTS_SIZE)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| // MVD/blockvector coding related CDFs |
| for (int ibc = 0; ibc < 2; ibc++) { |
| nmv_context_count *nmvc_cnts = (ibc == 0) ? &fc.nmvc_cnts : &fc.ndvc_cnts; |
| |
| #if CONFIG_VQ_MVD_CODING |
| cts_each_dim[0] = ibc == 0 ? NUM_MV_PRECISIONS : 1; |
| cts_each_dim[1] = MAX_NUM_SHELL_CLASS; |
| optimize_cdf_table(&nmvc_cnts->joint_shell_class_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob joint_shell_class_cdf_placeholder" |
| "[NUM_MV_PRECISIONS][CDF_SIZE(MAX_NUM_SHELL_CLASS)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &nmvc_cnts->shell_offset_low_class_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob shell_offset_low_class_cdf_placeholder" |
| "[2][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = 3; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&nmvc_cnts->shell_offset_class2_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob shell_offset_class2_cdf_placeholder" |
| "[3][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = NUM_CTX_CLASS_OFFSETS; |
| cts_each_dim[1] = SHELL_INT_OFFSET_BIT; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &nmvc_cnts->shell_offset_other_class_cnts[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "static aom_cdf_prob shell_offset_other_class_cdf_placeholder" |
| "[NUM_CTX_CLASS_OFFSETS][SHELL_INT_OFFSET_BIT][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = NUM_CTX_COL_MV_GTX; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&nmvc_cnts->col_mv_greter_flags_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob col_mv_greter_flags_cdf_placeholder" |
| "[NUM_CTX_COL_MV_GTX][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = NUM_CTX_COL_MV_INDEX; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&nmvc_cnts->col_mv_index_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob col_mv_index_cdf_placeholder" |
| "[NUM_CTX_COL_MV_INDEX][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = MV_JOINTS; |
| optimize_cdf_table(&nmvc_cnts->joints_cnts[0], probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob joints_cdf_placeholder" |
| "[CDF_SIZE(MV_JOINTS)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_VQ_MVD_CODING |
| |
| if (!ibc) { |
| cts_each_dim[0] = MV_JOINTS; |
| optimize_cdf_table(&nmvc_cnts->amvd_joints_cnts[0], probsfile, 1, |
| cts_each_dim, |
| "static aom_cdf_prob amvd_joints_cdf_placeholder" |
| "[CDF_SIZE(MV_JOINTS)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| } |
| |
| // Separate CDFs for row and columns of MVD |
| for (int mvd_comp = 0; mvd_comp < 2; mvd_comp++) { |
| #if CONFIG_VQ_MVD_CODING |
| if (!ibc) { |
| cts_each_dim[0] = MAX_AMVD_INDEX; |
| optimize_cdf_table( |
| &nmvc_cnts->mvd_comp_cnts[mvd_comp].amvd_indices_cnts[0], probsfile, |
| 1, cts_each_dim, |
| "static aom_cdf_prob amvd_indices_cdf_placeholder" |
| "[CDF_SIZE(MAX_AMVD_INDEX)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| } |
| #else |
| |
| cts_each_dim[0] = (ibc == 0) |
| ? NUM_MV_PRECISIONS |
| : 1; // For IBC case only one valid precision |
| cts_each_dim[1] = MV_CLASSES; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].classes_cnts[0][0], |
| probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob classes_cdf_placeholder" |
| "[NUM_MV_PRECISIONS][CDF_SIZE(MV_CLASSES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| if (!ibc) { |
| cts_each_dim[0] = MV_CLASSES; |
| optimize_cdf_table( |
| &nmvc_cnts->mvd_comp_cnts[mvd_comp].amvd_classes_cnts[0], probsfile, |
| 1, cts_each_dim, |
| "static aom_cdf_prob amvd_classes_cdf_placeholder" |
| "[CDF_SIZE(MV_CLASSES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = CLASS0_SIZE; |
| cts_each_dim[1] = 3; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &nmvc_cnts->mvd_comp_cnts[mvd_comp].class0_fp_cnts[0][0][0], |
| probsfile, 3, cts_each_dim, |
| "static aom_cdf_prob class0_fp_cdf_placeholder" |
| "[CLASS0_SIZE][3][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = 3; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].fp_cnts[0][0], |
| probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob fp_cdfs_placeholder" |
| "[3][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table( |
| &nmvc_cnts->mvd_comp_cnts[mvd_comp].class0_hp_cnts[0], probsfile, 1, |
| cts_each_dim, |
| "static aom_cdf_prob class0_hp_cdf_placeholder" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].hp_cnts[0], |
| probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob hp_cdf_placeholder" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| } |
| |
| cts_each_dim[0] = CLASS0_SIZE; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].class0_cnts[0], |
| probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob class0_cdf_placeholder" |
| "[CDF_SIZE(CLASS0_SIZE)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = MV_OFFSET_BITS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].bits_cnts[0][0], |
| probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob bits_cdf_placeholder" |
| "[MV_OFFSET_BITS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| #endif // CONFIG_VQ_MVD_CODING |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&nmvc_cnts->mvd_comp_cnts[mvd_comp].sign_cnts[0], |
| probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob sign_cdf_placeholder" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| } // for (int mvd_comp = 0; mvd_comp < 2; mvd_comp++) |
| } // for (int ibc = 0; ibc < 2; ibc++) |
| |
| cts_each_dim[0] = MAX_SEGMENTS; |
| optimize_cdf_table(&fc.seg_tree_cnts[0], probsfile, 1, cts_each_dim, |
| "static aom_cdf_prob default_seg_tree_cdf" |
| "[CDF_SIZE(MAX_SEGMENTS)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = SEG_TEMPORAL_PRED_CTXS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.segment_pred_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_segment_pred_cdf" |
| "[SEG_TEMPORAL_PRED_CTXS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = SPATIAL_PREDICTION_PROBS; |
| cts_each_dim[1] = MAX_SEGMENTS; |
| optimize_cdf_table(&fc.spatial_pred_seg_tree_cnts[0][0], probsfile, 2, |
| cts_each_dim, |
| "static aom_cdf_prob default_spatial_pred_seg_tree_cdf" |
| "[SEG_TEMPORAL_PRED_CTXS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* tx type */ |
| #if CONFIG_INTRA_TX_IST_PARSE |
| cts_each_dim[0] = EXT_TX_SETS_INTRA; |
| cts_each_dim[1] = EXT_TX_SIZES; |
| cts_each_dim[2] = TX_TYPES; |
| int intra_ext_tx_types_each_ctx[EXT_TX_SETS_INTRA] = { 0, INTRA_TX_SET1, |
| INTRA_TX_SET2 }; |
| optimize_cdf_table_var_modes_3d( |
| &fc.intra_ext_tx[0][0][0], probsfile, 3, cts_each_dim, |
| intra_ext_tx_types_each_ctx, |
| "static const aom_cdf_prob default_intra_ext_tx_cdf[EXT_TX_SETS_INTRA]" |
| "[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)]", |
| 0, &total_count, mem_wanted, "Transforms"); |
| #else |
| cts_each_dim[0] = EXT_TX_SETS_INTRA; |
| cts_each_dim[1] = EXT_TX_SIZES; |
| cts_each_dim[2] = INTRA_MODES; |
| cts_each_dim[3] = TX_TYPES; |
| int intra_ext_tx_types_each_ctx[EXT_TX_SETS_INTRA] = { 0, INTRA_TX_SET1, |
| INTRA_TX_SET2 }; |
| optimize_cdf_table_var_modes_4d( |
| &fc.intra_ext_tx[0][0][0][0], probsfile, 4, cts_each_dim, |
| intra_ext_tx_types_each_ctx, |
| "static const aom_cdf_prob default_intra_ext_tx_cdf[EXT_TX_SETS_INTRA]" |
| "[EXT_TX_SIZES][INTRA_MODES][CDF_SIZE(TX_TYPES)]", |
| 0, &total_count, mem_wanted, "Transforms"); |
| #endif |
| |
| cts_each_dim[0] = EXT_TX_SETS_INTER; |
| cts_each_dim[1] = EOB_TX_CTXS; |
| cts_each_dim[2] = EXT_TX_SIZES; |
| cts_each_dim[3] = TX_TYPES; |
| int inter_ext_tx_types_each_ctx[EXT_TX_SETS_INTER] = { 0, 16, 12, 2 }; |
| optimize_cdf_table_var_modes_4d( |
| &fc.inter_ext_tx[0][0][0][0], probsfile, 4, cts_each_dim, |
| inter_ext_tx_types_each_ctx, |
| "static const aom_cdf_prob " |
| "default_inter_ext_tx_cdf[EXT_TX_SETS_INTER][EOB_TX_CTXS]" |
| "[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)]", |
| 0, &total_count, mem_wanted, "Transforms"); |
| |
| /* Chroma from Luma */ |
| #if CONFIG_IMPROVED_CFL |
| cts_each_dim[0] = CFL_TYPE_COUNT; |
| optimize_cdf_table(&fc.cfl_index[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_cfl_index_cdf[CDF_SIZE(CFL_TYPE_COUNT)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif |
| cts_each_dim[0] = CFL_JOINT_SIGNS; |
| optimize_cdf_table(&fc.cfl_sign[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_cfl_sign_cdf[CDF_SIZE(CFL_JOINT_SIGNS)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| cts_each_dim[0] = CFL_ALPHA_CONTEXTS; |
| cts_each_dim[1] = CFL_ALPHABET_SIZE; |
| optimize_cdf_table(&fc.cfl_alpha[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_cfl_alpha_cdf[CFL_ALPHA_CONTEXTS]" |
| "[CDF_SIZE(CFL_ALPHABET_SIZE)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| /* Interpolation filter */ |
| cts_each_dim[0] = SWITCHABLE_FILTER_CONTEXTS; |
| cts_each_dim[1] = SWITCHABLE_FILTERS; |
| optimize_cdf_table(&fc.switchable_interp[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]" |
| "[CDF_SIZE(SWITCHABLE_FILTERS)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| /* Motion vector referencing */ |
| cts_each_dim[0] = INTER_SINGLE_MODE_CONTEXTS; |
| cts_each_dim[1] = INTER_SINGLE_MODES; |
| optimize_cdf_table(&fc.inter_single_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_inter_single_mode_cdf" |
| "[INTER_SINGLE_MODE_CONTEXTS][CDF_SIZE(" |
| "INTER_SINGLE_MODES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| // default_drl0_cdf_refmvbank[DRL_MODE_CONTEXTS][CDF_SIZE(2)] |
| cts_each_dim[0] = DRL_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.drl_mode[0][0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_drl0_cdf_refmvbank" |
| "[DRL_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| // default_drl1_cdf_refmvbank[DRL_MODE_CONTEXTS][CDF_SIZE(2)] |
| cts_each_dim[0] = DRL_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.drl_mode[1][0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_drl1_cdf_refmvbank" |
| "[DRL_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| // default_drl2_cdf_refmvbank[DRL_MODE_CONTEXTS][CDF_SIZE(2)] |
| cts_each_dim[0] = DRL_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.drl_mode[2][0][0], probsfile, 2, cts_each_dim, |
| "static aom_cdf_prob default_drl2_cdf_refmvbank" |
| "[DRL_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| #if CONFIG_EXTENDED_WARP_PREDICTION |
| cts_each_dim[0] = WARP_REF_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.warp_ref_cnts[0][0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_ref_idx0_cdf[WARP_REF_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = WARP_REF_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.warp_ref_cnts[1][0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_ref_idx1_cdf[WARP_REF_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = WARP_REF_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.warp_ref_cnts[2][0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_ref_idx2_cdf[WARP_REF_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_EXTENDED_WARP_PREDICTION |
| |
| cts_each_dim[0] = JOINT_NEWMV_SCALE_FACTOR_CNT; |
| optimize_cdf_table( |
| &fc.jmvd_scale_mode_cnts[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_jmvd_scale_mode_cdf[CDF_SIZE(JOINT_NEWMV_SCALE_FACTOR_CNT)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = JOINT_AMVD_SCALE_FACTOR_CNT; |
| optimize_cdf_table( |
| &fc.jmvd_amvd_scale_mode_cnts[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_jmvd_amvd_scale_mode_cdf[CDF_SIZE(JOINT_AMVD_SCALE_FACTOR_CNT)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = MAX_CWP_CONTEXTS; |
| cts_each_dim[1] = MAX_CWP_NUM - 1; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.cwp_idx_cnts[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_cwp_idx_cdf" |
| "[MAX_CWP_CONTEXTS][MAX_CWP_NUM - 1][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| #if CONFIG_OPTFLOW_REFINEMENT |
| /* Optical flow MV refinement */ |
| cts_each_dim[0] = INTER_COMPOUND_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.use_optflow[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_use_optflow_cdf" |
| "[INTER_COMPOUND_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_OPTFLOW_REFINEMENT |
| |
| /* ext_inter experiment */ |
| /* New compound mode */ |
| cts_each_dim[0] = INTER_COMPOUND_MODE_CONTEXTS; |
| #if CONFIG_OPTFLOW_REFINEMENT |
| cts_each_dim[1] = INTER_COMPOUND_REF_TYPES; |
| optimize_cdf_table(&fc.inter_compound_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_inter_compound_mode_cdf" |
| "[INTER_COMPOUND_MODE_CONTEXTS][CDF_SIZE(" |
| "INTER_COMPOUND_REF_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[1] = INTER_COMPOUND_MODES; |
| optimize_cdf_table(&fc.inter_compound_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob\n" |
| "default_inter_compound_mode_cdf" |
| "[INTER_COMPOUND_MODE_CONTEXTS][CDF_SIZE(" |
| "INTER_COMPOUND_MODES)]"); |
| #endif // CONFIG_OPTFLOW_REFINEMENT |
| |
| /* Interintra */ |
| cts_each_dim[0] = BLOCK_SIZE_GROUPS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.interintra[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = BLOCK_SIZE_GROUPS; |
| cts_each_dim[1] = INTERINTRA_MODES; |
| optimize_cdf_table(&fc.interintra_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_interintra_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(" |
| "INTERINTRA_MODES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.wedge_interintra[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_interintra_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.wedge_interintra[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_interintra_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| /* Compound type */ |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = COMPOUND_TYPES - 1; |
| optimize_cdf_table(&fc.compound_type[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_compound_type_cdf" |
| "[CDF_SIZE(COMPOUND_TYPES - 1)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = COMPOUND_TYPES - 1; |
| optimize_cdf_table(&fc.compound_type[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_compound_type_cdf" |
| "[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES - 1)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| #if CONFIG_WEDGE_MOD_EXT |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.wedge_angle_dir_cnt[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_dir_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = H_WEDGE_ANGLES; |
| optimize_cdf_table(&fc.wedge_angle_0_cnt[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_0_cdf[CDF_SIZE(H_WEDGE_ANGLES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = H_WEDGE_ANGLES; |
| optimize_cdf_table(&fc.wedge_angle_1_cnt[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_1_cdf[CDF_SIZE(H_WEDGE_ANGLES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = NUM_WEDGE_DIST; |
| optimize_cdf_table(&fc.wedge_dist_cnt[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_dist_cdf[CDF_SIZE(NUM_WEDGE_DIST)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = NUM_WEDGE_DIST - 1; |
| optimize_cdf_table(&fc.wedge_dist2_cnt[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_dist_cdf2[CDF_SIZE(NUM_WEDGE_DIST - 1)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.wedge_angle_dir_cnt[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_dir_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = H_WEDGE_ANGLES; |
| optimize_cdf_table( |
| &fc.wedge_angle_0_cnt[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_0_cdf[BLOCK_SIZES_ALL][CDF_SIZE(H_WEDGE_ANGLES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = H_WEDGE_ANGLES; |
| optimize_cdf_table( |
| &fc.wedge_angle_1_cnt[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_angle_1_cdf[BLOCK_SIZES_ALL][CDF_SIZE(H_WEDGE_ANGLES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = NUM_WEDGE_DIST; |
| optimize_cdf_table( |
| &fc.wedge_dist_cnt[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_dist_cdf[BLOCK_SIZES_ALL][CDF_SIZE(NUM_WEDGE_DIST)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = NUM_WEDGE_DIST - 1; |
| optimize_cdf_table( |
| &fc.wedge_dist2_cnt[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_dist_cdf2[BLOCK_SIZES_ALL][CDF_SIZE(NUM_WEDGE_DIST - 1)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 16; |
| optimize_cdf_table(&fc.wedge_idx[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_wedge_idx_cdf[BLOCK_SIZES_ALL][CDF_SIZE(16)]"); |
| #endif // CONFIG_WEDGE_MOD_EXT |
| |
| #if CONFIG_REFINEMV |
| cts_each_dim[0] = NUM_REFINEMV_CTX; |
| cts_each_dim[1] = REFINEMV_NUM_MODES; |
| optimize_cdf_table(&fc.refinemv_flag_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_refinemv_flag_cdf[NUM_REFINEMV_CTX][CDF_SIZE(" |
| "REFINEMV_NUM_MODES)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_REFINEMV |
| |
| #if CONFIG_SKIP_MODE_ENHANCEMENT |
| cts_each_dim[0] = 3; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.skip_drl_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_skip_drl_cdf[3][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_SKIP_MODE_ENHANCEMENT |
| |
| #if CONFIG_EXTENDED_WARP_PREDICTION |
| cts_each_dim[0] = WARPMV_MODE_CONTEXT; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.inter_warp_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_inter_warp_mode_cdf[WARPMV_MODE_CONTEXT][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_EXTENDED_WARP_PREDICTION |
| |
| /* motion_var and warped_motion experiments */ |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.obmc[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_obmc_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.obmc[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| #if CONFIG_EXTENDED_WARP_PREDICTION |
| #if CONFIG_D149_CTX_MODELING_OPT && !NO_D149_FOR_WARPED_CAUSAL |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.warped_causal[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warped_causal_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.warped_causal[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warped_causal_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT && !NO_D149_FOR_WARPED_CAUSAL |
| |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.warp_delta[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_delta_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.warp_delta[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_delta_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = WARP_DELTA_NUM_SYMBOLS; |
| optimize_cdf_table(&fc.warp_delta_param[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_warp_delta_param_cdf" |
| "[2][CDF_SIZE(WARP_DELTA_NUM_SYMBOLS)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| cts_each_dim[0] = WARP_EXTEND_CTXS1; |
| cts_each_dim[1] = WARP_EXTEND_CTXS2; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &fc.warp_extend[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warp_extend_cdf[WARP_EXTEND_CTXS1][WARP_EXTEND_CTXS2]" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #if CONFIG_EXTENDED_WARP_PREDICTION |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.warped_causal_warpmv[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warped_causal_warpmv_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.warped_causal_warpmv[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warped_causal_warpmv_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| #endif // CONFIG_EXTENDED_WARP_PREDICTION |
| |
| #if CONFIG_EXTENDED_WARP_PREDICTION |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.warpmv_with_mvd_flag[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warpmv_with_mvd_flag_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.warpmv_with_mvd_flag[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_warpmv_with_mvd_flag_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| #endif // CONFIG_EXTENDED_WARP_PREDICTION |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = MOTION_MODES; |
| optimize_cdf_table( |
| &fc.motion_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)]"); |
| #endif // CONFIG_EXTENDED_WARP_PREDICTION |
| /* Bawp flag */ |
| #if CONFIG_BAWP |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.bawp[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_bawp_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif |
| /* Intra/inter flag */ |
| #if CONFIG_CONTEXT_DERIVATION && !CONFIG_SKIP_TXFM_OPT |
| cts_each_dim[0] = INTRA_INTER_SKIP_TXFM_CONTEXTS; |
| cts_each_dim[1] = INTRA_INTER_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.intra_inter[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob\n" |
| "default_intra_inter_cdf[INTRA_INTER_SKIP_TXFM_CONTEXTS][" |
| "INTRA_INTER_CONTEXTS][CDF_SIZE(2)]"); |
| #else |
| cts_each_dim[0] = INTRA_INTER_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.intra_inter[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_intra_inter_cdf[INTRA_INTER_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| #endif // CONFIG_CONTEXT_DERIVATION && !CONFIG_SKIP_TXFM_OPT |
| /* Single/comp ref flag */ |
| cts_each_dim[0] = COMP_INTER_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.comp_inter[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* Reference frame (single ref) */ |
| cts_each_dim[0] = REF_CONTEXTS; |
| cts_each_dim[1] = INTER_REFS_PER_FRAME - 1; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.single_ref[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_single_ref_cdf[REF_CONTEXTS][INTER_REFS_PER_" |
| "FRAME - 1][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* ext_refs experiment */ |
| cts_each_dim[0] = REF_CONTEXTS; |
| #if CONFIG_ALLOW_SAME_REF_COMPOUND |
| cts_each_dim[1] = INTER_REFS_PER_FRAME - 1; |
| #else |
| cts_each_dim[1] = INTER_REFS_PER_FRAME - 2; |
| #endif // CONFIG_ALLOW_SAME_REF_COMPOUND |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.comp_ref0[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_comp_ref0_cdf[REF_CONTEXTS]" |
| #if CONFIG_ALLOW_SAME_REF_COMPOUND |
| "[INTER_REFS_PER_FRAME - 1]" |
| #else |
| "[INTER_REFS_PER_FRAME - 2]" |
| #endif // CONFIG_ALLOW_SAME_REF_COMPOUND |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| cts_each_dim[0] = REF_CONTEXTS; |
| cts_each_dim[1] = COMPREF_BIT_TYPES; |
| #if CONFIG_ALLOW_SAME_REF_COMPOUND |
| cts_each_dim[2] = INTER_REFS_PER_FRAME - 1; |
| #else |
| cts_each_dim[2] = INTER_REFS_PER_FRAME - 2; |
| #endif // CONFIG_ALLOW_SAME_REF_COMPOUND |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.comp_ref1[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_comp_ref1_cdf[REF_CONTEXTS][COMPREF_BIT_TYPES]" |
| #if CONFIG_ALLOW_SAME_REF_COMPOUND |
| "[INTER_REFS_PER_FRAME - 1]" |
| #else |
| "[INTER_REFS_PER_FRAME - 2]" |
| #endif // CONFIG_ALLOW_SAME_REF_COMPOUND |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| #if CONFIG_PALETTE_IMPROVEMENTS |
| #if CONFIG_PALETTE_LINE_COPY |
| cts_each_dim[0] = PALETTE_ROW_FLAG_CONTEXTS; |
| cts_each_dim[1] = 3; |
| optimize_cdf_table(&fc.identity_row_y_cnts[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_identity_row_cdf_y" |
| "[PALETTE_ROW_FLAG_CONTEXTS][CDF_SIZE(3)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALETTE_ROW_FLAG_CONTEXTS; |
| cts_each_dim[1] = 3; |
| optimize_cdf_table(&fc.identity_row_uv_cnts[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_identity_row_cdf_uv" |
| "[PALETTE_ROW_FLAG_CONTEXTS][CDF_SIZE(3)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.palette_direction_cnts[0], probsfile, 1, cts_each_dim, |
| "const aom_cdf_prob default_palette_direction_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = PALETTE_ROW_FLAG_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.identity_row_y_cnts[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_identity_row_cdf_y" |
| "[PALETTE_ROW_FLAG_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALETTE_ROW_FLAG_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.identity_row_uv_cnts[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_identity_row_cdf_uv" |
| "[PALETTE_ROW_FLAG_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_PALETTE_LINE_COPY |
| #endif // CONFIG_PALETTE_IMPROVEMENTS |
| |
| /* palette */ |
| cts_each_dim[0] = PALATTE_BSIZE_CTXS; |
| cts_each_dim[1] = PALETTE_SIZES; |
| optimize_cdf_table(&fc.palette_y_size[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_palette_y_size_cdf" |
| "[PALATTE_BSIZE_CTXS][CDF_SIZE(PALETTE_SIZES)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALATTE_BSIZE_CTXS; |
| cts_each_dim[1] = PALETTE_SIZES; |
| optimize_cdf_table(&fc.palette_uv_size[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_palette_uv_size_cdf" |
| "[PALATTE_BSIZE_CTXS][CDF_SIZE(PALETTE_SIZES)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALATTE_BSIZE_CTXS; |
| cts_each_dim[1] = PALETTE_Y_MODE_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.palette_y_mode[0][0][0], probsfile, 3, cts_each_dim, |
| "const aom_cdf_prob default_palette_y_mode_cdf" |
| "[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALETTE_UV_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.palette_uv_mode[0][0], probsfile, 2, cts_each_dim, |
| "const aom_cdf_prob default_palette_uv_mode_cdf" |
| "[PALETTE_UV_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALETTE_SIZES; |
| cts_each_dim[1] = PALETTE_COLOR_INDEX_CONTEXTS; |
| cts_each_dim[2] = PALETTE_COLORS; |
| int palette_color_indexes_each_ctx[PALETTE_SIZES] = { 2, 3, 4, 5, 6, 7, 8 }; |
| optimize_cdf_table_var_modes_3d( |
| &fc.palette_y_color_index[0][0][0], probsfile, 3, cts_each_dim, |
| palette_color_indexes_each_ctx, |
| "const aom_cdf_prob default_palette_y_color_index_cdf[PALETTE_SIZES]" |
| "[PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)]", |
| 0, &total_count, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = PALETTE_SIZES; |
| cts_each_dim[1] = PALETTE_COLOR_INDEX_CONTEXTS; |
| cts_each_dim[2] = PALETTE_COLORS; |
| optimize_cdf_table_var_modes_3d( |
| &fc.palette_uv_color_index[0][0][0], probsfile, 3, cts_each_dim, |
| palette_color_indexes_each_ctx, |
| "const aom_cdf_prob default_palette_uv_color_index_cdf[PALETTE_SIZES]" |
| "[PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)]", |
| 0, &total_count, mem_wanted, "Coefficients"); |
| |
| /* Transform size */ |
| #if CONFIG_NEW_TX_PARTITION |
| #if CONFIG_TX_PARTITION_CTX |
| #if CONFIG_IMPROVEIDTX_CTXS |
| #if CONFIG_TX_PARTITION_TYPE_EXT |
| cts_each_dim[0] = FSC_MODES; |
| cts_each_dim[1] = 2; |
| cts_each_dim[2] = TXFM_SPLIT_GROUP; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.txfm_do_partition[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static const aom_cdf_prob default_txfm_do_partition_cdf" |
| "[FSC_MODES][2][TXFM_SPLIT_GROUP][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = FSC_MODES; |
| cts_each_dim[1] = 2; |
| cts_each_dim[2] = TXFM_PARTITION_GROUP - 1; |
| cts_each_dim[3] = TX_PARTITION_TYPE_NUM; |
| optimize_cdf_table( |
| &fc.txfm_4way_partition_type[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_4way_partition_type_cdf" |
| "[FSC_MODES][2][TXFM_PARTITION_GROUP - " |
| "1][CDF_SIZE(TX_PARTITION_TYPE_NUM)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #else |
| cts_each_dim[0] = FSC_MODES; |
| cts_each_dim[1] = 2; |
| cts_each_dim[2] = TXFM_PARTITION_GROUP; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.txfm_do_partition[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static const aom_cdf_prob default_txfm_do_partition_cdf" |
| "[FSC_MODES][2][TXFM_PARTITION_GROUP][CDF_SIZE(2)]", |
| 0, &total_count, 9, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = FSC_MODES; |
| cts_each_dim[1] = 2; |
| cts_each_dim[2] = TXFM_PARTITION_GROUP - 1; |
| cts_each_dim[3] = 3; |
| optimize_cdf_table( |
| &fc.txfm_4way_partition_type[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_4way_partition_type_cdf" |
| "[FSC_MODES][2][TXFM_PARTITION_GROUP - 1][CDF_SIZE(3)]", |
| 0, &total_count, 9, mem_wanted, "Partitions"); |
| #endif // CONFIG_TX_PARTITION_TYPE_EXT |
| #else |
| #if CONFIG_TX_PARTITION_TYPE_EXT |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TXFM_SPLIT_GROUP; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.txfm_do_partition[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_do_partition_cdf" |
| "[2][TXFM_SPLIT_GROUP][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TXFM_PARTITION_GROUP - 1; |
| cts_each_dim[2] = TX_PARTITION_TYPE_NUM; |
| optimize_cdf_table( |
| &fc.txfm_4way_partition_type[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_4way_partition_type_cdf" |
| "[2][TXFM_PARTITION_GROUP - 1][CDF_SIZE(TX_PARTITION_TYPE_NUM)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #else |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TXFM_PARTITION_GROUP; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.txfm_do_partition[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_do_partition_cdf" |
| "[2][TXFM_PARTITION_GROUP][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TXFM_PARTITION_GROUP - 1; |
| cts_each_dim[2] = 3; |
| optimize_cdf_table( |
| &fc.txfm_4way_partition_type[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_txfm_4way_partition_type_cdf" |
| "[2][TXFM_PARTITION_GROUP - 1][CDF_SIZE(3)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #endif // CONFIG_TX_PARTITION_TYPE_EXT |
| #endif // CONFIG_IMPROVEIDTX_CTXS |
| #else |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TXFM_PARTITION_INTER_CONTEXTS; |
| cts_each_dim[2] = 4; |
| optimize_cdf_table( |
| &fc.inter_4way_txfm_partition[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_inter_4way_txfm_partition_cdf " |
| "[2][TXFM_PARTITION_INTER_CONTEXTS][CDF_SIZE(4)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table( |
| &fc.inter_2way_txfm_partition[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_inter_2way_txfm_partition_cdf " |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = 2; |
| cts_each_dim[1] = TX_SIZE_CONTEXTS; |
| cts_each_dim[2] = 4; |
| optimize_cdf_table( |
| &fc.intra_4way_txfm_partition[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob default_intra_4way_txfm_partition_cdf " |
| "[2][TX_SIZE_CONTEXTS][CDF_SIZE(4)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table( |
| &fc.intra_2way_txfm_partition[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_intra_2way_txfm_partition_cdf " |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #endif // CONFIG_TX_PARTITION_CTX |
| #else // CONFIG_NEW_TX_PARTITION |
| cts_each_dim[0] = TXFM_PARTITION_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table( |
| &fc.txfm_partition[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob\n" |
| "default_txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Partitions"); |
| #endif // CONFIG_NEW_TX_PARTITION |
| |
| /* Skip flag */ |
| cts_each_dim[0] = SKIP_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.skip_txfm[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_skip_txfm_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| /* Skip mode flag */ |
| cts_each_dim[0] = SKIP_MODE_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.skip_mode[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_skip_mode_cdfs[SKIP_MODE_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* TIP ref flag */ |
| cts_each_dim[0] = TIP_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.tip_ref[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_tip_cdf[TIP_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* joint compound group index */ |
| cts_each_dim[0] = COMP_GROUP_IDX_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.comp_group_idx[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_comp_group_idx_cdfs" |
| "[COMP_GROUP_IDX_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Inter"); |
| |
| /* intrabc */ |
| #if CONFIG_NEW_CONTEXT_MODELING |
| cts_each_dim[0] = INTRABC_CONTEXTS; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.intrabc[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_intrabc_cdf[INTRABC_CONTEXTS][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #else |
| cts_each_dim[0] = 2; |
| optimize_cdf_table( |
| &fc.intrabc[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_intrabc_cdf[CDF_SIZE(2)]"); |
| #endif // CONFIG_NEW_CONTEXT_MODELING |
| |
| #if CONFIG_IBC_BV_IMPROVEMENT |
| /* intrabc mode flag*/ |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.intrabc_mode[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_intrabc_mode_cdf[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| /* intrabc drl index*/ |
| cts_each_dim[0] = MAX_REF_BV_STACK_SIZE - 1; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.intrabc_drl_idx[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_intrabc_drl_idx_cdf" |
| "[MAX_REF_BV_STACK_SIZE - 1][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif |
| |
| #if CONFIG_MORPH_PRED |
| cts_each_dim[0] = 3; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.morph_pred_count[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob\n" |
| "default_morph_pred_cdf[3][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif // CONFIG_MORPH_PRED |
| |
| /* filter_intra experiment */ |
| cts_each_dim[0] = FILTER_INTRA_MODES; |
| optimize_cdf_table( |
| &fc.filter_intra_mode[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_filter_intra_mode_cdf[CDF_SIZE(FILTER_INTRA_MODES)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| #if CONFIG_CCSO_EXT |
| #if CONFIG_ENTROPY_PARA |
| cts_each_dim[0] = 3; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.default_ccso_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_ccso_cdf[3][2]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #else |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.default_ccso_cnts[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_ccso_cdf[2]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif |
| #endif |
| |
| #if CONFIG_LR_IMPROVEMENTS |
| cts_each_dim[0] = MAX_LR_FLEX_SWITCHABLE_BITS; |
| cts_each_dim[1] = MAX_MB_PLANE; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table( |
| &fc.switchable_flex_restore_cnts[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_switchable_flex_restore_cdf[MAX_LR_FLEX_SWITCHABLE_BITS]" |
| "[MAX_MB_PLANE][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #else |
| cts_each_dim[0] = RESTORE_SWITCHABLE_TYPES; |
| optimize_cdf_table( |
| &fc.switchable_flex_restore_cnts[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_switchable_restore_cdf[CDF_SIZE(RESTORE_SWITCHABLE_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #endif // CONFIG_LR_IMPROVEMENTS |
| |
| #if CONFIG_D149_CTX_MODELING_OPT |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.filter_intra[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_filter_intra_cdfs[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #else |
| cts_each_dim[0] = BLOCK_SIZES_ALL; |
| cts_each_dim[1] = 2; |
| optimize_cdf_table(&fc.filter_intra[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_filter_intra_cdfs[BLOCK_SIZES_ALL][CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif // CONFIG_D149_CTX_MODELING_OPT |
| |
| /* forward skip coding flag */ |
| cts_each_dim[0] = FSC_MODE_CONTEXTS; |
| cts_each_dim[1] = FSC_BSIZE_CONTEXTS; |
| cts_each_dim[2] = FSC_MODES; |
| optimize_cdf_table(&fc.fsc_mode[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "default_fsc_mode_cdf[FSC_MODE_CONTEXTS]" |
| "[FSC_BSIZE_CONTEXTS][CDF_SIZE(FSC_MODES)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| |
| /* restoration type */ |
| #if !CONFIG_LR_IMPROVEMENTS |
| cts_each_dim[0] = RESTORE_SWITCHABLE_TYPES; |
| optimize_cdf_table(&fc.switchable_restore[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_switchable_restore_cdf" |
| "[CDF_SIZE(RESTORE_SWITCHABLE_TYPES)]", |
| 0, &total_count, 0, mem_wanted, "Intra"); |
| #endif |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.wiener_restore[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_wiener_restore_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.sgrproj_restore[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_sgrproj_restore_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| #if CONFIG_LR_IMPROVEMENTS |
| #if ENABLE_LR_4PART_CODE |
| cts_each_dim[0] = WIENERNS_4PART_CTX_MAX; |
| cts_each_dim[1] = 4; |
| optimize_cdf_table(&fc.wienerns_4part_cnts[0][0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_wienerns_4part_cdf" |
| "[WIENERNS_4PART_CTX_MAX][CDF_SIZE(4)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #endif // ENABLE_LR_4PART_CODE |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.wienerns_restore[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_wienerns_restore_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #if CONFIG_LR_IMPROVEMENTS |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.pc_wiener_restore[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_pc_wiener_restore_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.wienerns_length[0], probsfile, 2, cts_each_dim, |
| "static const aom_cdf_prob default_wienerns_length_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #endif // CONFIG_LR_IMPROVEMENTS |
| |
| #if CONFIG_LR_MERGE_COEFFS |
| cts_each_dim[0] = 2; |
| optimize_cdf_table(&fc.merged_param_cnts[0], probsfile, 1, cts_each_dim, |
| "static const aom_cdf_prob default_merged_param_cdf" |
| "[CDF_SIZE(2)]", |
| 0, &total_count, 0, mem_wanted, "Filters"); |
| #endif // CONFIG_LR_MERGE_COEFFS |
| #endif // CONFIG_LR_IMPROVEMENTS |
| |
| /* intra tx size */ |
| #if !CONFIG_NEW_TX_PARTITION |
| cts_each_dim[0] = MAX_TX_CATS; |
| cts_each_dim[1] = TX_SIZE_CONTEXTS; |
| cts_each_dim[2] = MAX_TX_DEPTH + 1; |
| int intra_tx_sizes_each_ctx[MAX_TX_CATS] = { 2, 3, 3, 3 }; |
| optimize_cdf_table_var_modes_3d( |
| &fc.intra_tx_size[0][0][0], probsfile, 3, cts_each_dim, |
| intra_tx_sizes_each_ctx, |
| "static const aom_cdf_prob default_tx_size_cdf" |
| "[MAX_TX_CATS][TX_SIZE_CONTEXTS][CDF_SIZE(MAX_TX_DEPTH + 1)]"); |
| #endif // !CONFIG_NEW_TX_PARTITION |
| |
| /* transform coding */ |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = TXB_SKIP_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.txb_skip[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_txb_skip_cdfs[TOKEN_CDF_Q_CTXS][TX_SIZES]" |
| "[TXB_SKIP_CONTEXTS][CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #if CONFIG_IMPROVEIDTX_CTXS |
| /* forward skip sign bit */ |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = IDTX_SIGN_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.idtx_sign[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_idtx_sign_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[TX_SIZES][IDTX_SIGN_CONTEXTS][CDF_SIZE(2)]", |
| 1, &total_count, 72, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = SIG_COEF_CONTEXTS_BOB; |
| cts_each_dim[3] = NUM_BASE_LEVELS + 1; |
| optimize_cdf_table( |
| &fc.coeff_base_bob_multi[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_bob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][SIG_COEF_CONTEXTS_BOB]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 1)]", |
| 1, &total_count, 24, mem_wanted, "Coefficients"); |
| #else |
| /* forward skip sign bit */ |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = IDTX_SIGN_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.idtx_sign[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_idtx_sign_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[IDTX_SIGN_CONTEXTS][CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = SIG_COEF_CONTEXTS_BOB; |
| cts_each_dim[2] = NUM_BASE_LEVELS + 1; |
| optimize_cdf_table( |
| &fc.coeff_base_bob_multi[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_bob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][SIG_COEF_CONTEXTS_BOB]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_IMPROVEIDTX_CTXS |
| |
| #if CONFIG_CONTEXT_DERIVATION |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = V_TXB_SKIP_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.v_txb_skip[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_v_txb_skip_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[V_TXB_SKIP_CONTEXTS][CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| #endif // CONFIG_CONTEXT_DERIVATION |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = PLANE_TYPES; |
| cts_each_dim[3] = EOB_COEF_CONTEXTS; |
| cts_each_dim[4] = 2; |
| optimize_cdf_table( |
| &fc.eob_extra[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_extra_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #if CONFIG_EOB_POS_LUMA |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 6; |
| optimize_cdf_table( |
| &fc.eob_multi16[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi16_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 6)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 5; |
| optimize_cdf_table( |
| &fc.eob_multi32[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi32_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 5)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 4; |
| optimize_cdf_table( |
| &fc.eob_multi64[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi64_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 4)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 3; |
| optimize_cdf_table( |
| &fc.eob_multi128[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi128_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 3)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 2; |
| optimize_cdf_table( |
| &fc.eob_multi256[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi256_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS - 1; |
| optimize_cdf_table( |
| &fc.eob_multi512[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi512_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS - 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = EOB_PLANE_CTXS; |
| cts_each_dim[2] = EOB_MAX_SYMS; |
| optimize_cdf_table( |
| &fc.eob_multi1024[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi1024_cdfs" |
| "[TOKEN_CDF_Q_CTXS][EOB_PLANE_CTXS][CDF_SIZE(EOB_MAX_SYMS)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 6; |
| optimize_cdf_table( |
| &fc.eob_multi16[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi16_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 6)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 5; |
| optimize_cdf_table( |
| &fc.eob_multi32[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi32_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 5)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 4; |
| optimize_cdf_table( |
| &fc.eob_multi64[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi64_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 4)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 3; |
| optimize_cdf_table( |
| &fc.eob_multi128[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi128_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 3)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 2; |
| optimize_cdf_table( |
| &fc.eob_multi256[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi256_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS - 1; |
| optimize_cdf_table( |
| &fc.eob_multi512[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi512_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS - 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = EOB_MAX_SYMS; |
| optimize_cdf_table(&fc.eob_multi1024[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_eob_multi1024_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][CDF_SIZE(EOB_MAX_SYMS)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_EOB_POS_LUMA |
| |
| #if CONFIG_LCCHROMA |
| // LF Base, BR |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = LF_SIG_COEF_CONTEXTS_UV; |
| cts_each_dim[2] = LF_BASE_SYMBOLS; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_multi_uv[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_multi_uv_cdfs" |
| "[TOKEN_CDF_Q_CTXS][LF_SIG_COEF_CONTEXTS_UV][CDF_SIZE(LF_BASE_SYMBOLS)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = LF_LEVEL_CONTEXTS_UV; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table( |
| &fc.coeff_lps_lf_multi_uv[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_lps_lf_multi_uv_cdfs" |
| "[TOKEN_CDF_Q_CTXS][LF_LEVEL_CONTEXTS_UV][CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| // HF Base, BR |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = SIG_COEF_CONTEXTS_UV; |
| cts_each_dim[2] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table( |
| &fc.coeff_base_multi_uv[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_multi_uv_cdfs" |
| "[TOKEN_CDF_Q_CTXS][SIG_COEF_CONTEXTS_UV][CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = LEVEL_CONTEXTS_UV; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_multi_uv[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_multi_uv_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[LEVEL_CONTEXTS_UV][CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| // LF, HF EOB |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[2] = LF_BASE_SYMBOLS - 1; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_eob_multi_uv[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_eob_multi_uv_cdfs" |
| "[TOKEN_CDF_Q_CTXS][SIG_COEF_CONTEXTS_EOB][CDF_SIZE(LF_BASE_SYMBOLS - " |
| "1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[2] = NUM_BASE_LEVELS + 1; |
| optimize_cdf_table( |
| &fc.coeff_base_eob_multi_uv[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_eob_multi_uv_cdfs" |
| "[TOKEN_CDF_Q_CTXS][SIG_COEF_CONTEXTS_EOB][CDF_SIZE(NUM_BASE_LEVELS + " |
| "1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_LCCHROMA |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = COEFF_BASE_PH_CONTEXTS; |
| cts_each_dim[2] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table(&fc.coeff_base_ph_multi[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "const aom_cdf_prob " |
| "av1_default_coeff_base_ph_cdfs[TOKEN_CDF_Q_CTXS][COEFF_" |
| "BASE_PH_CONTEXTS][CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = COEFF_BR_PH_CONTEXTS; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_ph_multi[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "const aom_cdf_prob " |
| "av1_default_coeff_br_ph_cdfs[TOKEN_CDF_Q_CTXS][COEFF_BR_" |
| "PH_CONTEXTS][CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| #if CONFIG_LCCHROMA |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = LF_SIG_COEF_CONTEXTS; |
| cts_each_dim[3] = LF_BASE_SYMBOLS; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_multi[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][LF_SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(LF_BASE_SYMBOLS)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[3] = LF_BASE_SYMBOLS - 1; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_eob_multi[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_eob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][SIG_COEF_CONTEXTS_EOB]" |
| "[CDF_SIZE(LF_BASE_SYMBOLS - 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = LF_LEVEL_CONTEXTS; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_lf_multi[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_lf_multi_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[LF_LEVEL_CONTEXTS][CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = LEVEL_CONTEXTS; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_multi[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_multi_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[LEVEL_CONTEXTS][CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = PLANE_TYPES; |
| cts_each_dim[3] = LF_SIG_COEF_CONTEXTS; |
| cts_each_dim[4] = LF_BASE_SYMBOLS; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_multi[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][LF_SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(LF_BASE_SYMBOLS)]", |
| 1, &total_count, 340, mem_wanted, |
| "Coefficients"); // Exclude: 4*5*1*(33-16) |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = PLANE_TYPES; |
| cts_each_dim[3] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[4] = LF_BASE_SYMBOLS - 1; |
| optimize_cdf_table( |
| &fc.coeff_base_lf_eob_multi[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_lf_eob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS_EOB]" |
| "[CDF_SIZE(LF_BASE_SYMBOLS - 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = LF_LEVEL_CONTEXTS; |
| cts_each_dim[3] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_lf_multi[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_lf_multi_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[PLANE_TYPES][LF_LEVEL_CONTEXTS]" |
| "[CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = LEVEL_CONTEXTS; |
| cts_each_dim[3] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_multi[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_multi_cdfs[TOKEN_CDF_Q_CTXS]" |
| "[PLANE_TYPES][LEVEL_CONTEXTS]" |
| "[CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_LCCHROMA |
| |
| #if CONFIG_LCCHROMA |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = SIG_COEF_CONTEXTS; |
| cts_each_dim[3] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table( |
| &fc.coeff_base_multi[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = PLANE_TYPES; |
| cts_each_dim[3] = SIG_COEF_CONTEXTS; |
| cts_each_dim[4] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table( |
| &fc.coeff_base_multi[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_LCCHROMA |
| |
| #if CONFIG_IMPROVEIDTX_CTXS |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = IDTX_LEVEL_CONTEXTS; |
| cts_each_dim[3] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_multi_skip[0][0][0][0], probsfile, 4, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_multi_cdfs_idtx" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][IDTX_LEVEL_CONTEXTS]" |
| "[CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 196, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = IDTX_SIG_COEF_CONTEXTS; |
| cts_each_dim[3] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table( |
| &fc.coeff_base_multi_skip[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_multi_cdfs_idtx" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][IDTX_SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 196, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = IDTX_LEVEL_CONTEXTS; |
| cts_each_dim[2] = BR_CDF_SIZE; |
| optimize_cdf_table(&fc.coeff_lps_multi_skip[0][0][0], probsfile, 3, |
| cts_each_dim, |
| "static const aom_cdf_prob " |
| "av1_default_coeff_lps_multi_cdfs_idtx" |
| "[TOKEN_CDF_Q_CTXS][IDTX_LEVEL_CONTEXTS]" |
| "[CDF_SIZE(BR_CDF_SIZE)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = IDTX_SIG_COEF_CONTEXTS; |
| cts_each_dim[2] = NUM_BASE_LEVELS + 2; |
| optimize_cdf_table( |
| &fc.coeff_base_multi_skip[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_multi_cdfs_idtx" |
| "[TOKEN_CDF_Q_CTXS][IDTX_SIG_COEF_CONTEXTS]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_IMPROVEIDTX_CTXS |
| |
| #if CONFIG_LCCHROMA |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[3] = NUM_BASE_LEVELS + 1; |
| optimize_cdf_table( |
| &fc.coeff_base_eob_multi[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_eob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][SIG_COEF_CONTEXTS_EOB]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = TX_SIZES; |
| cts_each_dim[2] = PLANE_TYPES; |
| cts_each_dim[3] = SIG_COEF_CONTEXTS_EOB; |
| cts_each_dim[4] = NUM_BASE_LEVELS + 1; |
| optimize_cdf_table( |
| &fc.coeff_base_eob_multi[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_coeff_base_eob_multi_cdfs" |
| "[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS_EOB]" |
| "[CDF_SIZE(NUM_BASE_LEVELS + 1)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_LCCHROMA |
| |
| #if CONFIG_CONTEXT_DERIVATION |
| #if CONFIG_IMPROVEIDTX_CTXS |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = DC_SIGN_GROUPS; |
| cts_each_dim[3] = DC_SIGN_CONTEXTS; |
| cts_each_dim[4] = 2; |
| optimize_cdf_table( |
| &fc.dc_sign[0][0][0][0][0], probsfile, 5, cts_each_dim, |
| "static const aom_cdf_prob av1_default_dc_sign_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][DC_SIGN_GROUPS][DC_SIGN_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #else |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = PLANE_TYPES; |
| cts_each_dim[2] = DC_SIGN_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table(&fc.dc_sign[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_dc_sign_cdfs" |
| "[TOKEN_CDF_Q_CTXS][PLANE_TYPES][DC_SIGN_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_IMPROVEIDTX_CTXS |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = CROSS_COMPONENT_CONTEXTS; |
| cts_each_dim[2] = DC_SIGN_CONTEXTS; |
| cts_each_dim[3] = 2; |
| optimize_cdf_table( |
| &fc.v_dc_sign[0][0][0][0], probsfile, 4, cts_each_dim, |
| "static const aom_cdf_prob av1_default_v_dc_sign_cdfs" |
| "[TOKEN_CDF_Q_CTXS][CROSS_COMPONENT_CONTEXTS][DC_SIGN_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| |
| cts_each_dim[0] = TOKEN_CDF_Q_CTXS; |
| cts_each_dim[1] = CROSS_COMPONENT_CONTEXTS; |
| cts_each_dim[2] = 2; |
| optimize_cdf_table(&fc.v_ac_sign[0][0][0], probsfile, 3, cts_each_dim, |
| "static const aom_cdf_prob av1_default_v_ac_sign_cdfs" |
| "[TOKEN_CDF_Q_CTXS][CROSS_COMPONENT_CONTEXTS]" |
| "[CDF_SIZE(2)]", |
| 1, &total_count, 0, mem_wanted, "Coefficients"); |
| #endif // CONFIG_CONTEXT_DERIVATION |
| if (mem_wanted) { |
| printf("Total RAM in bits %d \n", total_count); |
| } else { |
| if (statsfile != NULL) { |
| fclose(statsfile); |
| } |
| if (logfile != NULL) { |
| fclose(logfile); |
| } |
| if (probsfile != NULL) { |
| fclose(probsfile); |
| } |
| } |
| return 0; |
| } |