Giter VIP home page Giter VIP logo

rusvid's People

Contributors

dependabot[bot] avatar letsmelon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rusvid's Issues

cargo mutants outout on `rusvid_lib`

  • src/renderer/png.rs:32: replace ::render -> anyhow::Result<()> with Ok(Default::default()) ... NOT CAUGHT in 1.861s
  • src/composition/comp.rs:86: replace ::pixels -> usize with Default::default() ... NOT CAUGHT in 1.692s
  • src/renderer/ffmpeg/pixel_formats.rs:27: replace ::build_cli_argument -> Vec with Default::default() ... NOT CAUGHT in 1.662s
  • src/animation/curves/mod.rs:63: replace ::eq -> bool with true ... NOT CAUGHT in 1.884s
  • src/utils.rs:52: replace apply_to with () ... NOT CAUGHT in 1.777s
  • src/animation/curves/mod.rs:115: replace Points::zero_2d -> Self with Default::default() ... NOT CAUGHT in 1.816s
  • src/renderer/ffmpeg/pixel_formats.rs:18: replace ::to_string -> String with "".into() ... NOT CAUGHT in 1.671s
  • src/renderer/ffmpeg/codec.rs:13: replace ::to_string -> String with "xyzzy".into() ... NOT CAUGHT in 1.697s
  • src/animation/curves/mod.rs:75: replace Points::equal_delta -> bool with true ... NOT CAUGHT in 1.779s
  • src/figures/circle.rs:22: replace ::eq -> bool with false ... NOT CAUGHT in 1.649s
  • src/resolution.rs:36: replace ::frames -> usize with Default::default() ... NOT CAUGHT in 1.649s
  • src/renderer/ffmpeg/h264.rs:79: replace ::build_cli_argument -> Vec with Default::default() ... NOT CAUGHT in 1.660s
  • src/composition/comp.rs:31: replace Composition::builder -> CompositionBuilder with Default::default() ... NOT CAUGHT in 1.681s
  • src/utils.rs:25: replace set_path with () ... NOT CAUGHT in 1.785s
  • src/resolution.rs:48: replace ::bytes -> usize with Default::default() ... NOT CAUGHT in 1.661s
  • src/composition/comp.rs:82: replace ::frames -> usize with Default::default() ... NOT CAUGHT in 1.644s
  • src/figures/triangle.rs:20: replace equilateral_triangle -> PathData with Default::default() ... NOT CAUGHT in 1.757s
  • src/animation/curves/s.rs:154: replace ::internal_debug -> std::fmt::Result with Ok(Default::default()) ... NOT CAUGHT in 1.631s
  • src/renderer/ffmpeg/mod.rs:66: replace ::render -> Result<()> with Ok(Default::default()) ... NOT CAUGHT in 1.862s
  • src/animation/curves/linear.rs:75: replace ::internal_debug -> std::fmt::Result with Ok(Default::default()) ... NOT CAUGHT in 1.744s
  • src/renderer/png.rs:23: replace ::file_extension -> String with "".into() ... NOT CAUGHT in 1.665s
  • src/renderer/ffmpeg/h264.rs:45: replace ::build_cli_argument -> Vec with Default::default() ... NOT CAUGHT in 1.679s
  • src/composition/comp.rs:92: replace ::bytes -> usize with Default::default() ... NOT CAUGHT in 1.646s
  • src/animation/curves/mod.rs:129: replace ::from -> Self with Default::default() ... NOT CAUGHT in 1.658s
  • src/animation/curves/s.rs:97: replace ::delta_raw -> Points with Default::default() ... NOT CAUGHT in 1.826s
  • src/renderer/raw.rs:67: replace ::render -> anyhow::Result<()> with Ok(Default::default()) ... NOT CAUGHT in 1.868s
  • src/renderer/ffmpeg/h264.rs:65: replace ::to_string -> String with "xyzzy".into() ... NOT CAUGHT in 1.690s
  • src/renderer/ffmpeg/codec.rs:13: replace ::to_string -> String with "".into() ... NOT CAUGHT in 1.670s
  • src/animation/curves/mod.rs:123: replace Points::two_2d -> Self with Default::default() ... NOT CAUGHT in 1.652s
  • src/renderer/ffmpeg/h264.rs:27: replace ::to_string -> String with "".into() ... NOT CAUGHT in 1.643s
  • src/composition/comp.rs:65: replace Composition::fill_with_link -> Option with Default::default() ... NOT CAUGHT in 1.670s
  • src/renderer/raw.rs:52: replace ::generate_filepath -> PathBuf with Default::default() ... NOT CAUGHT in 1.673s
  • src/renderer/ffmpeg/codec.rs:28: replace ::build_cli_argument -> Vec with Default::default() ... NOT CAUGHT in 1.818s
  • src/renderer/raw.rs:58: replace ::file_extension -> String with "xyzzy".into() ... NOT CAUGHT in 1.658s
  • src/renderer/ffmpeg/h264.rs:27: replace ::to_string -> String with "xyzzy".into() ... NOT CAUGHT in 1.633s
  • src/renderer/png.rs:23: replace ::file_extension -> String with "xyzzy".into() ... NOT CAUGHT in 1.642s
  • src/renderer/raw.rs:58: replace ::file_extension -> String with "".into() ... NOT CAUGHT in 1.665s
  • src/figures/circle.rs:22: replace ::eq -> bool with true ... NOT CAUGHT in 1.668s
  • src/renderer/ffmpeg/pixel_formats.rs:18: replace ::to_string -> String with "xyzzy".into() ... NOT CAUGHT in 1.678s
  • src/renderer/ffmpeg/h264.rs:96: replace ::build_cli_argument -> Vec with Default::default() ... NOT CAUGHT in 1.654s
  • src/resolution.rs:40: replace ::pixels -> usize with Default::default() ... NOT CAUGHT in 1.612s
  • src/renderer/png.rs:17: replace ::generate_filepath -> PathBuf with Default::default() ... NOT CAUGHT in 1.696s
  • src/renderer/ffmpeg/mod.rs:60: replace FfmpegRenderer::set_image_render with () ... NOT CAUGHT in 1.649s
  • src/animation/curves/mod.rs:119: replace Points::one_2d -> Self with Default::default() ... NOT CAUGHT in 1.726s
  • src/renderer/ffmpeg/h264.rs:65: replace ::to_string -> String with "".into() ... NOT CAUGHT in 1.639s

