1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2 3 .. _selection-vs-crop: 4 5 ******************************** 6 Comparison with old cropping API 7 ******************************** 8 9 The selection API was introduced to cope with deficiencies of the 10 older :ref:`CROP API <crop>`, that was designed to control simple 11 capture devices. Later the cropping API was adopted by video output 12 drivers. The ioctls are used to select a part of the display were the 13 video signal is inserted. It should be considered as an API abuse 14 because the described operation is actually the composing. The 15 selection API makes a clear distinction between composing and cropping 16 operations by setting the appropriate targets. 17 18 The CROP API lacks any support for composing to and cropping from an 19 image inside a memory buffer. The application could configure a 20 capture device to fill only a part of an image by abusing V4L2 21 API. Cropping a smaller image from a larger one is achieved by setting 22 the field ``bytesperline`` at struct :c:type:`v4l2_pix_format`. 23 Introducing an image offsets could be done by modifying field 24 ``m_userptr`` at struct :c:type:`v4l2_buffer` before calling 25 :ref:`VIDIOC_QBUF <VIDIOC_QBUF>`. Those operations should be avoided 26 because they are not portable (endianness), and do not work for 27 macroblock and Bayer formats and mmap buffers. 28 29 The selection API deals with configuration of buffer 30 cropping/composing in a clear, intuitive and portable way. Next, with 31 the selection API the concepts of the padded target and constraints 32 flags are introduced. Finally, struct :c:type:`v4l2_crop` and struct 33 :c:type:`v4l2_cropcap` have no reserved fields. Therefore there is no 34 way to extend their functionality. The new struct 35 :c:type:`v4l2_selection` provides a lot of place for future 36 extensions. 37 38 Driver developers are encouraged to implement only selection API. The 39 former cropping API would be simulated using the new one.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.