Commit 9b4a9b31 authored by Pedro Terra's avatar Pedro Terra Committed by Mauro Carvalho Chehab

media: vimc: Enable set resolution at the scaler src pad

Modify the scaler subdevice to accept setting the resolution of the source
pad (previously the source resolution would always be 3 times the sink for
both dimensions). Now any resolution can be set at src (even smaller ones)
and the sink video will be scaled to match it.

Test example: With the vimc module up (using the default vimc topology)
media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
media-ctl -d platform:vimc -V '"Scaler":0[crop:(100,50)/400x150]'
media-ctl -d platform:vimc -V '"Scaler":1[fmt:RGB888_1X24/300x700]'
v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=300,height=700
v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
v4l2-ctl --stream-mmap --stream-count=10 -z platform:vimc -d "RGB/YUV Capture" \
	--stream-to=test.raw

The result will be a cropped stream that can be checked with the command
ffplay -loglevel warning -v info -f rawvideo -pixel_format rgb24 \
	-video_size "300x700" test.raw
Co-developed-by: default avatarGabriela Bittencourt <gabrielabittencourt00@gmail.com>
Signed-off-by: default avatarGabriela Bittencourt <gabrielabittencourt00@gmail.com>
Co-developed-by: default avatarGabriel Francisco Mandaji <gfmandaji@gmail.com>
Signed-off-by: default avatarGabriel Francisco Mandaji <gfmandaji@gmail.com>
Signed-off-by: default avatarPedro Terra <pedro@terraco.de>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent a5991c4e
......@@ -61,9 +61,10 @@ vimc-debayer:
* 1 Pad source
vimc-scaler:
Scale up the image by a factor of 3. E.g.: a 640x480 image becomes a
1920x1440 image. (this value can be configured, see at
`Module options`_).
Re-size the image to meet the source pad resolution. E.g.: if the sync
pad is configured to 360x480 and the source to 1280x720, the image will
be stretched to fit the source resolution. Works for any resolution
within the vimc limitations (even shrinking the image if necessary).
Exposes:
* 1 Pad sink
......@@ -75,16 +76,3 @@ vimc-capture:
* 1 Pad sink
* 1 Pad source
Module options
--------------
Vimc has a module parameter to configure the driver.
* ``sca_mult=<unsigned int>``
Image size multiplier factor to be used to multiply both width and
height, so the image size will be ``sca_mult^2`` bigger than the
original one. Currently, only supports scaling up (the default value
is 3).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment