| 1 |
|
| 2 |
#pragma once |
| 3 |
#include "basisu_enc.h" |
| 4 |
#include "../transcoder/basisu_astc_hdr_core.h" |
| 5 |
|
| 6 |
namespace astc_6x6_hdr |
| 7 |
{ |
| 8 |
const uint32_t ASTC_HDR_6X6_MAX_USER_COMP_LEVEL = 12; |
| 9 |
|
| 10 |
const uint32_t ASTC_HDR_6X6_MAX_COMP_LEVEL = 4; |
| 11 |
|
| 12 |
const float LDR_BLACK_BIAS = 0.0f; |
| 13 |
|
| 14 |
|
| 15 |
struct astc_hdr_6x6_global_config |
| 16 |
{ |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
bool m_rec2020_bt2100_color_gamut = false; |
| 24 |
|
| 25 |
|
| 26 |
uint32_t m_master_comp_level = 0; |
| 27 |
uint32_t m_highest_comp_level = 1; |
| 28 |
|
| 29 |
float m_lambda = 0.0f; |
| 30 |
|
| 31 |
bool m_extra_patterns_flag = false; |
| 32 |
bool m_brute_force_partition_matching = false; |
| 33 |
|
| 34 |
bool m_jnd_optimization = false; |
| 35 |
float m_jnd_delta_itp_thresh = .75f; |
| 36 |
|
| 37 |
bool m_force_one_strip = false; |
| 38 |
|
| 39 |
bool m_gaussian1_fallback = true; |
| 40 |
float m_gaussian1_strength = 1.45f; |
| 41 |
|
| 42 |
bool m_gaussian2_fallback = true; |
| 43 |
float m_gaussian2_strength = 1.83f; |
| 44 |
|
| 45 |
|
| 46 |
bool m_disable_delta_endpoint_usage = false; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
bool m_delta_itp_dark_adjustment = true; |
| 51 |
|
| 52 |
bool m_debug_images = false; |
| 53 |
std::string m_debug_image_prefix = "dbg_astc_hdr_6x6_devel_"; |
| 54 |
|
| 55 |
bool m_output_images = false; |
| 56 |
std::string m_output_image_prefix = "dbg_astc_hdr_6x6_output_"; |
| 57 |
|
| 58 |
bool m_debug_output = false; |
| 59 |
bool m_image_stats = false; |
| 60 |
bool m_status_output = false; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
bool m_deblocking_flag = true; |
| 66 |
float m_deblock_penalty_weight = .03f; |
| 67 |
bool m_disable_twothree_subsets = false; |
| 68 |
bool m_use_solid_blocks = true; |
| 69 |
bool m_use_runs = true; |
| 70 |
bool m_block_stat_optimizations_flag = true; |
| 71 |
|
| 72 |
bool m_rdo_candidate_diversity_boost = true; |
| 73 |
float m_rdo_candidate_diversity_boost_bit_window_weight = 1.2f; |
| 74 |
|
| 75 |
bool m_favor_higher_compression = true; |
| 76 |
uint32_t m_num_reuse_xy_deltas = basist::astc_6x6_hdr::NUM_REUSE_XY_DELTAS; |
| 77 |
|
| 78 |
void print() const |
| 79 |
{ |
| 80 |
basisu::fmt_debug_printf("m_master_comp_level: {}, m_highest_comp_level: {}\n", m_master_comp_level, m_highest_comp_level); |
| 81 |
basisu::fmt_debug_printf("m_lambda: {}\n", m_lambda); |
| 82 |
basisu::fmt_debug_printf("m_rec2020_bt2100_color_gamut: {}\n", m_rec2020_bt2100_color_gamut); |
| 83 |
basisu::fmt_debug_printf("m_extra_patterns_flag: {}, m_brute_force_partition_matching: {}\n", m_extra_patterns_flag, m_brute_force_partition_matching); |
| 84 |
basisu::fmt_debug_printf("m_jnd_optimization: {}, m_jnd_delta_itp_thresh: {}\n", m_jnd_optimization, m_jnd_delta_itp_thresh); |
| 85 |
basisu::fmt_debug_printf("m_force_one_strip: {}\n", m_force_one_strip); |
| 86 |
basisu::fmt_debug_printf("m_gaussian1_fallback: {}, m_gaussian1_strength: {}\n", m_gaussian1_fallback, m_gaussian1_strength); |
| 87 |
basisu::fmt_debug_printf("m_gaussian2_fallback: {}, m_gaussian2_strength: {}\n", m_gaussian2_fallback, m_gaussian2_strength); |
| 88 |
basisu::fmt_debug_printf("m_disable_delta_endpoint_usage: {}\n", m_disable_delta_endpoint_usage); |
| 89 |
basisu::fmt_debug_printf("m_delta_itp_dark_adjustment: {}\n", m_delta_itp_dark_adjustment); |
| 90 |
basisu::fmt_debug_printf("m_debug_images: {}, m_debug_image_prefix: {}\n", m_debug_images, m_debug_image_prefix); |
| 91 |
basisu::fmt_debug_printf("m_output_images: {}, m_output_image_prefix: {}\n", m_output_images, m_output_image_prefix); |
| 92 |
basisu::fmt_debug_printf("m_image_stats: {}, m_status_output: {}\n", m_image_stats, m_status_output); |
| 93 |
basisu::fmt_debug_printf("m_deblocking_flag: {}, m_deblock_penalty_weight: {}\n", m_deblocking_flag, m_deblock_penalty_weight); |
| 94 |
basisu::fmt_debug_printf("m_disable_twothree_subsets: {}, m_use_solid_blocks: {}\n", m_disable_twothree_subsets, m_use_solid_blocks); |
| 95 |
basisu::fmt_debug_printf("m_use_runs: {}, m_block_stat_optimizations_flag: {}\n", m_use_runs, m_block_stat_optimizations_flag); |
| 96 |
basisu::fmt_debug_printf("m_rdo_candidate_diversity_boost: {}, m_rdo_candidate_diversity_boost_bit_window_weight: {}\n", m_rdo_candidate_diversity_boost, m_rdo_candidate_diversity_boost_bit_window_weight); |
| 97 |
basisu::fmt_debug_printf("m_favor_higher_compression: {}, m_num_reuse_xy_deltas: {}\n", m_favor_higher_compression, m_num_reuse_xy_deltas); |
| 98 |
} |
| 99 |
|
| 100 |
astc_hdr_6x6_global_config() |
| 101 |
{ |
| 102 |
} |
| 103 |
|
| 104 |
void clear() |
| 105 |
{ |
| 106 |
astc_hdr_6x6_global_config def; |
| 107 |
std::swap(*this, def); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
void set_user_level(int level); |
| 112 |
}; |
| 113 |
|
| 114 |
void global_init(); |
| 115 |
|
| 116 |
struct result_metrics |
| 117 |
{ |
| 118 |
basisu::image_metrics m_im_astc_log2; |
| 119 |
basisu::image_metrics m_im_astc_half; |
| 120 |
|
| 121 |
basisu::image_metrics m_im_bc6h_log2; |
| 122 |
basisu::image_metrics m_im_bc6h_half; |
| 123 |
}; |
| 124 |
|
| 125 |
|
| 126 |
bool compress_photo(const basisu::imagef& orig_src_img, const astc_hdr_6x6_global_config& global_cfg, basisu::job_pool* pJob_pool, |
| 127 |
basisu::uint8_vec& intermediate_tex_data, basisu::uint8_vec& astc_tex_data, result_metrics& metrics); |
| 128 |
|
| 129 |
} |