inac
Posts: 19
Joined: Thu Nov 16, 2017 3:58 pm

When to set port parameters.

Thu Feb 28, 2019 1:47 pm

I have the setup [rawcam] - [ISP] . The connection is created with mmal_connection_create.

When I set the black level

Code: Select all

mmal_port_parameter_set_uint32(isp_input, MMAL_PARAMETER_BLACK_LEVEL, level));
when setup the ISP and enable everything works. But changing the parameter while everything is running the parameter is not set i.e. I cannot set the black level during streaming. So I have the following questions.

1) When can I set mmal_port_parameter_set?
2) Can it be set when the ports, connections and components are enabled?
3) Do I need a mmal_port_format_commit after a mmal_port_parameter_set?
4) What is the range of level (it's only positive)?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7147
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: When to set port parameters.

Thu Feb 28, 2019 2:07 pm

inac wrote:
Thu Feb 28, 2019 1:47 pm
I have the setup [rawcam] - [ISP] . The connection is created with mmal_connection_create.

When I set the black level

Code: Select all

mmal_port_parameter_set_uint32(isp_input, MMAL_PARAMETER_BLACK_LEVEL, level));
when setup the ISP and enable everything works. But changing the parameter while everything is running the parameter is not set i.e. I cannot set the black level during streaming. So I have the following questions.

1) When can I set mmal_port_parameter_set?
You'll need to refer to the IL docs for the answer for each parameter. MMAL is built on the same underlying components as IL, and parameters should have similar enums.
http://www.jvcref.com/files/PI/document ... s/isp.html (which is a rendering of https://github.com/raspberrypi/firmware ... s/isp.html) - OMX_IndexParamBrcmBlackLevel
In the IL world, OMX_IndexParam... can only be changed whilst the component or port is disabled. OMX_IndexConfig... can be changed at any time.
inac wrote:2) Can it be set when the ports, connections and components are enabled?
As it is an IL Param, technically no.
There's no real reason that I can't rework it to work allow changes at any time, but at the moment it won't update (and is slightly naughty in not returning an error).
inac wrote:3) Do I need a mmal_port_format_commit after a mmal_port_parameter_set?
No. Parameters should never affect the port format.
inac wrote:4) What is the range of level (it's only positive)?
The maximum value that your input format can represent, ie 255 for 8 bit data, 1023 for 10bit data, 4095 for 12bit data, 65535 for 16 bit data. Using the maximum value won't be useful though as it will just make your entire image black.
Black level is basically the noise floor of the sensor. Cover the sensor completely and capture a frame. The highest value found (ignoring defective pixels) is typically the value you want to use for black level.

In theory you can have a different black level for each of the colour components, but I haven't exposed that either as generally the 4 channels are fairly closely matched.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

inac
Posts: 19
Joined: Thu Nov 16, 2017 3:58 pm

Re: When to set port parameters.

Fri Mar 01, 2019 10:18 am

Thank you very much for your great help! This clear a lot for me.

Return to “Camera board”