Commit Graph

4 Commits

Author SHA1 Message Date
Eunchurn Park
76a1c30a87
fix(xtc): address PR review feedback for grayscale rendering
- Use FsHelpers::openFileForRead for consistency (XtcParser.cpp)
- Simplify file extension checking logic (FileSelectionActivity.cpp)
- Fix grayscale rendering bugs (XtcReaderActivity.cpp):
  - Use drawPixel(x, y, false) for LSB/MSB passes (LUT: 0=apply effect)
  - Add cleanupGrayscaleWithFrameBuffer() after re-rendering BW
  - Use conditional HALF_REFRESH based on pagesUntilFullRefresh
  - Decrement refresh counter instead of resetting
- Add cleanupGrayscaleWithFrameBuffer() helper (GfxRenderer)
2025-12-28 20:57:10 +09:00
Eunchurn Park
30c50ef45b
perf(xtc): optimize XTCH grayscale rendering and memory usage
- Remove storeBwBuffer() requirement for grayscale rendering
  - Peak memory reduced from 144KB to 96KB
  - Use 4-pass rendering: BW display → LSB → MSB → grayscale → BW restore

- Optimize PageInfo struct (24→16 bytes)
  - Change offset from uint64_t to uint32_t (4GB file limit)
  - Saves ~15KB for large books (e.g., 1883 pages: 45KB → 30KB)

- Add storeBwBuffer() return value for error handling
- Add pixel distribution logging for debugging
- Fix LSB/MSB grayscale mapping per README spec
2025-12-28 18:04:48 +09:00
Eunchurn Park
4ef35afb4d
feat(xtc): add XTCH format support (2-bit grayscale)
- Add XTCH container format support (.xtch extension)
- Add XTH page format with two bit-plane, column-major storage
- Update XtcParser to handle both XTC/XTCH magic and XTG/XTH pages
- Update XtcReaderActivity for XTH column-major rendering
- Update cover BMP generation for 2-bit grayscale
- Add README with format documentation

XTH format details:
- Two bit planes stored sequentially (Bit1, then Bit2)
- Column-major order, scanned right to left
- 8 vertical pixels per byte (MSB = topmost)
- Grayscale: 0=White, 1=Dark Grey, 2=Light Grey, 3=Black
2025-12-28 12:40:34 +09:00
Eunchurn Park
810066d4f2
feat(xtc): add XTC ebook format support
Add support for XTC (XTeink X4 native) ebook format with pre-rendered
bitmap pages. Key changes:

- Add Xtc library with XtcParser for reading XTC files
- XTC format: 22-byte XTG page headers with 480x800 1-bit bitmaps
- XtcReaderActivity for displaying XTC pages on e-ink display
- Correct bit polarity: 0=black, 1=white in XTC format
- FileSelectionActivity: detect and handle .xtc files
- ReaderActivity: route to XtcReaderActivity for XTC files
- Cover BMP generation from first XTC page

XTC pages include pre-rendered status bar with page numbers and
progress, so no additional overlay is needed.
2025-12-27 19:14:07 +09:00