Landscape Grayscale (0-256) values filter

This is the same image as before but removing the saturation in photoshop (saturation -100), in UE4 is desaturate node.
Doing this there is another problem, for example, the red R255 changes to R127 with a 50% Brightness, loosing the whole grayscale values from 0-255. Now the values goes from 0 to 127(your first formula doesnt work here).