7#include "core/fxcodec/fax/faxmodule.h"
17#include "build/build_config.h"
18#include "core/fxcodec/scanlinedecoder.h"
19#include "core/fxcrt/binary_buffer.h"
20#include "core/fxcrt/check.h"
21#include "core/fxcrt/check_op.h"
22#include "core/fxcrt/compiler_specific.h"
23#include "core/fxcrt/data_vector.h"
24#include "core/fxcrt/fx_2d_size.h"
25#include "core/fxcrt/fx_memcpy_wrappers.h"
26#include "core/fxcrt/fx_memory.h"
27#include "core/fxcrt/numerics/safe_conversions.h"
28#include "core/fxcrt/raw_span.h"
29#include "core/fxcrt/span.h"
30#include "core/fxcrt/span_util.h"
31#include "core/fxcrt/stl_util.h"
32#include "core/fxge/calculate_pitch.h"
35#include "core/fxge/dib/cfx_dibbase.h"
42constexpr std::array<
const uint8_t, 256> kOneLeadPos = {{
43 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
44 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
45 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
48 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
51 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
52 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57constexpr int kFaxMaxImageDimension = 65535;
59constexpr int kFaxBpc = 1;
60constexpr int kFaxComps = 1;
62int FindBit(pdfium::span<
const uint8_t> data_buf,
67 if (start_pos >= max_pos)
70 const uint8_t bit_xor = bit ? 0x00 : 0xff;
71 int bit_offset = start_pos % 8;
73 const int byte_pos = start_pos / 8;
74 uint8_t data = (data_buf[byte_pos] ^ bit_xor) & (0xff >> bit_offset);
76 return byte_pos * 8 + kOneLeadPos[data];
81 const int max_byte = (max_pos + 7) / 8;
82 int byte_pos = start_pos / 8;
85 static constexpr int kBulkReadSize = 8;
86 if (max_byte >= kBulkReadSize && byte_pos < max_byte - kBulkReadSize) {
87 static constexpr uint8_t skip_block_0[kBulkReadSize] = {
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
89 static constexpr uint8_t skip_block_1[kBulkReadSize] = {
90 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
91 const uint8_t* skip_block = bit ? skip_block_0 : skip_block_1;
92 while (byte_pos < max_byte - kBulkReadSize &&
93 memcmp(data_buf.subspan(byte_pos).data(), skip_block,
94 kBulkReadSize) == 0) {
95 byte_pos += kBulkReadSize;
99 while (byte_pos < max_byte) {
100 uint8_t data = data_buf[byte_pos] ^ bit_xor;
102 return std::min(byte_pos * 8 + kOneLeadPos[data], max_pos);
109void FaxG4FindB1B2(pdfium::span<
const uint8_t> ref_buf,
115 bool first_bit = a0 < 0 || (ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0;
116 *b1 = FindBit(ref_buf, columns, a0 + 1, !first_bit);
117 if (*b1 >= columns) {
121 if (first_bit == !a0color) {
122 *b1 = FindBit(ref_buf, columns, *b1 + 1, first_bit);
123 first_bit = !first_bit;
125 if (*b1 >= columns) {
129 *b2 = FindBit(ref_buf, columns, *b1 + 1, first_bit);
132void FaxFillBits(uint8_t* dest_buf,
int columns,
int startpos,
int endpos) {
133 startpos =
std::max(startpos, 0);
134 endpos =
std::clamp(endpos, 0, columns);
135 if (startpos >= endpos) {
138 int first_byte = startpos / 8;
139 int last_byte = (endpos - 1) / 8;
140 if (first_byte == last_byte) {
141 for (
int i = startpos % 8; i <= (endpos - 1) % 8; ++i) {
146 for (
int i = startpos % 8; i < 8; ++i) {
149 for (
int i = 0; i <= (endpos - 1) % 8; ++i) {
152 if (last_byte > first_byte + 1) {
158inline bool NextBit(
const uint8_t* src_buf,
int* bitpos) {
159 int pos = (*bitpos)++;
160 return !!
UNSAFE_TODO((src_buf[pos / 8] & (1 << (7 - pos % 8))));
163const uint8_t kFaxBlackRunIns[] = {
164 0, 2, 0x02, 3, 0, 0x03,
166 0x03, 4, 0, 2, 0x02, 6,
167 0, 0x03, 5, 0, 1, 0x03,
169 0x05, 8, 0, 3, 0x04, 10,
170 0, 0x05, 11, 0, 0x07, 12,
171 0, 2, 0x04, 13, 0, 0x07,
172 14, 0, 1, 0x18, 15, 0,
173 5, 0x08, 18, 0, 0x0f, 64,
174 0, 0x17, 16, 0, 0x18, 17,
175 0, 0x37, 0, 0, 10, 0x08,
176 0x00, 0x07, 0x0c, 0x40, 0x07, 0x0d,
177 0x80, 0x07, 0x17, 24, 0, 0x18,
178 25, 0, 0x28, 23, 0, 0x37,
179 22, 0, 0x67, 19, 0, 0x68,
180 20, 0, 0x6c, 21, 0, 54,
181 0x12, 1984 % 256, 1984 / 256, 0x13, 2048 % 256, 2048 / 256,
182 0x14, 2112 % 256, 2112 / 256, 0x15, 2176 % 256, 2176 / 256,
183 0x16, 2240 % 256, 2240 / 256, 0x17, 2304 % 256, 2304 / 256,
184 0x1c, 2368 % 256, 2368 / 256, 0x1d, 2432 % 256, 2432 / 256,
185 0x1e, 2496 % 256, 2496 / 256, 0x1f, 2560 % 256, 2560 / 256,
186 0x24, 52, 0, 0x27, 55, 0,
187 0x28, 56, 0, 0x2b, 59, 0,
188 0x2c, 60, 0, 0x33, 320 % 256, 320 / 256,
189 0x34, 384 % 256, 384 / 256, 0x35, 448 % 256, 448 / 256,
190 0x37, 53, 0, 0x38, 54, 0,
191 0x52, 50, 0, 0x53, 51, 0,
192 0x54, 44, 0, 0x55, 45, 0,
193 0x56, 46, 0, 0x57, 47, 0,
194 0x58, 57, 0, 0x59, 58, 0,
195 0x5a, 61, 0, 0x5b, 256 % 256, 256 / 256,
196 0x64, 48, 0, 0x65, 49, 0,
197 0x66, 62, 0, 0x67, 63, 0,
198 0x68, 30, 0, 0x69, 31, 0,
199 0x6a, 32, 0, 0x6b, 33, 0,
200 0x6c, 40, 0, 0x6d, 41, 0,
201 0xc8, 128, 0, 0xc9, 192, 0,
202 0xca, 26, 0, 0xcb, 27, 0,
203 0xcc, 28, 0, 0xcd, 29, 0,
204 0xd2, 34, 0, 0xd3, 35, 0,
205 0xd4, 36, 0, 0xd5, 37, 0,
206 0xd6, 38, 0, 0xd7, 39, 0,
207 0xda, 42, 0, 0xdb, 43, 0,
208 20, 0x4a, 640 % 256, 640 / 256, 0x4b, 704 % 256,
209 704 / 256, 0x4c, 768 % 256, 768 / 256, 0x4d, 832 % 256,
210 832 / 256, 0x52, 1280 % 256, 1280 / 256, 0x53, 1344 % 256,
211 1344 / 256, 0x54, 1408 % 256, 1408 / 256, 0x55, 1472 % 256,
212 1472 / 256, 0x5a, 1536 % 256, 1536 / 256, 0x5b, 1600 % 256,
213 1600 / 256, 0x64, 1664 % 256, 1664 / 256, 0x65, 1728 % 256,
214 1728 / 256, 0x6c, 512 % 256, 512 / 256, 0x6d, 576 % 256,
215 576 / 256, 0x72, 896 % 256, 896 / 256, 0x73, 960 % 256,
216 960 / 256, 0x74, 1024 % 256, 1024 / 256, 0x75, 1088 % 256,
217 1088 / 256, 0x76, 1152 % 256, 1152 / 256, 0x77, 1216 % 256,
220const uint8_t kFaxWhiteRunIns[] = {
222 0, 0x08, 3, 0, 0x0B, 4,
223 0, 0x0C, 5, 0, 0x0E, 6,
224 0, 0x0F, 7, 0, 6, 0x07,
225 10, 0, 0x08, 11, 0, 0x12,
226 128, 0, 0x13, 8, 0, 0x14,
227 9, 0, 0x1b, 64, 0, 9,
228 0x03, 13, 0, 0x07, 1, 0,
229 0x08, 12, 0, 0x17, 192, 0,
230 0x18, 1664 % 256, 1664 / 256, 0x2a, 16, 0,
231 0x2B, 17, 0, 0x34, 14, 0,
232 0x35, 15, 0, 12, 0x03, 22,
233 0, 0x04, 23, 0, 0x08, 20,
234 0, 0x0c, 19, 0, 0x13, 26,
235 0, 0x17, 21, 0, 0x18, 28,
236 0, 0x24, 27, 0, 0x27, 18,
237 0, 0x28, 24, 0, 0x2B, 25,
238 0, 0x37, 256 % 256, 256 / 256, 42, 0x02,
239 29, 0, 0x03, 30, 0, 0x04,
240 45, 0, 0x05, 46, 0, 0x0a,
241 47, 0, 0x0b, 48, 0, 0x12,
242 33, 0, 0x13, 34, 0, 0x14,
243 35, 0, 0x15, 36, 0, 0x16,
244 37, 0, 0x17, 38, 0, 0x1a,
245 31, 0, 0x1b, 32, 0, 0x24,
246 53, 0, 0x25, 54, 0, 0x28,
247 39, 0, 0x29, 40, 0, 0x2a,
248 41, 0, 0x2b, 42, 0, 0x2c,
249 43, 0, 0x2d, 44, 0, 0x32,
250 61, 0, 0x33, 62, 0, 0x34,
251 63, 0, 0x35, 0, 0, 0x36,
252 320 % 256, 320 / 256, 0x37, 384 % 256, 384 / 256, 0x4a,
253 59, 0, 0x4b, 60, 0, 0x52,
254 49, 0, 0x53, 50, 0, 0x54,
255 51, 0, 0x55, 52, 0, 0x58,
256 55, 0, 0x59, 56, 0, 0x5a,
257 57, 0, 0x5b, 58, 0, 0x64,
258 448 % 256, 448 / 256, 0x65, 512 % 256, 512 / 256, 0x67,
259 640 % 256, 640 / 256, 0x68, 576 % 256, 576 / 256, 16,
260 0x98, 1472 % 256, 1472 / 256, 0x99, 1536 % 256, 1536 / 256,
261 0x9a, 1600 % 256, 1600 / 256, 0x9b, 1728 % 256, 1728 / 256,
262 0xcc, 704 % 256, 704 / 256, 0xcd, 768 % 256, 768 / 256,
263 0xd2, 832 % 256, 832 / 256, 0xd3, 896 % 256, 896 / 256,
264 0xd4, 960 % 256, 960 / 256, 0xd5, 1024 % 256, 1024 / 256,
265 0xd6, 1088 % 256, 1088 / 256, 0xd7, 1152 % 256, 1152 / 256,
266 0xd8, 1216 % 256, 1216 / 256, 0xd9, 1280 % 256, 1280 / 256,
267 0xda, 1344 % 256, 1344 / 256, 0xdb, 1408 % 256, 1408 / 256,
268 0, 3, 0x08, 1792 % 256, 1792 / 256, 0x0c,
269 1856 % 256, 1856 / 256, 0x0d, 1920 % 256, 1920 / 256, 10,
270 0x12, 1984 % 256, 1984 / 256, 0x13, 2048 % 256, 2048 / 256,
271 0x14, 2112 % 256, 2112 / 256, 0x15, 2176 % 256, 2176 / 256,
272 0x16, 2240 % 256, 2240 / 256, 0x17, 2304 % 256, 2304 / 256,
273 0x1c, 2368 % 256, 2368 / 256, 0x1d, 2432 % 256, 2432 / 256,
274 0x1e, 2496 % 256, 2496 / 256, 0x1f, 2560 % 256, 2560 / 256,
278int FaxGetRun(pdfium::span<
const uint8_t> ins_array,
279 const uint8_t* src_buf,
285 uint8_t ins = ins_array[ins_off++];
289 if (*bitpos >= bitsize)
294 if (src_buf[*bitpos / 8] & (1 << (7 - *bitpos % 8))) {
299 int next_off = ins_off + ins * 3;
300 for (; ins_off < next_off; ins_off += 3) {
301 if (ins_array[ins_off] == code)
302 return ins_array[ins_off + 1] + ins_array[ins_off + 2] * 256;
307void FaxG4GetRow(
const uint8_t* src_buf,
311 pdfium::span<
const uint8_t> ref_buf,
316 if (*bitpos >= bitsize)
323 FaxG4FindB1B2(ref_buf, columns, a0, a0color, &b1, &b2);
326 if (!NextBit(src_buf, bitpos)) {
327 if (*bitpos >= bitsize)
330 bool bit1 = NextBit(src_buf, bitpos);
331 if (*bitpos >= bitsize)
334 bool bit2 = NextBit(src_buf, bitpos);
336 v_delta = bit2 ? 1 : -1;
340 int run = FaxGetRun(a0color ? pdfium::make_span(kFaxWhiteRunIns)
341 : pdfium::make_span(kFaxBlackRunIns),
342 src_buf, bitpos, bitsize);
354 FaxFillBits(dest_buf, columns, a0, a1);
358 int run = FaxGetRun(a0color ? pdfium::make_span(kFaxBlackRunIns)
359 : pdfium::make_span(kFaxWhiteRunIns),
360 src_buf, bitpos, bitsize);
369 FaxFillBits(dest_buf, columns, a1, a2);
377 if (*bitpos >= bitsize)
380 if (NextBit(src_buf, bitpos)) {
382 FaxFillBits(dest_buf, columns, a0, b2);
391 if (*bitpos >= bitsize)
394 bool next_bit1 = NextBit(src_buf, bitpos);
395 if (*bitpos >= bitsize)
398 bool next_bit2 = NextBit(src_buf, bitpos);
400 v_delta = next_bit2 ? 2 : -2;
401 }
else if (next_bit2) {
402 if (*bitpos >= bitsize)
405 v_delta = NextBit(src_buf, bitpos) ? 3 : -3;
407 if (*bitpos >= bitsize)
410 if (NextBit(src_buf, bitpos)) {
421 FaxFillBits(dest_buf, columns, a0, a1);
435void FaxSkipEOL(
const uint8_t* src_buf,
int bitsize,
int* bitpos) {
436 int startbit = *bitpos;
437 while (*bitpos < bitsize) {
438 if (!NextBit(src_buf, bitpos))
440 if (*bitpos - startbit <= 11)
446void FaxGet1DLine(
const uint8_t* src_buf,
454 if (*bitpos >= bitsize)
459 int run = FaxGetRun(color ? pdfium::make_span(kFaxWhiteRunIns)
460 : pdfium::make_span(kFaxBlackRunIns),
461 src_buf, bitpos, bitsize);
463 while (*bitpos < bitsize) {
464 if (NextBit(src_buf, bitpos))
474 FaxFillBits(dest_buf, columns, startpos, startpos + run_len);
477 if (startpos >= columns)
486 FaxDecoder(pdfium::span<
const uint8_t> src_span,
491 bool EncodedByteAlign,
493 ~FaxDecoder()
override;
496 bool Rewind()
override;
497 pdfium::span<uint8_t> GetNextLine()
override;
498 uint32_t GetSrcOffset()
override;
503 const int m_Encoding;
505 bool m_bByteAlign =
false;
506 const bool m_bEndOfLine;
508 const pdfium::raw_span<
const uint8_t> m_SrcSpan;
509 DataVector<uint8_t> m_ScanlineBuf;
510 DataVector<uint8_t> m_RefBuf;
513FaxDecoder::FaxDecoder(pdfium::span<
const uint8_t> src_span,
518 bool EncodedByteAlign,
528 m_bByteAlign(EncodedByteAlign),
529 m_bEndOfLine(EndOfLine),
532 m_ScanlineBuf(m_Pitch),
535FaxDecoder::~FaxDecoder() {
537 m_pLastScanline = pdfium::span<uint8_t>();
540bool FaxDecoder::Rewind() {
541 fxcrt::Fill(m_RefBuf, 0xff);
546pdfium::span<uint8_t> FaxDecoder::GetNextLine() {
547 int bitsize = pdfium::checked_cast<
int>(m_SrcSpan.size() * 8);
548 FaxSkipEOL(m_SrcSpan.data(), bitsize, &m_bitpos);
549 if (m_bitpos >= bitsize)
550 return pdfium::span<uint8_t>();
552 fxcrt::Fill(m_ScanlineBuf, 0xff);
553 if (m_Encoding < 0) {
554 FaxG4GetRow(m_SrcSpan.data(), bitsize, &m_bitpos, m_ScanlineBuf.data(),
555 m_RefBuf, m_OrigWidth);
556 m_RefBuf = m_ScanlineBuf;
557 }
else if (m_Encoding == 0) {
558 FaxGet1DLine(m_SrcSpan.data(), bitsize, &m_bitpos, m_ScanlineBuf.data(),
561 if (NextBit(m_SrcSpan.data(), &m_bitpos)) {
562 FaxGet1DLine(m_SrcSpan.data(), bitsize, &m_bitpos, m_ScanlineBuf.data(),
565 FaxG4GetRow(m_SrcSpan.data(), bitsize, &m_bitpos, m_ScanlineBuf.data(),
566 m_RefBuf, m_OrigWidth);
568 m_RefBuf = m_ScanlineBuf;
571 FaxSkipEOL(m_SrcSpan.data(), bitsize, &m_bitpos);
573 if (m_bByteAlign && m_bitpos < bitsize) {
574 int bitpos0 = m_bitpos;
575 int bitpos1 = FxAlignToBoundary<8>(m_bitpos);
576 while (m_bByteAlign && bitpos0 < bitpos1) {
577 int bit = m_SrcSpan[bitpos0 / 8] & (1 << (7 - bitpos0 % 8));
579 m_bByteAlign =
false;
588 return m_ScanlineBuf;
591uint32_t FaxDecoder::GetSrcOffset() {
592 return pdfium::checked_cast<uint32_t>(
593 std::min<size_t>((m_bitpos + 7) / 8, m_SrcSpan.size()));
596void FaxDecoder::InvertBuffer() {
597 auto byte_span = pdfium::make_span(m_ScanlineBuf);
598 auto data =
fxcrt::reinterpret_span<uint32_t>(byte_span);
599 for (
auto& datum : data) {
607std::unique_ptr<ScanlineDecoder>
FaxModule::CreateDecoder(
608 pdfium::span<
const uint8_t> src_span,
613 bool EncodedByteAlign,
617 int actual_width = Columns ? Columns : width;
618 int actual_height = Rows ? Rows : height;
621 if (actual_width <= 0 || actual_height <= 0)
625 if (actual_width > kFaxMaxImageDimension ||
626 actual_height > kFaxMaxImageDimension) {
630 return std::make_unique<FaxDecoder>(src_span, actual_width, actual_height, K,
631 EndOfLine, EncodedByteAlign, BlackIs1);
635int FaxModule::FaxG4Decode(pdfium::span<
const uint8_t> src_span,
643 const uint8_t* src_buf = src_span.data();
644 uint32_t src_size =
pdfium::checked_cast<uint32_t>(src_span.size());
646 DataVector<uint8_t> ref_buf(pitch, 0xff);
647 int bitpos = starting_bitpos;
648 for (
int iRow = 0; iRow < height; ++iRow) {
649 uint8_t* line_buf =
UNSAFE_TODO(dest_buf + iRow * pitch);
651 FaxG4GetRow(src_buf, src_size << 3, &bitpos, line_buf, ref_buf, width);
652 UNSAFE_TODO(FXSYS_memcpy(ref_buf.data(), line_buf, pitch));
660 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4,
661 0x03, 5, 0x05, 6, 0x04, 6, 0x04, 7, 0x05, 7, 0x07, 7, 0x04, 8,
662 0x07, 8, 0x18, 9, 0x17, 10, 0x18, 10, 0x08, 10, 0x67, 11, 0x68, 11,
663 0x6c, 11, 0x37, 11, 0x28, 11, 0x17, 11, 0x18, 11, 0xca, 12, 0xcb, 12,
664 0xcc, 12, 0xcd, 12, 0x68, 12, 0x69, 12, 0x6a, 12, 0x6b, 12, 0xd2, 12,
665 0xd3, 12, 0xd4, 12, 0xd5, 12, 0xd6, 12, 0xd7, 12, 0x6c, 12, 0x6d, 12,
666 0xda, 12, 0xdb, 12, 0x54, 12, 0x55, 12, 0x56, 12, 0x57, 12, 0x64, 12,
667 0x65, 12, 0x52, 12, 0x53, 12, 0x24, 12, 0x37, 12, 0x38, 12, 0x27, 12,
668 0x28, 12, 0x58, 12, 0x59, 12, 0x2b, 12, 0x2c, 12, 0x5a, 12, 0x66, 12,
673 0x0f, 10, 0xc8, 12, 0xc9, 12, 0x5b, 12, 0x33, 12, 0x34, 12, 0x35, 12,
674 0x6c, 13, 0x6d, 13, 0x4a, 13, 0x4b, 13, 0x4c, 13, 0x4d, 13, 0x72, 13,
675 0x73, 13, 0x74, 13, 0x75, 13, 0x76, 13, 0x77, 13, 0x52, 13, 0x53, 13,
676 0x54, 13, 0x55, 13, 0x5a, 13, 0x5b, 13, 0x64, 13, 0x65, 13, 0x08, 11,
677 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12,
678 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12,
682 0x35, 8, 0x07, 6, 0x07, 4, 0x08, 4, 0x0B, 4, 0x0C, 4, 0x0E, 4, 0x0F, 4,
683 0x13, 5, 0x14, 5, 0x07, 5, 0x08, 5, 0x08, 6, 0x03, 6, 0x34, 6, 0x35, 6,
684 0x2a, 6, 0x2B, 6, 0x27, 7, 0x0c, 7, 0x08, 7, 0x17, 7, 0x03, 7, 0x04, 7,
685 0x28, 7, 0x2B, 7, 0x13, 7, 0x24, 7, 0x18, 7, 0x02, 8, 0x03, 8, 0x1a, 8,
686 0x1b, 8, 0x12, 8, 0x13, 8, 0x14, 8, 0x15, 8, 0x16, 8, 0x17, 8, 0x28, 8,
687 0x29, 8, 0x2a, 8, 0x2b, 8, 0x2c, 8, 0x2d, 8, 0x04, 8, 0x05, 8, 0x0a, 8,
688 0x0b, 8, 0x52, 8, 0x53, 8, 0x54, 8, 0x55, 8, 0x24, 8, 0x25, 8, 0x58, 8,
689 0x59, 8, 0x5a, 8, 0x5b, 8, 0x4a, 8, 0x4b, 8, 0x32, 8, 0x33, 8, 0x34, 8,
693 0x1b, 5, 0x12, 5, 0x17, 6, 0x37, 7, 0x36, 8, 0x37, 8, 0x64, 8,
694 0x65, 8, 0x68, 8, 0x67, 8, 0xcc, 9, 0xcd, 9, 0xd2, 9, 0xd3, 9,
695 0xd4, 9, 0xd5, 9, 0xd6, 9, 0xd7, 9, 0xd8, 9, 0xd9, 9, 0xda, 9,
696 0xdb, 9, 0x98, 9, 0x99, 9, 0x9a, 9, 0x18, 6, 0x9b, 9, 0x08, 11,
697 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12,
698 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12,
747 while (
run >= 2560) {
778 }
else if (
a1 -
b1 <= 3 &&
b1 -
a1 <= 3) {
ScanlineDecoder(int nOrigWidth, int nOrigHeight, int nOutputWidth, int nOutputHeight, int nComps, int nBpc, uint32_t nPitch)
UNSAFE_BUFFER_USAGE void * FXSYS_memset(void *ptr1, int val, size_t len)
uint32_t CalculatePitch32OrDie(int bits_per_pixel, int width_in_pixels)