X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-itu%2Fsrc%2Fcodecs%2Fh264%2Fdsp%2Fmod.rs;h=b19225dda3c3804f7f52ae0876fba7d66e006876;hb=5c811cd5eea2a33e4846f988a67bc54337410c73;hp=69df7d6eede809e8733b0d015a76853d72b0acdd;hpb=999fbb839c077549a29cb84db47a0b0b65a2c0ef;p=nihav.git diff --git a/nihav-itu/src/codecs/h264/dsp/mod.rs b/nihav-itu/src/codecs/h264/dsp/mod.rs index 69df7d6..b19225d 100644 --- a/nihav-itu/src/codecs/h264/dsp/mod.rs +++ b/nihav-itu/src/codecs/h264/dsp/mod.rs @@ -156,11 +156,11 @@ pub fn idct(blk: &mut [i16; 16], qp: u8, quant_dc: bool) { for (el, &idx) in blk.iter_mut().zip(BLK_INDEX.iter()).skip(start) { *el = (*el * LEVEL_SCALE[idx][qidx]) << shift; } - for i in 0..4 { - transform!(blk[i], blk[i + 4], blk[i + 8], blk[i + 12], 0); - } for row in blk.chunks_mut(4) { - transform!(row[0], row[1], row[2], row[3], 6); + transform!(row[0], row[1], row[2], row[3], 0); + } + for i in 0..4 { + transform!(blk[i], blk[i + 4], blk[i + 8], blk[i + 12], 6); } } @@ -175,35 +175,35 @@ pub fn idct_dc(blk: &mut [i16; 16], qp: u8, quant_dc: bool) { const QMAT_8X8: [[u8; 16]; 6] = [ [ - 20, 19, 25, 24, + 20, 19, 25, 19, 19, 18, 24, 18, 25, 24, 32, 24, - 24, 18, 24, 18 + 19, 18, 24, 18 ], [ - 22, 21, 28, 26, + 22, 21, 28, 21, 21, 19, 26, 19, 28, 26, 35, 26, - 26, 19, 26, 19 + 21, 19, 26, 19 ], [ - 26, 24, 33, 31, + 26, 24, 33, 24, 24, 23, 31, 23, 33, 31, 42, 31, - 31, 23, 31, 23 + 24, 23, 31, 23 ], [ - 28, 26, 35, 33, + 28, 26, 35, 26, 26, 25, 33, 25, 35, 33, 45, 33, - 33, 25, 33, 25 + 26, 25, 33, 25 ], [ - 32, 30, 40, 38, + 32, 30, 40, 30, 30, 28, 38, 28, 40, 38, 51, 38, - 38, 28, 38, 28 + 30, 28, 38, 28 ], [ - 36, 34, 46, 43, + 36, 34, 46, 34, 34, 32, 43, 32, 46, 43, 58, 43, - 43, 32, 43, 32 + 34, 32, 43, 32 ] ]; @@ -521,7 +521,7 @@ impl IPred8Context { tl: 128, } } - pub fn fill(&mut self, buf: &mut [u8], idx: usize, stride: usize, has_t: bool, has_tr: bool, has_l: bool, has_tl: bool) { + pub fn fill(&mut self, buf: &[u8], idx: usize, stride: usize, has_t: bool, has_tr: bool, has_l: bool, has_tl: bool) { let mut t = [0x80u8; 19]; let mut l = [0x80u8; 11]; if has_t { @@ -644,7 +644,7 @@ fn ipred_y_8x8_ver_right(buf: &mut [u8], stride: usize, ctx: &IPred8Context) { (t[ix - 1] + 2 * t[ix] + t[ix + 1] + 2) >> 2 } } else if zvr == -1 { - (l[1] + 2 * l[0] + t[0] + 2) >> 2 + (l[1] + 2 * l[0] + t[1] + 2) >> 2 } else { let ix = y - 2 * x; (l[ix] + 2 * l[ix - 1] + l[ix - 2] + 2) >> 2 @@ -693,7 +693,7 @@ fn ipred_y_8x8_hor_down(buf: &mut [u8], stride: usize, ctx: &IPred8Context) { (l[ix - 1] + 2 * l[ix] + l[ix + 1] + 2) >> 2 } } else if zhd == -1 { - (l[1] + 2 * l[0] + t[0] + 2) >> 2 + (l[1] + 2 * l[0] + t[1] + 2) >> 2 } else { let ix = x - 2 * y; (t[ix] + 2 * t[ix - 1] + t[ix - 2] + 2) >> 2