Initial Commit

This commit is contained in:
2025-12-13 15:43:11 -05:00
commit 9d49f3e90b
15 changed files with 851 additions and 0 deletions

128
README.md Normal file
View File

@@ -0,0 +1,128 @@
# Chrome
A high-performance C++ port of [negfix8](https://github.com/chrishunt/negfix8) for processing scanned color negative film. Inverts and color-corrects 16-bit linear Rec.709 TIFF images from film scanners.
## Example
<table>
<tr>
<td align="center"><strong>Input (Scanned Negative)</strong></td>
<td align="center"></td>
<td align="center"><strong>Output (Processed)</strong></td>
</tr>
<tr>
<td><img src="test_data/test_input.jpeg" width="400" alt="Scanned negative"></td>
<td align="center">➜<br><code>chrome -cs -sat 50 -exp 1.2</code><br>➜</td>
<td><img src="test_data/current_output_adj.jpeg" width="400" alt="Processed output"></td>
</tr>
</table>
## Performance
| Tool | Time | Speedup |
|------|------|---------|
| negfix8 (original) | 18m 8s | 1x |
| **Chrome** | **~10s** | **~109x** |
*Benchmark: 9098×12160 16-bit TIFF (~332MB) on AMD Ryzen 9 7950X3D (32 threads, 64GB RAM)*
## Features
- LUT-based pixel processing with OpenMP parallelization
- Per-channel gamma correction to neutralize orange mask
- Profile save/load for consistent batch processing
- Optional saturation boost, contrast stretching, exposure adjustment, mirror
## Building
### Dependencies
- CMake 3.x+
- OpenCV (core, imgproc, imgcodecs)
- OpenMP (optional, for parallelization)
#### Ubuntu/Debian
```bash
sudo apt install cmake libopencv-dev
```
#### macOS (Homebrew)
```bash
brew install cmake opencv libomp
```
### Build
```bash
cmake -B build -S .
cmake --build build
```
The executable is built at `build/chrome`.
## Usage
```bash
./build/chrome -i input.tif [-o output.tif] [flags]
```
### Flags
| Flag | Description |
|------|-------------|
| `-g <val>` | Set gamma (default 2.15) |
| `-cs` | Enable contrast stretching |
| `-exp <N>` | Exposure adjustment in stops (-10 to +10) |
| `-sat [N]` | Saturation boost, N=0-100 (default 20 if no value) |
| `-m` | Mirror image horizontally |
| `-r <N>` | Binning/downscale by factor N |
| `-c <file>` | Create profile from image and save (exits after) |
| `-u <file>` | Use existing profile for processing |
### Examples
```bash
# Basic conversion
./build/chrome -i scan.tiff -o output.tiff
# With adjustments (contrast stretch, 50% saturation boost, +1.2 stops exposure)
./build/chrome -i scan.tiff -o output.tiff -cs -sat 50 -exp 1.2
# Create a profile for batch processing
./build/chrome -i scan.tiff -c myfilm.profile
# Apply saved profile to multiple images
./build/chrome -i scan2.tiff -o output2.tiff -u myfilm.profile
```
## Testing
Test files are located in `test_data/`:
| File | Description |
|------|-------------|
| `test_input.tiff` | Sample 16-bit scanned negative |
| `test_expected.tiff` | Reference output from original negfix8 |
| `current_output.tiff` | Chrome output (default settings) |
| `current_output_adj.tiff` | Chrome output with `-cs -sat 50 -exp 1.2` |
```bash
# Basic conversion
./build/chrome -i test_data/test_input.tiff -o test_data/current_output.tiff
# With adjustments (as shown in example above)
./build/chrome -i test_data/test_input.tiff -o test_data/current_output_adj.tiff -cs -sat 50 -exp 1.2
```
## Credits
- Original [negfix8](https://github.com/chrishunt/negfix8) by Chris Hunt
- Original negfix algorithm created by JaZ99
## License
Copyright 2025 DWS (Dubey Web Services, DWS LLC)
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.