+ if yuvsm != YUVSubmodel::YIQ {
+ self.yscale = Vec::with_capacity(256);
+ self.r_chr = Vec::with_capacity(256);
+ self.g_u = Vec::with_capacity(256);
+ self.g_v = Vec::with_capacity(256);
+ self.b_chr = Vec::with_capacity(256);
+ for i in 0..256 {
+ let yval = i as i16; // todo limited range as well
+ self.yscale.push(yval);
+ let rval = (((i as f32) - 128.0) * self.matrix[0][2]) as i16;
+ self.r_chr.push(rval);
+ let uval = (((i as f32) - 128.0) * self.matrix[1][1]) as i16;
+ self.g_u.push(uval);
+ let vval = (((i as f32) - 128.0) * self.matrix[1][2]) as i16;
+ self.g_v.push(vval);
+ let bval = (((i as f32) - 128.0) * self.matrix[2][1]) as i16;
+ self.b_chr.push(bval);
+ }
+ }