X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-core%2Fsrc%2Fscale%2Fpalette%2Fmod.rs;h=f9b0ee9b033fa9ae4f99435a3731291527a93efd;hp=2005cd8c0fc12c6158511fc937ee5a55b69b496c;hb=25e0bf9a974b1bb5a8f8b38e23b4a7e91db3eab0;hpb=d0d21988dc679ac5d87968da01a55ec3dc375fee diff --git a/nihav-core/src/scale/palette/mod.rs b/nihav-core/src/scale/palette/mod.rs index 2005cd8..f9b0ee9 100644 --- a/nihav-core/src/scale/palette/mod.rs +++ b/nihav-core/src/scale/palette/mod.rs @@ -220,7 +220,29 @@ impl PalettiseKernel { } impl Kernel for PalettiseKernel { - fn init(&mut self, in_fmt: &ScaleInfo, _dest_fmt: &ScaleInfo) -> ScaleResult { + fn init(&mut self, in_fmt: &ScaleInfo, _dest_fmt: &ScaleInfo, options: &[(String, String)]) -> ScaleResult { + for (name, value) in options.iter() { + match name.as_str() { + "pal.quant" => { + self.qmode = match value.as_str() { + "mediancut" => QuantisationMode::MedianCut, + "elbg" => QuantisationMode::ELBG, + "neuquant" => QuantisationMode::NeuQuant(3), + _ => QuantisationMode::default(), + }; + }, + "pal.search" => { + self.palmode = match value.as_str() { + "full" => PaletteSearchMode::Full, + "local" => PaletteSearchMode::Local, + "kdtree" => PaletteSearchMode::KDTree, + _ => PaletteSearchMode::default(), + }; + }, + _ => {}, + }; + } + self.pixels = Vec::with_capacity(in_fmt.width * in_fmt.height); let res = alloc_video_buffer(NAVideoInfo::new(in_fmt.width, in_fmt.height, false, PAL8_FORMAT), 0); if res.is_err() { return Err(ScaleError::AllocError); }