@@ -38,29 +38,12 @@ static constexpr uint32_t ASTCENC_BYTES_PER_BLOCK = 16;
38
38
39
39
template <typename T> T sqr (T v) { return v * v; }
40
40
41
+ extern " C" void progress_emitter (float value);
42
+
41
43
extern " C" void rdo_progress_emitter (
42
44
float value
43
45
) {
44
46
static float previous_value = 100 .0f ;
45
- const uint32_t bar_size = 25 ;
46
- auto parts = static_cast <uint32_t >(value / 4 .0f );
47
-
48
- char buffer[bar_size + 3 ];
49
- buffer[0 ] = ' [' ;
50
-
51
- for (uint32_t i = 0 ; i < parts; i++)
52
- {
53
- buffer[i + 1 ] = ' =' ;
54
- }
55
-
56
- for (uint32_t i = parts; i < bar_size; i++)
57
- {
58
- buffer[i + 1 ] = ' ' ;
59
- }
60
-
61
- buffer[bar_size + 1 ] = ' ]' ;
62
- buffer[bar_size + 2 ] = ' \0 ' ;
63
-
64
47
if (previous_value == 100 .0f )
65
48
{
66
49
printf (" \n\n " );
@@ -69,8 +52,7 @@ extern "C" void rdo_progress_emitter(
69
52
}
70
53
previous_value = value;
71
54
72
- printf (" Progress: %s %03.1f%%\r " , buffer, static_cast <double >(value));
73
- fflush (stdout);
55
+ progress_emitter (value);
74
56
}
75
57
76
58
static uint32_t init_rdo_context (
@@ -419,15 +401,11 @@ void rate_distortion_optimize(
419
401
uint32_t zblocks = (image.dim_z + ctx.bsd ->zdim - 1u ) / ctx.bsd ->zdim ;
420
402
uint32_t total_blocks = xblocks * yblocks * zblocks;
421
403
422
- uint32_t blocks_per_task = total_blocks;
423
- if (!ctx.config .rdo_no_multithreading )
424
- {
425
- blocks_per_task = astc::min (ctx.config .rdo_lookback , total_blocks);
426
- // There is no way to losslessly partition the job (sequentially dependent on previous output)
427
- // So we reserve only one task for each thread to minimize the quality impact.
428
- uint32_t partitions = ctx.config .rdo_partitions ? ctx.config .rdo_partitions : ctx.thread_count ;
429
- blocks_per_task = astc::max (blocks_per_task, (total_blocks - 1 ) / partitions + 1 );
430
- }
404
+ uint32_t blocks_per_task = astc::min (ctx.config .rdo_lookback , total_blocks);
405
+ // There is no way to losslessly partition the job (sequentially dependent on previous output)
406
+ // So we reserve up to one task for each thread to minimize the quality impact.
407
+ uint32_t partitions = ctx.config .rdo_partitions ? ctx.config .rdo_partitions : ctx.thread_count ;
408
+ blocks_per_task = astc::max (blocks_per_task, (total_blocks - 1 ) / partitions + 1 );
431
409
432
410
uint32_t total_modified = 0 ;
433
411
while (true )
0 commit comments