- self.buf1.resize(w * h + (w >> 2) * (h >> 2) * 2, DEFAULT_PIXEL);
- self.buf2.resize(w * h + (w >> 2) * (h >> 2) * 2, DEFAULT_PIXEL);
+ self.cw = ((w >> 2) + 3) & !3;
+ self.ch = ((h >> 2) + 3) & !3;
+ self.buf1.resize(w * h + self.cw * self.ch * 2, DEFAULT_PIXEL);
+ self.buf2.resize(w * h + self.cw * self.ch * 2, DEFAULT_PIXEL);