Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
continue-on-error: ${{ matrix.os == 'macos-latest' }}
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
Expand Down
479 changes: 0 additions & 479 deletions CODEBASE_ANALYSIS.md

This file was deleted.

95 changes: 0 additions & 95 deletions ROBUSTNESS_ANALYSIS.md

This file was deleted.

215 changes: 0 additions & 215 deletions ROBUSTNESS_ROADMAP.md

This file was deleted.

29 changes: 22 additions & 7 deletions src/core/color_space.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,30 @@ const RGBAPixel = types.RGBAPixel;
const YCbCrPixel = types.YCbCrPixel;
const YCbCrImage = types.YCbCrImage;

pub fn rgbToYCbCr(r: u8, g: u8, b: u8) YCbCrPixel {
const rf: f64 = @floatFromInt(r);
const gf: f64 = @floatFromInt(g);
const bf: f64 = @floatFromInt(b);
const Y_R: [256]f64 = buildLut(0.299);
const Y_G: [256]f64 = buildLut(0.587);
const Y_B: [256]f64 = buildLut(0.114);
const Cb_R: [256]f64 = buildLut(-0.168736);
const Cb_G: [256]f64 = buildLut(-0.331264);
const Cb_B: [256]f64 = buildLut(0.5);
const Cr_R: [256]f64 = buildLut(0.5);
const Cr_G: [256]f64 = buildLut(-0.418688);
const Cr_B: [256]f64 = buildLut(-0.081312);

fn buildLut(comptime coeff: f64) [256]f64 {
var t: [256]f64 = undefined;
var i: usize = 0;
inline while (i < 256) : (i += 1) {
t[i] = coeff * @as(f64, @floatFromInt(i));
}
return t;
}

pub fn rgbToYCbCr(r: u8, g: u8, b: u8) YCbCrPixel {
return .{
.y = 0.299 * rf + 0.587 * gf + 0.114 * bf,
.cb = -0.168736 * rf - 0.331264 * gf + 0.5 * bf + 128.0,
.cr = 0.5 * rf - 0.418688 * gf - 0.081312 * bf + 128.0,
.y = Y_R[r] + Y_G[g] + Y_B[b],
.cb = Cb_R[r] + Cb_G[g] + Cb_B[b] + 128.0,
.cr = Cr_R[r] + Cr_G[g] + Cr_B[b] + 128.0,
};
}

Expand Down
Loading
Loading