瀏覽代碼

LibGfx/JPEG: Store previous DC values in `i16`

Forgotten child of cfaa5120.
Lucas CHOLLET 2 年之前
父節點
當前提交
66108d102e
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp

+ 2 - 2
Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp

@@ -250,7 +250,7 @@ struct JPEGLoadingContext {
     u16 dc_restart_interval { 0 };
     u16 dc_restart_interval { 0 };
     HashMap<u8, HuffmanTableSpec> dc_tables;
     HashMap<u8, HuffmanTableSpec> dc_tables;
     HashMap<u8, HuffmanTableSpec> ac_tables;
     HashMap<u8, HuffmanTableSpec> ac_tables;
-    Array<i32, 4> previous_dc_values {};
+    Array<i16, 4> previous_dc_values {};
     MacroblockMeta mblock_meta;
     MacroblockMeta mblock_meta;
     OwnPtr<FixedMemoryStream> stream;
     OwnPtr<FixedMemoryStream> stream;
 
 
@@ -366,7 +366,7 @@ static ErrorOr<void> add_dc(JPEGLoadingContext& context, Macroblock& macroblock,
     }
     }
 
 
     // DC coefficients are encoded as the difference between previous and current DC values.
     // DC coefficients are encoded as the difference between previous and current DC values.
-    i32 dc_diff = TRY(read_huffman_bits(scan.huffman_stream, dc_length));
+    i16 dc_diff = TRY(read_huffman_bits(scan.huffman_stream, dc_length));
 
 
     // If MSB in diff is 0, the difference is -ve. Otherwise +ve.
     // If MSB in diff is 0, the difference is -ve. Otherwise +ve.
     if (dc_length != 0 && dc_diff < (1 << (dc_length - 1)))
     if (dc_length != 0 && dc_diff < (1 << (dc_length - 1)))