18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci.. _crop: 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci***************************************************** 68c2ecf20Sopenharmony_ciImage Cropping, Insertion and Scaling -- the CROP API 78c2ecf20Sopenharmony_ci***************************************************** 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci.. note:: 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci The CROP API is mostly superseded by the newer :ref:`SELECTION API 128c2ecf20Sopenharmony_ci <selection-api>`. The new API should be preferred in most cases, 138c2ecf20Sopenharmony_ci with the exception of pixel aspect ratio detection, which is 148c2ecf20Sopenharmony_ci implemented by :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` and has no 158c2ecf20Sopenharmony_ci equivalent in the SELECTION API. See :ref:`selection-vs-crop` for a 168c2ecf20Sopenharmony_ci comparison of the two APIs. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciSome video capture devices can sample a subsection of the picture and 198c2ecf20Sopenharmony_cishrink or enlarge it to an image of arbitrary size. We call these 208c2ecf20Sopenharmony_ciabilities cropping and scaling. Some video output devices can scale an 218c2ecf20Sopenharmony_ciimage up or down and insert it at an arbitrary scan line and horizontal 228c2ecf20Sopenharmony_cioffset into a video signal. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciApplications can use the following API to select an area in the video 258c2ecf20Sopenharmony_cisignal, query the default area and the hardware limits. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci.. note:: 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci Despite their name, the :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>`, 308c2ecf20Sopenharmony_ci :ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` and :ref:`VIDIOC_S_CROP 318c2ecf20Sopenharmony_ci <VIDIOC_G_CROP>` ioctls apply to input as well as output devices. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciScaling requires a source and a target. On a video capture or overlay 348c2ecf20Sopenharmony_cidevice the source is the video signal, and the cropping ioctls determine 358c2ecf20Sopenharmony_cithe area actually sampled. The target are images read by the application 368c2ecf20Sopenharmony_cior overlaid onto the graphics screen. Their size (and position for an 378c2ecf20Sopenharmony_cioverlay) is negotiated with the :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` 388c2ecf20Sopenharmony_ciand :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctls. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciOn a video output device the source are the images passed in by the 418c2ecf20Sopenharmony_ciapplication, and their size is again negotiated with the 428c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` and :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` 438c2ecf20Sopenharmony_ciioctls, or may be encoded in a compressed video stream. The target is 448c2ecf20Sopenharmony_cithe video signal, and the cropping ioctls determine the area where the 458c2ecf20Sopenharmony_ciimages are inserted. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciSource and target rectangles are defined even if the device does not 488c2ecf20Sopenharmony_cisupport scaling or the :ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` and 498c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` ioctls. Their size (and position 508c2ecf20Sopenharmony_ciwhere applicable) will be fixed in this case. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci.. note:: 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci All capture and output devices that support the CROP or SELECTION 558c2ecf20Sopenharmony_ci API will also support the :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` 568c2ecf20Sopenharmony_ci ioctl. 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciCropping Structures 598c2ecf20Sopenharmony_ci=================== 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci.. _crop-scale: 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci.. kernel-figure:: crop.svg 658c2ecf20Sopenharmony_ci :alt: crop.svg 668c2ecf20Sopenharmony_ci :align: center 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci Image Cropping, Insertion and Scaling 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci The cropping, insertion and scaling process 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ciFor capture devices the coordinates of the top left corner, width and 758c2ecf20Sopenharmony_ciheight of the area which can be sampled is given by the ``bounds`` 768c2ecf20Sopenharmony_cisubstructure of the struct :c:type:`v4l2_cropcap` returned 778c2ecf20Sopenharmony_ciby the :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` ioctl. To support a wide 788c2ecf20Sopenharmony_cirange of hardware this specification does not define an origin or units. 798c2ecf20Sopenharmony_ciHowever by convention drivers should horizontally count unscaled samples 808c2ecf20Sopenharmony_cirelative to 0H (the leading edge of the horizontal sync pulse, see 818c2ecf20Sopenharmony_ci:ref:`vbi-hsync`). Vertically ITU-R line numbers of the first field 828c2ecf20Sopenharmony_ci(see ITU R-525 line numbering for :ref:`525 lines <vbi-525>` and for 838c2ecf20Sopenharmony_ci:ref:`625 lines <vbi-625>`), multiplied by two if the driver 848c2ecf20Sopenharmony_cican capture both fields. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciThe top left corner, width and height of the source rectangle, that is 878c2ecf20Sopenharmony_cithe area actually sampled, is given by struct 888c2ecf20Sopenharmony_ci:c:type:`v4l2_crop` using the same coordinate system as 898c2ecf20Sopenharmony_cistruct :c:type:`v4l2_cropcap`. Applications can use the 908c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` and :ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` 918c2ecf20Sopenharmony_ciioctls to get and set this rectangle. It must lie completely within the 928c2ecf20Sopenharmony_cicapture boundaries and the driver may further adjust the requested size 938c2ecf20Sopenharmony_ciand/or position according to hardware limitations. 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ciEach capture device has a default source rectangle, given by the 968c2ecf20Sopenharmony_ci``defrect`` substructure of struct 978c2ecf20Sopenharmony_ci:c:type:`v4l2_cropcap`. The center of this rectangle 988c2ecf20Sopenharmony_cishall align with the center of the active picture area of the video 998c2ecf20Sopenharmony_cisignal, and cover what the driver writer considers the complete picture. 1008c2ecf20Sopenharmony_ciDrivers shall reset the source rectangle to the default when the driver 1018c2ecf20Sopenharmony_ciis first loaded, but not later. 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciFor output devices these structures and ioctls are used accordingly, 1048c2ecf20Sopenharmony_cidefining the *target* rectangle where the images will be inserted into 1058c2ecf20Sopenharmony_cithe video signal. 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciScaling Adjustments 1098c2ecf20Sopenharmony_ci=================== 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciVideo hardware can have various cropping, insertion and scaling 1128c2ecf20Sopenharmony_cilimitations. It may only scale up or down, support only discrete scaling 1138c2ecf20Sopenharmony_cifactors, or have different scaling abilities in horizontal and vertical 1148c2ecf20Sopenharmony_cidirection. Also it may not support scaling at all. At the same time the 1158c2ecf20Sopenharmony_cistruct :c:type:`v4l2_crop` rectangle may have to be aligned, 1168c2ecf20Sopenharmony_ciand both the source and target rectangles may have arbitrary upper and 1178c2ecf20Sopenharmony_cilower size limits. In particular the maximum ``width`` and ``height`` in 1188c2ecf20Sopenharmony_cistruct :c:type:`v4l2_crop` may be smaller than the struct 1198c2ecf20Sopenharmony_ci:c:type:`v4l2_cropcap`. ``bounds`` area. Therefore, as 1208c2ecf20Sopenharmony_ciusual, drivers are expected to adjust the requested parameters and 1218c2ecf20Sopenharmony_cireturn the actual values selected. 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ciApplications can change the source or the target rectangle first, as 1248c2ecf20Sopenharmony_cithey may prefer a particular image size or a certain area in the video 1258c2ecf20Sopenharmony_cisignal. If the driver has to adjust both to satisfy hardware 1268c2ecf20Sopenharmony_cilimitations, the last requested rectangle shall take priority, and the 1278c2ecf20Sopenharmony_cidriver should preferably adjust the opposite one. The 1288c2ecf20Sopenharmony_ci:ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` ioctl however shall not change 1298c2ecf20Sopenharmony_cithe driver state and therefore only adjust the requested rectangle. 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ciSuppose scaling on a video capture device is restricted to a factor 1:1 1328c2ecf20Sopenharmony_cior 2:1 in either direction and the target image size must be a multiple 1338c2ecf20Sopenharmony_ciof 16 × 16 pixels. The source cropping rectangle is set to defaults, 1348c2ecf20Sopenharmony_ciwhich are also the upper limit in this example, of 640 × 400 pixels at 1358c2ecf20Sopenharmony_cioffset 0, 0. An application requests an image size of 300 × 225 pixels, 1368c2ecf20Sopenharmony_ciassuming video will be scaled down from the "full picture" accordingly. 1378c2ecf20Sopenharmony_ciThe driver sets the image size to the closest possible values 304 × 224, 1388c2ecf20Sopenharmony_cithen chooses the cropping rectangle closest to the requested size, that 1398c2ecf20Sopenharmony_ciis 608 × 224 (224 × 2:1 would exceed the limit 400). The offset 0, 0 is 1408c2ecf20Sopenharmony_cistill valid, thus unmodified. Given the default cropping rectangle 1418c2ecf20Sopenharmony_cireported by :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` the application can 1428c2ecf20Sopenharmony_cieasily propose another offset to center the cropping rectangle. 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciNow the application may insist on covering an area using a picture 1458c2ecf20Sopenharmony_ciaspect ratio closer to the original request, so it asks for a cropping 1468c2ecf20Sopenharmony_cirectangle of 608 × 456 pixels. The present scaling factors limit 1478c2ecf20Sopenharmony_cicropping to 640 × 384, so the driver returns the cropping size 608 × 384 1488c2ecf20Sopenharmony_ciand adjusts the image size to closest possible 304 × 192. 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ciExamples 1528c2ecf20Sopenharmony_ci======== 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ciSource and target rectangles shall remain unchanged across closing and 1558c2ecf20Sopenharmony_cireopening a device, such that piping data into or out of a device will 1568c2ecf20Sopenharmony_ciwork without special preparations. More advanced applications should 1578c2ecf20Sopenharmony_ciensure the parameters are suitable before starting I/O. 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci.. note:: 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci On the next two examples, a video capture device is assumed; 1628c2ecf20Sopenharmony_ci change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ciExample: Resetting the cropping parameters 1658c2ecf20Sopenharmony_ci========================================== 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci.. code-block:: c 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci struct v4l2_cropcap cropcap; 1708c2ecf20Sopenharmony_ci struct v4l2_crop crop; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci memset (&cropcap, 0, sizeof (cropcap)); 1738c2ecf20Sopenharmony_ci cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_CROPCAP, &cropcap)) { 1768c2ecf20Sopenharmony_ci perror ("VIDIOC_CROPCAP"); 1778c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 1788c2ecf20Sopenharmony_ci } 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci memset (&crop, 0, sizeof (crop)); 1818c2ecf20Sopenharmony_ci crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1828c2ecf20Sopenharmony_ci crop.c = cropcap.defrect; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci /* Ignore if cropping is not supported (EINVAL). */ 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_S_CROP, &crop) 1878c2ecf20Sopenharmony_ci && errno != EINVAL) { 1888c2ecf20Sopenharmony_ci perror ("VIDIOC_S_CROP"); 1898c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 1908c2ecf20Sopenharmony_ci } 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ciExample: Simple downscaling 1948c2ecf20Sopenharmony_ci=========================== 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci.. code-block:: c 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci struct v4l2_cropcap cropcap; 1998c2ecf20Sopenharmony_ci struct v4l2_format format; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci reset_cropping_parameters (); 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* Scale down to 1/4 size of full picture. */ 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci memset (&format, 0, sizeof (format)); /* defaults */ 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci format.fmt.pix.width = cropcap.defrect.width >> 1; 2108c2ecf20Sopenharmony_ci format.fmt.pix.height = cropcap.defrect.height >> 1; 2118c2ecf20Sopenharmony_ci format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_S_FMT, &format)) { 2148c2ecf20Sopenharmony_ci perror ("VIDIOC_S_FORMAT"); 2158c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 2168c2ecf20Sopenharmony_ci } 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci /* We could check the actual image size now, the actual scaling factor 2198c2ecf20Sopenharmony_ci or if the driver can scale at all. */ 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ciExample: Selecting an output area 2228c2ecf20Sopenharmony_ci================================= 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci.. note:: This example assumes an output device. 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci.. code-block:: c 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci struct v4l2_cropcap cropcap; 2298c2ecf20Sopenharmony_ci struct v4l2_crop crop; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci memset (&cropcap, 0, sizeof (cropcap)); 2328c2ecf20Sopenharmony_ci cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &cropcap)) { 2358c2ecf20Sopenharmony_ci perror ("VIDIOC_CROPCAP"); 2368c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 2378c2ecf20Sopenharmony_ci } 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci memset (&crop, 0, sizeof (crop)); 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 2428c2ecf20Sopenharmony_ci crop.c = cropcap.defrect; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci /* Scale the width and height to 50 % of their original size 2458c2ecf20Sopenharmony_ci and center the output. */ 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci crop.c.width /= 2; 2488c2ecf20Sopenharmony_ci crop.c.height /= 2; 2498c2ecf20Sopenharmony_ci crop.c.left += crop.c.width / 2; 2508c2ecf20Sopenharmony_ci crop.c.top += crop.c.height / 2; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci /* Ignore if cropping is not supported (EINVAL). */ 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_S_CROP, &crop) 2558c2ecf20Sopenharmony_ci && errno != EINVAL) { 2568c2ecf20Sopenharmony_ci perror ("VIDIOC_S_CROP"); 2578c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 2588c2ecf20Sopenharmony_ci } 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ciExample: Current scaling factor and pixel aspect 2618c2ecf20Sopenharmony_ci================================================ 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci.. note:: This example assumes a video capture device. 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci.. code-block:: c 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci struct v4l2_cropcap cropcap; 2688c2ecf20Sopenharmony_ci struct v4l2_crop crop; 2698c2ecf20Sopenharmony_ci struct v4l2_format format; 2708c2ecf20Sopenharmony_ci double hscale, vscale; 2718c2ecf20Sopenharmony_ci double aspect; 2728c2ecf20Sopenharmony_ci int dwidth, dheight; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci memset (&cropcap, 0, sizeof (cropcap)); 2758c2ecf20Sopenharmony_ci cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_CROPCAP, &cropcap)) { 2788c2ecf20Sopenharmony_ci perror ("VIDIOC_CROPCAP"); 2798c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 2808c2ecf20Sopenharmony_ci } 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci memset (&crop, 0, sizeof (crop)); 2838c2ecf20Sopenharmony_ci crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_G_CROP, &crop)) { 2868c2ecf20Sopenharmony_ci if (errno != EINVAL) { 2878c2ecf20Sopenharmony_ci perror ("VIDIOC_G_CROP"); 2888c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 2898c2ecf20Sopenharmony_ci } 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci /* Cropping not supported. */ 2928c2ecf20Sopenharmony_ci crop.c = cropcap.defrect; 2938c2ecf20Sopenharmony_ci } 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci memset (&format, 0, sizeof (format)); 2968c2ecf20Sopenharmony_ci format.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci if (-1 == ioctl (fd, VIDIOC_G_FMT, &format)) { 2998c2ecf20Sopenharmony_ci perror ("VIDIOC_G_FMT"); 3008c2ecf20Sopenharmony_ci exit (EXIT_FAILURE); 3018c2ecf20Sopenharmony_ci } 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci /* The scaling applied by the driver. */ 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci hscale = format.fmt.pix.width / (double) crop.c.width; 3068c2ecf20Sopenharmony_ci vscale = format.fmt.pix.height / (double) crop.c.height; 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci aspect = cropcap.pixelaspect.numerator / 3098c2ecf20Sopenharmony_ci (double) cropcap.pixelaspect.denominator; 3108c2ecf20Sopenharmony_ci aspect = aspect * hscale / vscale; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci /* Devices following ITU-R BT.601 do not capture 3138c2ecf20Sopenharmony_ci square pixels. For playback on a computer monitor 3148c2ecf20Sopenharmony_ci we should scale the images to this size. */ 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci dwidth = format.fmt.pix.width / aspect; 3178c2ecf20Sopenharmony_ci dheight = format.fmt.pix.height; 318