Enhance README.md with comprehensive project documentation#14
Conversation
Co-authored-by: SureshKViswanathan <257696045+SureshKViswanathan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR expands README.md to provide comprehensive project documentation for JLSwift, including module overviews, API usage examples, JPEG-LS context, build/test instructions, and contributor guidance.
Changes:
- Added an Overview section with library design goals and a module summary table.
- Expanded JLSwift and JPEGLS documentation with API tables, usage examples, and implementation/architecture details.
- Added build/test/coverage guidance, project structure, and contributing checklist.
| - **Platforms**: Linux, macOS 12+ (Monterey), iOS 15+ | ||
| - **Primary Target**: Apple Silicon (M1/M2/M3) with ARM64 optimizations |
There was a problem hiding this comment.
The README lists specific minimum platforms (macOS 12+ / iOS 15+) and a "Primary Target" requirement, but Package.swift does not declare any platforms constraints. Either add explicit platforms: [...] in the package manifest to match these requirements, or loosen/clarify this section to reflect what is actually enforced/tested by the package configuration (e.g., Linux + macOS as covered by CI).
| - **Platforms**: Linux, macOS 12+ (Monterey), iOS 15+ | |
| - **Primary Target**: Apple Silicon (M1/M2/M3) with ARM64 optimizations | |
| - **Supported Platforms**: Linux and macOS (as covered by CI); other platforms are supported where compatible with Swift 6.2+ | |
| - **Performance Optimization**: Tuned for Apple Silicon (M1/M2/M3) with ARM64 optimizations, but usable on other supported architectures |
|
|
||
| - **Type Safety**: Leverages Swift 6.2+ strict concurrency and type system | ||
| - **Performance**: Optimized implementations with support for hardware acceleration | ||
| - **Reliability**: Comprehensive test coverage exceeding 95% for all modules |
There was a problem hiding this comment.
The reliability bullet says coverage exceeds 95% "for all modules", but the CI workflow computes a single aggregated coverage percentage across all files under /Sources/ (it does not enforce per-module/per-target coverage). Consider rewording this to "overall source coverage >95%" (or adjust CI to check coverage per module if that’s the intended guarantee).
| - **Reliability**: Comprehensive test coverage exceeding 95% for all modules | |
| - **Reliability**: Overall source test coverage exceeding 95% across all modules |
| ├── Core/ # Core codec types and protocols | ||
| │ ├── JPEGLSMarker # JPEG-LS marker segment types | ||
| │ ├── JPEGLSFrameHeader # Frame header structures (ITU-T.87) | ||
| │ ├── JPEGLSScanHeader # Scan header structures | ||
| │ ├── JPEGLSPresetParameters # Preset parameters (MAXVAL, T1-T3, RESET) | ||
| │ ├── JPEGLSContextModel # Context state management (365 contexts) | ||
| │ ├── JPEGLSBitstreamReader/Writer # Bitstream I/O utilities | ||
| │ └── JPEGLSError # Comprehensive error handling | ||
| ├── Encoder/ # Encoding implementation | ||
| │ ├── RegularModeEncoder # Gradient-based encoding (MED prediction) | ||
| │ └── RunModeEncoder # Run-length encoding for flat regions | ||
| ├── Platform/ # Platform-specific optimizations | ||
| │ ├── ARM64/ # Apple Silicon / ARM NEON code | ||
| │ └── x86_64/ # x86-64 specific code (removable) | ||
| └── PlatformProtocols # Protocol-based platform abstraction |
There was a problem hiding this comment.
The JPEGLS architecture tree doesn’t match the current source layout: there is no top-level PlatformProtocols directory, and the bitstream types are JPEGLSBitstreamReader.swift / JPEGLSBitstreamWriter.swift files under Core/ (not JPEGLSBitstreamReader/Writer). Please update the diagram to reflect the actual folder/file names so readers can navigate the codebase accurately.
| ├── Core/ # Core codec types and protocols | |
| │ ├── JPEGLSMarker # JPEG-LS marker segment types | |
| │ ├── JPEGLSFrameHeader # Frame header structures (ITU-T.87) | |
| │ ├── JPEGLSScanHeader # Scan header structures | |
| │ ├── JPEGLSPresetParameters # Preset parameters (MAXVAL, T1-T3, RESET) | |
| │ ├── JPEGLSContextModel # Context state management (365 contexts) | |
| │ ├── JPEGLSBitstreamReader/Writer # Bitstream I/O utilities | |
| │ └── JPEGLSError # Comprehensive error handling | |
| ├── Encoder/ # Encoding implementation | |
| │ ├── RegularModeEncoder # Gradient-based encoding (MED prediction) | |
| │ └── RunModeEncoder # Run-length encoding for flat regions | |
| ├── Platform/ # Platform-specific optimizations | |
| │ ├── ARM64/ # Apple Silicon / ARM NEON code | |
| │ └── x86_64/ # x86-64 specific code (removable) | |
| └── PlatformProtocols # Protocol-based platform abstraction | |
| ├── Core/ # Core codec types and protocols | |
| │ ├── JPEGLSMarker # JPEG-LS marker segment types | |
| │ ├── JPEGLSFrameHeader # Frame header structures (ITU-T.87) | |
| │ ├── JPEGLSScanHeader # Scan header structures | |
| │ ├── JPEGLSPresetParameters # Preset parameters (MAXVAL, T1-T3, RESET) | |
| │ ├── JPEGLSContextModel # Context state management (365 contexts) | |
| │ ├── JPEGLSBitstreamReader.swift # Bitstream read utilities | |
| │ ├── JPEGLSBitstreamWriter.swift # Bitstream write utilities | |
| │ └── JPEGLSError # Comprehensive error handling | |
| ├── Encoder/ # Encoding implementation | |
| │ ├── RegularModeEncoder # Gradient-based encoding (MED prediction) | |
| │ └── RunModeEncoder # Run-length encoding for flat regions | |
| ├── Platform/ # Platform-specific, protocol-driven optimizations | |
| │ ├── ARM64/ # Apple Silicon / ARM NEON code | |
| │ └── x86_64/ # x86-64 specific code (removable) |
| # Run tests for a specific target | ||
| swift test --filter JLSwiftTests | ||
| swift test --filter JPEGLSTests |
There was a problem hiding this comment.
These commands won’t run a specific test target as written: swift test --filter ... filters individual test names/suites, and JLSwiftTests / JPEGLSTests may not match any @Suite/@Test names, resulting in zero tests executed. Use swift test --test-product JLSwiftTests / --test-product JPEGLSTests (optionally combined with --filter for narrowing within that product) to reliably run one test bundle.
| # Run tests for a specific target | |
| swift test --filter JLSwiftTests | |
| swift test --filter JPEGLSTests | |
| # Run tests for a specific test product | |
| swift test --test-product JLSwiftTests | |
| swift test --test-product JPEGLSTests |
| All public types and methods include documentation comments following Swift API Design Guidelines. Use Xcode's Quick Help or generate documentation using DocC: | ||
|
|
||
| ```bash | ||
| # Generate documentation (requires Xcode) | ||
| swift package generate-documentation | ||
| ``` |
There was a problem hiding this comment.
swift package generate-documentation typically requires adding the swift-docc-plugin to Package.swift (and isn’t guaranteed to be available in all toolchains/environments by default). Since the manifest currently has no DocC plugin configured, either document the required Package.swift setup / toolchain prerequisites, or switch to an invocation that matches what the project actually supports.
README lacked detail on API usage, module architecture, and contributor guidance.
Changes
Example additions
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.