From 6aa84c775f1c9ec617be7c88676868d683451ff8 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 28 Nov 2023 16:39:01 +0500 Subject: [PATCH] boiler parsing dc coeff, first after start or EOB is always read as dc --- src/output.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/output.zig b/src/output.zig index 3bd687b..3d1e3ef 100644 --- a/src/output.zig +++ b/src/output.zig @@ -57,12 +57,18 @@ const Scan = struct { } }; -fn parse_block(block: *util.BlockQuantized, dc_diff: *i16, dc_rle: *RLE_Seq, dc_freqs: []u32, ac_freqs: []u32) !void { +inline fn get_size(v: i16) u8 { + _ = v; +} + +fn parse_block(block: *util.BlockQuantized, dc_diff: *i16, rle: *RLE_Seq, dc_freqs: []u32, ac_freqs: []u32) !void { _ = ac_freqs; _ = dc_freqs; - _ = dc_rle; - _ = dc_diff; - _ = block; + const diff = block[0] - dc_diff.*; + try rle.append(RLE_Unit{ + .symbol = get_size(diff), + .value = diff, + }); } pub fn generate_jpg(buff: util.Buffers, alloc: std.mem.Allocator) !void {