Skip to content

Commit 84bf695

Browse files
committed
Use simple min/max rather than select
1 parent e0c19a2 commit 84bf695

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

Source/astcenc_weight_align.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,9 @@ static void compute_lowest_and_highest_weight_lwc(
379379
vfloat diff = sval - svalrte;
380380
errval += diff * diff;
381381

382-
// Reset tracker on min hit
383-
vmask mask = svalrte < minidx;
384-
minidx = select(minidx, svalrte, mask);
385-
386-
// Reset tracker on max hit
387-
mask = svalrte > maxidx;
388-
maxidx = select(maxidx, svalrte, mask);
382+
// Compute min and max quantized weight spans for each step
383+
minidx = min(minidx, svalrte);
384+
maxidx = max(maxidx, svalrte);
389385
}
390386

391387
// Write out min weight and weight span; clamp span to a usable range
@@ -395,8 +391,8 @@ static void compute_lowest_and_highest_weight_lwc(
395391
storea(minidx, &lowest_weight[sp]);
396392
storea(span, &weight_span[sp]);
397393

398-
// The cut_(lowest/highest)_weight_error indicate the error that results from forcing
399-
// samples that should have had the weight value one step (up/down).
394+
// The cut_(lowest/highest)_weight_error indicate the error that results from
395+
// forcing samples that should have had the weight value one step (up/down).
400396
vfloat ssize = 1.0f / rcp_stepsize;
401397
vfloat errscale = ssize * ssize;
402398
storea(errval * errscale, &error[sp]);

0 commit comments

Comments
 (0)