- if let NABufferType::Video(ref buf) = frm.get_buffer() {
- let paloff = buf.get_offset(1);
- let data = buf.get_data();
+ if !self.grayscale {
+ if let NABufferType::Video(ref buf) = frm.get_buffer() {
+ let paloff = buf.get_offset(1);
+ let data = buf.get_data();
+ let mut pal = [0; 1024];
+ let srcpal = &data[paloff..][..768];
+ for (dclr, sclr) in pal.chunks_exact_mut(4).zip(srcpal.chunks_exact(3)) {
+ dclr[..3].copy_from_slice(sclr);
+ }
+ if let Some(ref mut pkt) = &mut self.pkt {
+ pkt.side_data.push(NASideData::Palette(true, Arc::new(pal)));
+ }
+ }
+ } else {