The brightness tool should be identical to the beta bias parameters but the contrast tool seems to differ to the alpha gain where the output range seems to be centered with gimp as you can notice in the previous histogram. The mat function changes each image pixel value to the target data type and the values are changed as per increase or decrease. This change can be done by either increasing or decreasing the pixel values of the image by any constant.