public void loadBrightnessContrast(float brightness, float contrast) {
		float slope = contrast > 0.f ? (1f / (1.0001f - contrast)): 1f + contrast;
		float offset = .5f - slope * .5f + brightness;
		for (int i=0; i<256; i++) {
			float x = i / 255.f;
			float y = x * slope + offset;
			
			table[i] = Math.min(255, Math.max((int) (y * 255.f), 0));
		}		
	}