Have encoder in seperate thread

The program could have a big speed up if the encoder and renderer are in two seperate threads.

The encoder gets frames and encodes them into a video.
The renderer generates each frame and sends it to the encoder.

If the encoder and the renderer need the same time, then running them in parallel could half the total time to generate a video with rusvid.

Simple diagram:

sequenceDiagram
    Render->>+Encoder: frame 0
    Render->>+Encoder: frame 1
    Render->>+Encoder: frame 2
    Render->>+Encoder: frame 3
    Render->>+Encoder: frame ...

Animation system

Ideas:

  • start_frame and end_frame, TODO make frame a type
  • curve (trait?)
  • called every time before a new png is rendered
struct Animation {
  start_frame: usize,
  end_frame: usize,
  curve: &'a Curve,
}

fn main() {
  // 60fps, 2s
  let animation = Animation {
     start_frame: 60,
     end_frame: 180,
     curve: todo!(),
  };
}

Errror while building crate 'rusvid_core' in release build

Error when compiling with 1.71.0-nightly (569b648b5 2023-05-05):

Compiling geo v0.24.1
error[E0275]: overflow evaluating the requirement `[closure@/Users/$user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/geo-0.24.1/src/algorithm/map_coords.rs:855:69: 855:72]: Fn<(geo_types::Coord<T>,)>`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`geo`)
  = note: required for `&[closure@map_coords.rs:855:69]` to implement `Fn<(geo_types::Coord<T>,)>`
  = note: the full type name has been written to '/Users/$user/Documents/Programming/rusvid/target/release/deps/geo-27a27af44f7385b3.long-type-12617991455342098991.txt'
  = note: 128 redundant requirements hidden
  = note: required for `&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...` to implement `Fn<(geo_types::Coord<T>,)>`
  = note: the full type name has been written to '/Users/$user/Documents/Programming/rusvid/target/release/deps/geo-27a27af44f7385b3.long-type-1315908437659779592.txt'

For more information about this error, try `rustc --explain E0275`.
error: could not compile `geo` (lib) due to previous error

Quick fix because geo already approved a fix georust/geo#1012:

geo = { git = "https://github.com/georust/geo.git" }

Solution:

Wait until geo releases a new version.

Related geo issue: georust/geo#1010

Use two 1D gaussian filters instead of one 2D

pub struct GaussianBlur {

image width: w
image height: h
kernel size: k

Current implementation calculates w * h * k^2 pixels
2x 1D implementation calculates w * h * 2* k pixels

This change can also be used to refactor the all effect-structs to use the same convolve effect, where possible, where the caller can also specify about edge handling (see wiki:kernel).

Wiki: kernel, seperable_filter

v0.1.2 ideas

  • Filters / Effects for composition and/or layer(s)
    • Examples: Bloom, Blur, Noise, Clip, Mask, Grayscale
    • CPU and GPU
    • Keyframes on or off
  • docs

Filters / Effects

let mut layer = Layer::new(Resolution::Custom(100, 100));

layer.add_to_defs(Shape::Rect(0, 0, 50, 50)).unwrap();

layer.add_filter(Filter::Bloom);
layer.add_filter(Filter::Noise);

pipeline:

┌────────────────────────────────────────────────┐
│Composition                                     │
│               ┌──────────────────────────────┐ │
│               │Layer                         │ │
│               │                              │ │
│ ┌─►update()───┼───►update()                  │ │
│ │     │       │                              │ │
│ │     ▼       │                              │ │
│ │  render()───┼───►render()────►effect()───┐ │ │
│ │     │       │                            │ │ │
│ │     ▼       │                            │ │ │
│ └──combine()◄─┼────────────────────────────┘ │ │
│               │                              │ │
│               └──────────────────────────────┘ │
│                                                │
└────────────────────────────────────────────────┘

Image Renderer (for 0.1)

Implement renderer for the single image generation

Formats:

  • PngRender -> uses .png
  • RawRender -> uses .bmp

Why?

Because rusvid is currently really slow at generating the images. Approximately 60% from the start to the end is spend in generating each frame as png (single core, at the time), so raw files like .bmp should speedup the process a huge amount. But the obvious drawback is that the folder with the frames will explode in size. The rest is because of ffmpeg (without hardware acceleration).

Don't render when nothing changes... just copy

At the time of writing (commit 3ad0cdf) in the main 30 of 300 frames have no changes.

  • 0 - 200 animation(s)
  • 220 - 290 animation

After a simple benchmark the rendering of all 300 frames took 89 seconds. With the skipping of re-rendering 28 frames (201 - 219, 291 - 299) the program could have a speedup of 10% (or 9 seconds).

GPU support

Ideas

  • combine layers with an compute shader
  • use a self made rasterization library
  • implement filters (blur, bloom, ...) with compute shaders

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.