@@ -56,6 +56,8 @@ struct astcenc_preset_config
5656 float tune_3partition_early_out_limit_factor;
5757 float tune_2plane_early_out_limit_correlation;
5858 float tune_search_mode0_enable;
59+ float rdo_quality;
60+ unsigned int rdo_dict_size;
5961};
6062
6163/**
@@ -64,22 +66,22 @@ struct astcenc_preset_config
6466static const std::array<astcenc_preset_config, 6> preset_configs_high {{
6567 {
6668 ASTCENC_PRE_FASTEST,
67- 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f, 0.0f
69+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f, 0.0f, 4.0f, 256
6870 }, {
6971 ASTCENC_PRE_FAST,
70- 3, 18, 10, 8, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.90f, 0.0f
72+ 3, 18, 10, 8, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.90f, 0.0f, 2.0f, 1024
7173 }, {
7274 ASTCENC_PRE_MEDIUM,
73- 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 2.5f, 1.1f, 1.05f, 0.95f, 0.0f
75+ 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 2.5f, 1.1f, 1.05f, 0.95f, 0.0f, 1.0f, 4096
7476 }, {
7577 ASTCENC_PRE_THOROUGH,
76- 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.35f, 1.15f, 0.97f, 0.0f
78+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.35f, 1.15f, 0.97f, 0.0f, 0.5f, 4096
7779 }, {
7880 ASTCENC_PRE_VERYTHOROUGH,
79- 4, 256, 128, 64, 98, 4, 6, 8, 6, 4, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 0.0f
81+ 4, 256, 128, 64, 98, 4, 6, 8, 6, 4, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 0.0f, 0.4f, 4096
8082 }, {
8183 ASTCENC_PRE_EXHAUSTIVE,
82- 4, 512, 512, 512, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0.0f
84+ 4, 512, 512, 512, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0.0f, 0.2f, 4096
8385 }
8486}};
8587
@@ -89,22 +91,22 @@ static const std::array<astcenc_preset_config, 6> preset_configs_high {{
8991static const std::array<astcenc_preset_config, 6> preset_configs_mid {{
9092 {
9193 ASTCENC_PRE_FASTEST,
92- 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.80f, 1.0f
94+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.80f, 1.0f, 4.0f, 256
9395 }, {
9496 ASTCENC_PRE_FAST,
95- 3, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f, 1.0f
97+ 3, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f, 1.0f, 2.0f, 1024
9698 }, {
9799 ASTCENC_PRE_MEDIUM,
98- 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.0f, 1.1f, 1.05f, 0.90f, 1.0f
100+ 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.0f, 1.1f, 1.05f, 0.90f, 1.0f, 1.0f, 4096
99101 }, {
100102 ASTCENC_PRE_THOROUGH,
101- 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.4f, 1.2f, 0.95f, 0.0f
103+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.4f, 1.2f, 0.95f, 0.0f, 0.5f, 4096
102104 }, {
103105 ASTCENC_PRE_VERYTHOROUGH,
104- 4, 256, 128, 64, 98, 4, 6, 8, 6, 3, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 0.0f
106+ 4, 256, 128, 64, 98, 4, 6, 8, 6, 3, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 0.0f, 0.4f, 4096
105107 }, {
106108 ASTCENC_PRE_EXHAUSTIVE,
107- 4, 256, 256, 256, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0.0f
109+ 4, 256, 256, 256, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0.0f, 0.2f, 4096
108110 }
109111}};
110112
@@ -114,22 +116,22 @@ static const std::array<astcenc_preset_config, 6> preset_configs_mid {{
114116static const std::array<astcenc_preset_config, 6> preset_configs_low {{
115117 {
116118 ASTCENC_PRE_FASTEST,
117- 2, 10, 6, 4, 40, 2, 2, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.80f, 1.0f
119+ 2, 10, 6, 4, 40, 2, 2, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.80f, 1.0f, 4.0f, 256
118120 }, {
119121 ASTCENC_PRE_FAST,
120- 2, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.85f, 1.0f
122+ 2, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.85f, 1.0f, 2.0f, 1024
121123 }, {
122124 ASTCENC_PRE_MEDIUM,
123- 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.5f, 1.1f, 1.05f, 0.90f, 1.0f
125+ 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.5f, 1.1f, 1.05f, 0.90f, 1.0f, 1.0f, 4096
124126 }, {
125127 ASTCENC_PRE_THOROUGH,
126- 4, 82, 60, 30, 93, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.3f, 1.2f, 0.97f, 1.0f
128+ 4, 82, 60, 30, 93, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.3f, 1.2f, 0.97f, 1.0f, 0.5f, 4096
127129 }, {
128130 ASTCENC_PRE_VERYTHOROUGH,
129- 4, 256, 128, 64, 98, 4, 6, 8, 5, 2, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 1.0f
131+ 4, 256, 128, 64, 98, 4, 6, 8, 5, 2, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f, 1.0f, 0.4f, 4096
130132 }, {
131133 ASTCENC_PRE_EXHAUSTIVE,
132- 4, 256, 256, 256, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 1.0f
134+ 4, 256, 256, 256, 100, 4, 8, 8, 8, 8, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f, 1.0f, 0.2f, 4096
133135 }
134136}};
135137
@@ -533,6 +535,8 @@ astcenc_error astcenc_config_init(
533535 config.tune_3partition_early_out_limit_factor = (*preset_configs)[start].tune_3partition_early_out_limit_factor;
534536 config.tune_2plane_early_out_limit_correlation = (*preset_configs)[start].tune_2plane_early_out_limit_correlation;
535537 config.tune_search_mode0_enable = (*preset_configs)[start].tune_search_mode0_enable;
538+ config.rdo_quality = (*preset_configs)[start].rdo_quality;
539+ config.rdo_dict_size = (*preset_configs)[start].rdo_dict_size;
536540 }
537541 // Start and end node are not the same - so interpolate between them
538542 else
@@ -572,11 +576,16 @@ astcenc_error astcenc_config_init(
572576 config.tune_3partition_early_out_limit_factor = LERP(tune_3partition_early_out_limit_factor);
573577 config.tune_2plane_early_out_limit_correlation = LERP(tune_2plane_early_out_limit_correlation);
574578 config.tune_search_mode0_enable = LERP(tune_search_mode0_enable);
579+ config.rdo_quality = LERP(rdo_quality);
580+ config.rdo_dict_size = LERPUI(rdo_dict_size);
575581 #undef LERP
576582 #undef LERPI
577583 #undef LERPUI
578584 }
579585
586+ config.rdo_max_smooth_block_error_scale = 10.0f;
587+ config.rdo_max_smooth_block_std_dev = 18.0f;
588+
580589 // Set heuristics to the defaults for each color profile
581590 config.cw_r_weight = 1.0f;
582591 config.cw_g_weight = 1.0f;
@@ -655,12 +664,6 @@ astcenc_error astcenc_config_init(
655664 }
656665 config.flags = flags;
657666
658- // These are the reasonable defaults that leverages performance & compression rate
659- config.rdo_quality = 1.0f;
660- config.rdo_dict_size = 4096;
661- config.rdo_max_smooth_block_error_scale = 10.0f;
662- config.rdo_max_smooth_block_std_dev = 18.0f;
663-
664667 return ASTCENC_SUCCESS;
665668}
666669
0 commit comments