Skip to content

Commit

Permalink
Refactor dolby_vision crate and improve performance
Browse files Browse the repository at this point in the history
Fixes #197.
Switch reading/writing library to `bitstream-io`.

Peak memory reduced by ~23%, allocations reduced by ~35%.
RPU parsing performance improved by ~40%.
RPU encoding performance improved by ~50%.
  • Loading branch information
quietvoid committed Jan 19, 2023
1 parent 6678885 commit 7f01074
Show file tree
Hide file tree
Showing 51 changed files with 1,962 additions and 2,114 deletions.
92 changes: 48 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ name = "dovi_tool"
version = "1.6.0"
authors = ["quietvoid"]
edition = "2021"
rust-version = "1.63.0"
rust-version = "1.64.0"
license = "MIT"
build = "build.rs"

[dependencies]
bitvec_helpers = "2.0.1"
hevc_parser = { version = "0.5.2", features = ["hevc_io"] }
bitvec_helpers = { version = "3.1.2", default-features = false, features = ["bitstream-io"] }
hevc_parser = { version = "0.6.0", features = ["hevc_io"] }
dolby_vision = { path = "dolby_vision", "features" = ["xml", "serde"] }
madvr_parse = "1.0.1"

anyhow = "1.0.68"
clap = { version = "4.0.32", features = ["derive", "wrap_help", "deprecated"] }
indicatif = "0.17.2"
clap = { version = "4.1.1", features = ["derive", "wrap_help", "deprecated"] }
indicatif = "0.17.3"
regex = "1.7.1"
bitvec = "1.0.1"
serde = { version = "1.0.152", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The **`dolby_vision`** crate is also hosted in this repo, see [README](dolby_vis
## **Building**
### **Toolchain**

The minimum Rust version to build **`dovi_tool`** is 1.63.0.
The minimum Rust version to build **`dovi_tool`** is 1.64.0.

### **Release binary**
To build release binary in `target/release/dovi_tool` run:
Expand Down
4 changes: 2 additions & 2 deletions docs/profiles.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Differentiating between Dolby Vision profiles.
##### Profile 4
Possibly `vdr_bit_depth_minus_8` > 4
Possibly `vdr_bit_depth_minus8` > 4
##### Profile 5
`vdr_rpu_profile = 0`
`bl_video_full_range_flag = 0`
Expand All @@ -10,4 +10,4 @@ Possibly `vdr_bit_depth_minus_8` > 4
`disable_residual_flag = 0`
##### Profile 8
`vdr_rpu_profile = 1`
`el_spatial_resampling_filter_flag = 0`
`el_spatial_resampling_filter_flag = 0`
23 changes: 23 additions & 0 deletions dolby_vision/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 3.0.0
- Breaking changes from `RpuDataMapping` refactor.
- Renamed `serde_feature` to simply `serde`.

- Moved some fields from `RpuDataHeader` into `RpuDataMapping.
- `RpuDataNlq` is now part of `RpuDataMapping`.

- The mapping now has one curve per component, which is a `DoviReshapingCurve`.
- `DoviReshapingCurve` contains the pivots, mapping method and the respective curve params.
- Component 0 describes the polynomial params in `DoviPolynomialCurve`.
- Components 1 and 2 describe can be either polynomial or the MMR params in `DoviMMRCurve`.
- Polynomial interpolation fields were removed as there are no existing samples.

- `RpuDataNlq` was changed to contain only one set of params, as there is no significant pivot.
- All `_minus_X` suffixed names were uniformized as `minusX`.

The changes also affect the C API.

C API:
- Added `dovi_rpu_set_active_area_offsets` function to edit L5 metadata.
- Added `dovi_rpu_remove_mapping` function.


## 2.1.0
- Made some parsing functions private, as they were always meant to be internal only.
- Replaced `DoviRpu::trailing_bytes` by `trailing_zeroes`, which is only the count of the zero bytes.
Expand Down
4 changes: 2 additions & 2 deletions dolby_vision/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dolby_vision"
version = "2.1.0"
version = "3.0.0"
authors = ["quietvoid"]
edition = "2021"
rust-version = "1.60.0"
Expand All @@ -9,7 +9,7 @@ description = "Dolby Vision metadata parsing and writing"
repository = "https://github.com/quietvoid/dovi_tool/tree/main/dolby_vision"

[dependencies]
bitvec_helpers = "2.0.1"
bitvec_helpers = { version = "3.1.2", default-features = false, features = ["bitstream-io"] }
anyhow = "1.0.68"
bitvec = "1.0.1"
crc = "3.0.0"
Expand Down
Loading

0 comments on commit 7f01074

Please sign in to comment.