i.MX8MP ISP video mode switching

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MP ISP video mode switching

1,752 Views
artsiomstaliaro
Contributor IV

Hi, 

i'm wondering is the way of fast video mode switching?

Right now only way to switch video resolution is to restart ISP daemon with new parameters in Sensor0_Entry.cfg .

Tags (2)
0 Kudos
Reply
9 Replies

1,679 Views
joanxie
NXP TechSupport
NXP TechSupport

how do you restart ISP daemon with new parameters in Sensor0_Entry.cfg? do you use v4l2-ctl? if you need add new resolution, maybe you need add it in the Sensor0_Entry.cfg, if current Sensor0_Entry.cfg already has the resolution you need, you just want to change it, you can use v4l2-ctl

0 Kudos
Reply

1,675 Views
artsiomstaliaro
Contributor IV

Thank you.

Sensor0_Entry.cfg has 3 modes defined. Do you have an example how to change mode using v4l2-ctl?

This way? 

v4l2-ctl --set-ctrl=sensor_mode=2
0 Kudos
Reply

1,732 Views
malik_cisse
Senior Contributor I

You are fully right.
Do you know if one can reconfigure the ISP scaler dynamically without restarting ISP server?

0 Kudos
Reply

1,728 Views
artsiomstaliaro
Contributor IV
Yes, during init - provide the Width x Height you need.
Like: gst-launch-1.0 -v v4l2src device=/dev/video0 ! "video/x-raw,format=YUY2,width=512,height=512" ! waylandsink

1,736 Views
malik_cisse
Senior Contributor I

IMHO this is the only way to select between modes that are defined in the sensor kernel driver. You need to restart ISP daemon with new parameters in Sensor0_Entry.cfg as you said.
However if you are only interested in lowering the video resolution dynamically without stopping live stream (scaling), you can do it with Gstreamer G2D GPU accelerator.
If input aspect ratio does not fit output aspect ratio, you can crop parts of the input image like in example bellow:

v4l2src device=/dev/video0 ! video/x-raw, width=3840,height=2160 ! videocrop name=video_crop ! imxvideoconvert_g2d ! video/x-raw, width=480, height=800 ! autovideosink 

and dynamically setting videocrop parameters (left_crop, right_crop etc.). 
Note that the actual cropping and downscaling is done inimxvideoconvert_g2d. "videocrop" gstreamer element will only insert necessary metadata.

Also note that this approach only works if you use Gstreamer in an application and not on command line. 
I have done this sort of computing a lot. Let me know if u need further assistance.

 

0 Kudos
Reply

1,734 Views
artsiomstaliaro
Contributor IV

Thank you.

That is also how I understand this ISP.

ISP also has a scaler.

The reason for switching modes - is FPS value. Lower resolution - higher FPS can be achieved.

Scaling down from 4K @ 30fps, possible to only with 30fps. With FullHD possible to get up to 120FPS.

 

0 Kudos
Reply

1,653 Views
joanxie
NXP TechSupport
NXP TechSupport

v4l2-ctl is just another solution for change resolution, but you still need restart ISP, for crop, this is another topic, let me remind, this is limitation for crop and scale

Crop and scale
• Top alignment: 16 pixels
• Left alignment: 16 pixels
• Width alignment: 16 pixels
• Height alignment: 8 pixels
• Maximum resolution: 4096 x 3072
• Minimum resolution: 176 x 144
The scale up ratio is limited to a maximum of 4.0. There is no limitation for the scale down ratio.

0 Kudos
Reply

1,648 Views
artsiomstaliaro
Contributor IV

yes, thank you.

That was my doubt.

v4l2-ctl is not working here for changing ISP modes.

0 Kudos
Reply

1,559 Views
joanxie
NXP TechSupport
NXP TechSupport

this command should work and helpful for others

v4l2 command is like this if your mode 0 is 1080p, then you can change different resolution based on different mode

sed -i 's/mode = .*/mode = 0/g' Sensor0_Entry.cfg
v4l2-ctl -d0 --verbose --set-fmt-video=width=1920,height=1080,pixelformat=BA12 --stream-mmap --stream-count=1 --stream-to=grbg.raw

0 Kudos
Reply