From 1182082c5052edc2a5efd2ac263d57e72ecb61d5 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 28 Nov 2023 15:02:32 +0500 Subject: [PATCH] expand quant range, fix band_len calc --- src/util.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.zig b/src/util.zig index 340e672..9066f9b 100644 --- a/src/util.zig +++ b/src/util.zig @@ -55,7 +55,7 @@ pub const JobQueue = struct { pub fn HasJobs(self: *Self) bool { self.mutex.lock(); defer self.mutex.unlock(); - return (self.queue.len == 0); + return (self.queue.len != 0); } }; pub const JobPool = std.heap.MemoryPool(JobQueue.List.Node); @@ -126,11 +126,11 @@ pub const Buffers = struct { pub fn gen_qtable(q_max: usize, q: f16, band_range: usize) @Vector(64, f16) { var ret: @Vector(64, f16) = [_]f16{0.0} ** 64; - const q_min: usize = @intFromFloat(255 - 100 * q); + const q_min: usize = @intFromFloat(255 - 250 * q); var step = (q_max - q_min) / band_range; var idx: usize = 0; for (0..16) |band_i| { - const band_len = band_i + 1; + const band_len = if (band_i < 8) band_i + 1 else 15 - band_i; for (0..band_len) |j| { if (band_i < band_range) { ret[idx + j] = @floatFromInt(q_min + step * band_i);