libcamera: pipeline: uvcvideo: Expose Gamma control

Commit 294ead848c ("libcamera: Add gamma control id")
introduced the "Gamma" control, so expose it for UVC
cameras as well using the `V4L2_CID_GAMMA` control.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2025-03-04 12:25:17 +01:00
parent 5553efc6b1
commit 78d9f7bb75

View file

@ -329,6 +329,8 @@ int PipelineHandlerUVC::processControl(const UVCCameraData *data, ControlList *c
cid = V4L2_CID_EXPOSURE_ABSOLUTE;
else if (id == controls::AnalogueGain)
cid = V4L2_CID_GAIN;
else if (id == controls::Gamma)
cid = V4L2_CID_GAMMA;
else
return -EINVAL;
@ -394,6 +396,10 @@ int PipelineHandlerUVC::processControl(const UVCCameraData *data, ControlList *c
break;
}
case V4L2_CID_GAMMA:
controls->set(cid, static_cast<int32_t>(std::lround(value.get<float>() * 100)));
break;
default: {
int32_t ivalue = value.get<int32_t>();
controls->set(cid, ivalue);
@ -691,6 +697,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
case V4L2_CID_GAIN:
id = &controls::AnalogueGain;
break;
case V4L2_CID_GAMMA:
id = &controls::Gamma;
break;
default:
return;
}
@ -845,6 +854,15 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
break;
}
case V4L2_CID_GAMMA:
/* UVC gamma is in units of 1/100 gamma. */
info = ControlInfo{
{ min / 100.0f },
{ max / 100.0f },
{ def / 100.0f }
};
break;
default:
info = v4l2Info;
break;