As Mickey noted in a comment, first of all we need to scale inputData to have values between 0.0f and 1.0f, passing the scaling factor:
inputData.convertTo(input1Data, CV_32F, 1.0/65535.0f); // since in inputData
// we have values between 0 and
// 65535 so all resulted values
// will be between 0.0f and 1.0f
And now, the same with multiplication:
input1Data = input1Data * gain * (1.0f / 65535.0f);
And I think this should compile too:
input1Data *= gain * (1.0f / 65535.0f);
, .