Hey guys,
I have the following problem when calling an ARGUS stream either from GStreamer or C++ API.
When I set my framerate to another value than the max value, it always first calls setFramerate with the max value in the device tree for frame_rate, and later on it calls setFramerate with the right value I gave to ARGUS.
This would not be a problem, but in my driver I handle it like this:
If setFramerate is set to a value too high for my exposure time, I reduce the exposure time to maximum possible with the given framerate. That way, my exposure time is reduced when framerate is to max value and later on not increased when set to the wanted framerate.
This leads to another problem, that v4l2 is not recognizing me reducing exposure. It still thinks exposure is the value from before.
So my 2 questions are:
Why is ARGUS handling framerate like this, is it intended or a bug and can it be fixed?
Is there a better way to handle framerate values outside of exposure range or exposure values outside of framerate range? Would you recommend handling it in my userspace application?
EDIT: If you tell me, this is not intended and also not reproducable for you, I would make bigger effort to debug my driver if the problem is coming from there. But I would not know why the problem should be there, so I wanted to ask about this issue first.
Yes! This is my initialization:
void createInputStream(CameraDevice* cameraDevice, ICaptureSession *iCaptureSession){
int sensor_mode = 1;
int fps = 60;
SensorMode* sensorMode = ArgusHelpers::getSensorMode(cameraDevice, sensor_mode);
ISensorMode *iSensorMode = interface_cast<ISensorMode>(sensorMode);
if (!iSensorMode)
printf("Selected sensor mode not available");
if (!iCaptureSession)
{
printf("Failed to create CaptureSession");
}
UniqueObj<OutputStreamSettings> streamSettings(
iCaptureSession->createOutputStreamSettings(STREAM_TYPE_EGL));
IEGLOutputStreamSettings *iEGLStreamSettings =
interface_cast<IEGLOutputStreamSettings>(streamSettings);
if (!iEGLStreamSettings)
{
printf("Failed to create OutputStreamSettings");
}
iEGLStreamSettings->setPixelFormat(PIXEL_FMT_RAW16);
iEGLStreamSettings->setResolution(iSensorMode->getResolution());
//iEGLStreamSettings->setMode(EGL_STREAM_MODE_FIFO);
//iEGLStreamSettings->setFifoLength(2);
iEGLStreamSettings->setMode(EGL_STREAM_MODE_MAILBOX);
outputStream = UniqueObj<OutputStream>(iCaptureSession->createOutputStream(streamSettings.get()));
// Create capture request and enable output stream.
request = UniqueObj<Request>(iCaptureSession->createRequest());
IRequest *iRequest = interface_cast<IRequest>(request);
iRequest->enableOutputStream(outputStream.get());
IAutoControlSettings* iAutoControlSettings =
interface_cast<IAutoControlSettings>(iRequest->getAutoControlSettings());
if (!iRequest)
{
printf("Failed to create Request");
}
// Set the sensor mode in the request.
ISourceSettings *iSourceSettings = interface_cast<ISourceSettings>(request);
if (!iSourceSettings)
printf("Failed to get source settings request interface");
iSourceSettings->setSensorMode(sensorMode);
iAutoControlSettings->setAwbMode(AWB_MODE_OFF);
iAutoControlSettings->setAwbLock(true);
iAutoControlSettings->setAeAntibandingMode(AE_ANTIBANDING_MODE_OFF);
iAutoControlSettings->setAeLock(true);
//iAutoControlSettings->setColorSaturationEnable(true);
//iAutoControlSettings->setColorSaturation(2.0f);
//iAutoControlSettings->setExposureCompensation(1.0f);
Range<uint64_t> limitExposureTimeRange;
Range<float> sensorModeAnalogGainRange;
limitExposureTimeRange.min() = 16600000;
limitExposureTimeRange.max() = 16600000;
sensorModeAnalogGainRange.min() = 15.5;
sensorModeAnalogGainRange.max() = 15.5;
iSourceSettings->setGainRange(sensorModeAnalogGainRange);
iSourceSettings->setExposureTimeRange(limitExposureTimeRange);
iSourceSettings->setFrameDurationRange(Range<uint64_t>(1e9/fps));
m_inputStream = outputStream.get();
Argus::Status status;
status = iCaptureSession->repeat(request.get());
}
It’s multimedia API sample code and yes need run on X-server.
I think your driver should reduce the exposure when framerate is max value. Instead you can set the exposure range to limit the exposure as your request.