diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-05-29 18:50:25 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-05-29 18:50:25 +0200 |
commit | 575c0b27ffcb7440620222e6e78c9ecb4006cf99 (patch) | |
tree | 21b0715426a5cf6a3afb63129ff00932e85b0db2 | |
parent | 422e87e4397fc168e568e629b8a0f2b6a9f01ad8 (diff) | |
download | nihav-575c0b27ffcb7440620222e6e78c9ecb4006cf99.tar.gz |
core/scale: make sure that yuv2rgb kernel outputs to planar RGB
-rw-r--r-- | nihav-core/src/scale/colorcvt.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nihav-core/src/scale/colorcvt.rs b/nihav-core/src/scale/colorcvt.rs index 63c7bda..056c050 100644 --- a/nihav-core/src/scale/colorcvt.rs +++ b/nihav-core/src/scale/colorcvt.rs @@ -286,6 +286,21 @@ impl Kernel for YuvToRgb { fn init(&mut self, in_fmt: &ScaleInfo, dest_fmt: &ScaleInfo) -> ScaleResult<NABufferType> { let mut df = dest_fmt.fmt; df.palette = false; + if !df.is_unpacked() || df.get_max_depth() != 8 || df.get_total_depth() != df.get_num_comp() as u8 * 8 { + df = NAPixelFormaton { + model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, + comp_info: [ + Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: false, depth: 8, shift: 0, comp_offs: 0, next_elem: 1 }), + Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: false, depth: 8, shift: 0, comp_offs: 1, next_elem: 1 }), + Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: false, depth: 8, shift: 0, comp_offs: 2, next_elem: 1 }), + None, None], + elem_size: 3, be: false, alpha: false, palette: false }; + if in_fmt.fmt.alpha && dest_fmt.fmt.alpha { + df.alpha = true; + df.components = 4; + df.comp_info[3] = Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: false, depth: 8, shift: 0, comp_offs: 3, next_elem: 1 }); + } + } //todo coeff selection make_yuv2rgb(YUV_PARAMS[2][0], YUV_PARAMS[2][1], &mut self.matrix); if let ColorModel::YUV(yuvsm) = in_fmt.fmt.get_model() { |