ext-ctrls-jpeg.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _jpeg-controls:
  4. **********************
  5. JPEG Control Reference
  6. **********************
  7. The JPEG class includes controls for common features of JPEG encoders
  8. and decoders. Currently it includes features for codecs implementing
  9. progressive baseline DCT compression process with Huffman entropy
  10. coding.
  11. .. _jpeg-control-id:
  12. JPEG Control IDs
  13. ================
  14. ``V4L2_CID_JPEG_CLASS (class)``
  15. The JPEG class descriptor. Calling
  16. :ref:`VIDIOC_QUERYCTRL` for this control will
  17. return a description of this control class.
  18. ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING (menu)``
  19. The chroma subsampling factors describe how each component of an
  20. input image is sampled, in respect to maximum sample rate in each
  21. spatial dimension. See :ref:`itu-t81`, clause A.1.1. for more
  22. details. The ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING`` control determines
  23. how Cb and Cr components are downsampled after converting an input
  24. image from RGB to Y'CbCr color space.
  25. .. tabularcolumns:: |p{7.5cm}|p{10.0cm}|
  26. .. flat-table::
  27. :header-rows: 0
  28. :stub-columns: 0
  29. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444``
  30. - No chroma subsampling, each pixel has Y, Cr and Cb values.
  31. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422``
  32. - Horizontally subsample Cr, Cb components by a factor of 2.
  33. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420``
  34. - Subsample Cr, Cb components horizontally and vertically by 2.
  35. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411``
  36. - Horizontally subsample Cr, Cb components by a factor of 4.
  37. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410``
  38. - Subsample Cr, Cb components horizontally by 4 and vertically by 2.
  39. * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY``
  40. - Use only luminance component.
  41. ``V4L2_CID_JPEG_RESTART_INTERVAL (integer)``
  42. The restart interval determines an interval of inserting RSTm
  43. markers (m = 0..7). The purpose of these markers is to additionally
  44. reinitialize the encoder process, in order to process blocks of an
  45. image independently. For the lossy compression processes the restart
  46. interval unit is MCU (Minimum Coded Unit) and its value is contained
  47. in DRI (Define Restart Interval) marker. If
  48. ``V4L2_CID_JPEG_RESTART_INTERVAL`` control is set to 0, DRI and RSTm
  49. markers will not be inserted.
  50. .. _jpeg-quality-control:
  51. ``V4L2_CID_JPEG_COMPRESSION_QUALITY (integer)``
  52. Determines trade-off between image quality and size.
  53. It provides simpler method for applications to control image quality,
  54. without a need for direct reconfiguration of luminance and chrominance
  55. quantization tables. In cases where a driver uses quantization tables
  56. configured directly by an application, using interfaces defined
  57. elsewhere, ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control should be set by
  58. driver to 0.
  59. The value range of this control is driver-specific. Only positive,
  60. non-zero values are meaningful. The recommended range is 1 - 100,
  61. where larger values correspond to better image quality.
  62. .. _jpeg-active-marker-control:
  63. ``V4L2_CID_JPEG_ACTIVE_MARKER (bitmask)``
  64. Specify which JPEG markers are included in compressed stream. This
  65. control is valid only for encoders.
  66. .. flat-table::
  67. :header-rows: 0
  68. :stub-columns: 0
  69. * - ``V4L2_JPEG_ACTIVE_MARKER_APP0``
  70. - Application data segment APP\ :sub:`0`.
  71. * - ``V4L2_JPEG_ACTIVE_MARKER_APP1``
  72. - Application data segment APP\ :sub:`1`.
  73. * - ``V4L2_JPEG_ACTIVE_MARKER_COM``
  74. - Comment segment.
  75. * - ``V4L2_JPEG_ACTIVE_MARKER_DQT``
  76. - Quantization tables segment.
  77. * - ``V4L2_JPEG_ACTIVE_MARKER_DHT``
  78. - Huffman tables segment.
  79. For more details about JPEG specification, refer to :ref:`itu-t81`,
  80. :ref:`jfif`, :ref:`w3c-jpeg-jfif`.