protected void allocMemory () {
        arrY = new double [matHeight][matWidth];
        mat[0] = new Matrix(arrY, matHeight, matWidth);

        if (codeCbCr) {
            arrCb = new double [matHeightC][matWidthC];
            arrCr = new double [matHeightC][matWidthC];
            mat[1] = new Matrix(arrCb, matHeightC, matWidthC);
            mat[2] = new Matrix(arrCr, matHeightC, matWidthC);
        }
    }