X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Ftest%2Fdec_video.rs;h=21c3f1aaa4f5f18af36b60996a5a137d908e7c6d;hb=0cc09358bda53a327937e503e1166bf55b84f319;hp=01cc42bb9f517a3f417be8aabb0741612bf83bca;hpb=4e8b4f31bc2ef2b22b4c725aa07dfc776664a97b;p=nihav.git diff --git a/nihav-core/src/test/dec_video.rs b/nihav-core/src/test/dec_video.rs index 01cc42b..21c3f1a 100644 --- a/nihav-core/src/test/dec_video.rs +++ b/nihav-core/src/test/dec_video.rs @@ -77,6 +77,11 @@ fn write_palppm(pfx: &str, strno: usize, num: u64, frmref: NAFrameRef) { ofile.write_all(hdr.as_bytes()).unwrap(); let dta = buf.get_data(); let ls = buf.get_stride(0); + let offs: [usize; 3] = [ + buf.get_info().get_format().get_chromaton(0).unwrap().get_offset() as usize, + buf.get_info().get_format().get_chromaton(1).unwrap().get_offset() as usize, + buf.get_info().get_format().get_chromaton(2).unwrap().get_offset() as usize + ]; let mut idx = 0; let mut line: Vec = Vec::with_capacity(w * 3); line.resize(w * 3, 0); @@ -84,9 +89,9 @@ fn write_palppm(pfx: &str, strno: usize, num: u64, frmref: NAFrameRef) { let src = &dta[idx..(idx+w)]; for x in 0..w { let pix = src[x] as usize; - line[x * 3 + 0] = dta[paloff + pix * 3 + 2]; - line[x * 3 + 1] = dta[paloff + pix * 3 + 1]; - line[x * 3 + 2] = dta[paloff + pix * 3 + 0]; + line[x * 3 + 0] = dta[paloff + pix * 3 + offs[0]]; + line[x * 3 + 1] = dta[paloff + pix * 3 + offs[1]]; + line[x * 3 + 2] = dta[paloff + pix * 3 + offs[2]]; } ofile.write_all(line.as_slice()).unwrap(); idx += ls;