X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-indeo%2Fsrc%2Fcodecs%2Findeo3enc%2Fcell.rs;h=582293b92a349ea968de5198673e345811070d97;hb=5f9bf7648f667952b787c77afde07d23ac7c01de;hp=6f641eb3c87355a8f6db9f98552b5e79365463c9;hpb=77c25c7b24cc20357dff1bdacf8561e9ec1e57f2;p=nihav.git diff --git a/nihav-indeo/src/codecs/indeo3enc/cell.rs b/nihav-indeo/src/codecs/indeo3enc/cell.rs index 6f641eb..582293b 100644 --- a/nihav-indeo/src/codecs/indeo3enc/cell.rs +++ b/nihav-indeo/src/codecs/indeo3enc/cell.rs @@ -176,7 +176,7 @@ impl CellEncoder { buf: [0; MAX_CELL_SIZE + 160], rbuf: [0; MAX_CELL_SIZE + 160], deltas: [0; MAX_CELL_SIZE], - cell: Indeo3Cell::new(0, 0, false), + cell: Indeo3Cell::new(0, 0), out: [0; MAX_CELL_SIZE / 2 + 1], osize: 0, @@ -368,10 +368,6 @@ impl CellEncoder { } } self.out[0] = (mode << 4) | (idx as u8); - - if idx >= 8 { - requant_idx = Some(idx - 8); - } } else { self.out[0] = (mode << 4) | (cb_no1 as u8); @@ -379,7 +375,7 @@ impl CellEncoder { requant_idx = Some(cb_no1 - 8); } } - if self.cell.get_y() == 0 { + if self.cell.get_y() == 0 || !matches!(mode, 0 | 3 | 10) { requant_idx = None; } @@ -619,13 +615,11 @@ impl CellEncoder { let dst = &mut data[x + y * stride..]; let mut dst_idx = stride; for line in 0..4 { - for x in 0..4 { - let top = dst[dst_idx - stride + x * 2]; - let cur = cell[(line + 1) * 4 + x]; - dst[dst_idx + x * 2] = (top + cur) >> 1; - dst[dst_idx + x * 2 + 1] = (top + cur) >> 1; - dst[dst_idx + stride + x * 2] = cur; - dst[dst_idx + stride + x * 2 + 1] = cur; + for x in 0..8 { + let top = dst[dst_idx - stride + x]; + let cur = cell[(line + 1) * 4 + x / 2]; + dst[dst_idx + x] = (top + cur) >> 1; + dst[dst_idx + stride + x] = cur; } dst_idx += stride * 2; }