Giter VIP home page Giter VIP logo

yuv's Introduction

YUV formats

This crate implements conversions from YUV/YCbCr formats to RGB. It also contains enums/constants for describing color spaces common in video formats.

Currently it's in an early stage, implementing subset needed for decoding AV1/AVIF.

Implemented

  • Matrix conversion for BT601, BT709, FCC, BT470BG, SMPTE240
  • YCgCo (untested)
  • Identity pass-through (GBR)
  • Studio and full range colors
  • 8-bit, and 10/12 to 16-bit conversions

Planned

  • Gamma conversion
  • Color primaries conversion
  • Chroma upsampling
  • RGB to YUV conversion
  • YUV pixel convenience functions, like in rgb
  • 8-to-16-bit expanding conversion
  • HDR to SDR conversion?
  • Maybe HDR support?

yuv's People

Contributors

coral avatar djdisodo avatar kornelski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yuv's Issues

`panic` when converting to YUV420 to RGB

I have a raw buffer of bytes which is a YUV420 format frame from a camera, which I am trying to convert to RGB (well, ultimately to a JPEG).

My code, however, panics when I try to do the conversion, looking something like this:

let frame_data: Vec<u8> = ...; // a 1920x1080 resolution YUV420 frame, 3110400 bytes long
let view = Image::<Yuv<u8>, _>::from_buf(&frame_data, 1920, 1080).unwrap();
let mut rgb_buf = Image::<Rgb<u8>, _>::new(0, 0, 0u8);
view.convert(&mut rgb_buf); 

And then I get a really long panic message:

thread '<unnamed>' panicked at 'range end index 3116160 out of range for slice of length 3110400', /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ffimage-0.9.0/src/packed/convert/rayon.rs:86:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'range end index 3306240 out of range for slice of length 3110400', /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ffimage-0.9.0/src/packed/convert/rayon.rs:86:27
... repeated absolutely loads of times with an incrementing "range end index"

Is YUV420 conversion supported?

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.