Skip to content

Commit 738548b

Browse files
Set up workspace. Document lossless limitations rather than broken tests (#446)
1 parent 66adce8 commit 738548b

6 files changed

Lines changed: 25 additions & 17 deletions

File tree

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ ImageCore = "0.8, 0.9, 0.10"
2525
PrecompileTools = "1"
2626
Scratch = "1"
2727
julia = "1.10"
28+
29+
[workspace]
30+
projects = ["test", "docs"]

docs/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[deps]
2+
VideoIO = "d6d074c3-1acf-5d4c-9a43-ef38773959a2"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34

45
[compat]
56
Documenter = "1"
7+
8+
[sources]
9+
VideoIO = {path = ".."}

docs/src/writing.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ VideoIO.close_video_out!
6969
```
7070

7171
## Supported Colortypes
72-
Encoding of the following image element color types currently supported:
72+
Encoding of the following image element color types is currently supported:
7373
- `UInt8`
7474
- `Gray{N0f8}`
75+
- `Gray{N6f10}`
7576
- `RGB{N0f8}`
77+
- `RGB{N6f10}`
7678

7779
## Encoder Options
7880

@@ -101,5 +103,11 @@ If lossless encoding of `RGB{N0f8}` is required, _true_ lossless requires passin
101103
If lossless encoding of `Gray{N0f8}` or `UInt8` is required, `crf=0` should be set, as well as `color_range=2` to ensure full 8-bit pixel color representation. i.e.
102104
```(color_range=2, crf=0, preset="medium")```
103105

106+
### 10-bit Limitations
107+
Pixel-exact round-trip encoding is **not** guaranteed for 10-bit types (`Gray{N6f10}` and `RGB{N6f10}`):
108+
109+
- **`Gray{N6f10}`**: libx264 stores the data as `yuv420p10le` internally. On decode, the Y-plane values are converted back via a YUV→gray sws transform, which introduces small rounding errors (~1–10 counts out of 1023). The video is still perceptually lossless, but bitwise identical frames cannot be guaranteed.
110+
- **`RGB{N6f10}`**: libx264rgb does not support 10-bit RGB. Frames are silently downsampled to 8-bit (`bgr24`) during encoding, making this inherently lossy. For 10-bit RGB, consider a codec that natively supports it (e.g. `ffv1`).
111+
104112
### Encoding Performance
105113
See [`util/lossless_video_encoding_testing.jl`](https://github.com/JuliaIO/VideoIO.jl/blob/master/util/lossless_video_encoding_testing.jl) for testing of losslessness, speed, and compression as a function of h264 encoding preset, for 3 example videos.

test/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
VideoIO = "d6d074c3-1acf-5d4c-9a43-ef38773959a2"
23
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
34
ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4"
45
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
@@ -11,3 +12,6 @@ Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
1112
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1213
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1314
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
15+
16+
[sources]
17+
VideoIO = {path = ".."}

test/reading.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,10 @@
130130
if occursin("annie_oakley", name)
131131
framestack = VideoIO.load(testvid_path)
132132
@test length(framestack) == VideoIO.TestVideos.videofiles[name].numframes
133-
# TODO: Replace this with a content check as summarysize is not stable across julia versions
134-
if VERSION < v"1.6.3" || VERSION > v"1.11.0-0"
135-
@test_broken Base.summarysize(framestack) == VideoIO.TestVideos.videofiles[name].summarysize
136-
else
137-
@test Base.summarysize(framestack) == VideoIO.TestVideos.videofiles[name].summarysize
138-
end
133+
# summarysize is not stable across Julia versions, so only test frame count
139134
f = File{DataFormat{:OGG}}(testvid_path)
140135
framestack = VideoIO.fileio_load(f)
141136
@test length(framestack) == VideoIO.TestVideos.videofiles[name].numframes
142-
# TODO: Replace this with a content check as summarysize is not stable across julia versions
143-
if VERSION < v"1.6.3" || VERSION > v"1.11.0-0"
144-
@test_broken Base.summarysize(framestack) == VideoIO.TestVideos.videofiles[name].summarysize
145-
else
146-
@test Base.summarysize(framestack) == VideoIO.TestVideos.videofiles[name].summarysize
147-
end
148137
path, io = mktemp()
149138
f = File{DataFormat{:MP4}}(path * ".mp4")
150139
VideoIO.fileio_save(f, framestack)

test/writing.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ end
7474
img = read(f)
7575
test_img = scanline_arg ? parent(img) : img
7676
i = 1
77+
# N6f10 types are not losslessly roundtripped by libx264/libx264rgb:
78+
# libx264 encodes gray10le as yuv420p10le internally, and libx264rgb
79+
# does not support 10-bit RGB at all (silently encodes as 8-bit).
80+
# Pixel-exact roundtrip is therefore not expected for N6f10.
7781
if el in [Gray{N0f8}, RGB{N0f8}]
7882
@test test_img == img_stack[i]
79-
else
80-
@test_broken test_img == img_stack[i]
8183
end
8284
while !eof(f) && i < n
8385
read!(f, img)
8486
i += 1
8587
if el in [Gray{N0f8}, RGB{N0f8}]
8688
@test test_img == img_stack[i]
87-
else
88-
@test_broken test_img == img_stack[i]
8989
end
9090
end
9191
@test i == n

0 commit comments

Comments
 (0)