]> git.nihav.org Git - nihav-encoder.git/commitdiff
palettise: fix cache search in palettisation
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 23 Apr 2026 16:06:12 +0000 (18:06 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 23 Apr 2026 16:06:12 +0000 (18:06 +0200)
src/palettise.rs

index 75739545d9ba20fa52f5e8b8f1bad5d606bf0e1d..ba4023df52a81b672334222c4867018b4e501815 100644 (file)
@@ -224,7 +224,7 @@ struct LookupCache {
 
 impl LookupCache {
     fn lookup(&mut self, clr: [u8; 3]) -> Option<u8> {
-        for (idx, key) in self.items.iter().enumerate() {
+        for (idx, key) in self.items.iter().take(self.fill).enumerate() {
             if key.1 == clr {
                 let ret = key.0;
                 self.items.swap(0, idx);