core/scale: fix corner case in mediancut palettiser
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 18 Oct 2021 16:51:09 +0000 (18:51 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 18 Oct 2021 16:56:38 +0000 (18:56 +0200)
nihav-core/src/scale/palette/mediancut.rs

index 497cc4aca331e1be1055efdaa63c5ac222bbb13d..64281ef23bfa7bef86bca19c3e52aaa89471481f 100644 (file)
@@ -78,7 +78,7 @@ impl<'a> VQBox<'a> {
 
         let box0;
         let box1;
-        if (dr > dg) && (dr > db) {
+        if (dr > dg) && (dr >= db) {
             let pivot = Self::sort(self.pixels, |pix| pix.r as usize);
             let (part0, part1) = self.pixels.split_at_mut(pivot);
             let (min0, max0) = Self::calc_min_and_max(part0);