raspberrypi-pisp-be.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =========================================================
  3. Raspberry Pi PiSP Back End Memory-to-Memory ISP (pisp-be)
  4. =========================================================
  5. The PiSP Back End
  6. =================
  7. The PiSP Back End is a memory-to-memory Image Signal Processor (ISP) which reads
  8. image data from DRAM memory and performs image processing as specified by the
  9. application through the parameters in a configuration buffer, before writing
  10. pixel data back to memory through two distinct output channels.
  11. The ISP registers and programming model are documented in the `Raspberry Pi
  12. Image Signal Processor (PiSP) Specification document`_
  13. The PiSP Back End ISP processes images in tiles. The handling of image
  14. tessellation and the computation of low-level configuration parameters is
  15. realized by a free software library called `libpisp
  16. <https://github.com/raspberrypi/libpisp>`_.
  17. The full image processing pipeline, which involves capturing RAW Bayer data from
  18. an image sensor through a MIPI CSI-2 compatible capture interface, storing them
  19. in DRAM memory and processing them in the PiSP Back End to obtain images usable
  20. by an application is implemented in `libcamera <https://libcamera.org>`_ as
  21. part of the Raspberry Pi platform support.
  22. The pisp-be driver
  23. ==================
  24. The Raspberry Pi PiSP Back End (pisp-be) driver is located under
  25. drivers/media/platform/raspberrypi/pisp-be. It uses the `V4L2 API` to register
  26. a number of video capture and output devices, the `V4L2 subdev API` to register
  27. a subdevice for the ISP that connects the video devices in a single media graph
  28. realized using the `Media Controller (MC) API`.
  29. The media topology registered by the `pisp-be` driver is represented below:
  30. .. _pips-be-topology:
  31. .. kernel-figure:: raspberrypi-pisp-be.dot
  32. :alt: Diagram of the default media pipeline topology
  33. :align: center
  34. The media graph registers the following video device nodes:
  35. - pispbe-input: output device for images to be submitted to the ISP for
  36. processing.
  37. - pispbe-tdn_input: output device for temporal denoise.
  38. - pispbe-stitch_input: output device for image stitching (HDR).
  39. - pispbe-output0: first capture device for processed images.
  40. - pispbe-output1: second capture device for processed images.
  41. - pispbe-tdn_output: capture device for temporal denoise.
  42. - pispbe-stitch_output: capture device for image stitching (HDR).
  43. - pispbe-config: output device for ISP configuration parameters.
  44. pispbe-input
  45. ------------
  46. Images to be processed by the ISP are queued to the `pispbe-input` output device
  47. node. For a list of image formats supported as input to the ISP refer to the
  48. `Raspberry Pi Image Signal Processor (PiSP) Specification document`_.
  49. pispbe-tdn_input, pispbe-tdn_output
  50. -----------------------------------
  51. The `pispbe-tdn_input` output video device receives images to be processed by
  52. the temporal denoise block which are captured from the `pispbe-tdn_output`
  53. capture video device. Userspace is responsible for maintaining queues on both
  54. devices, and ensuring that buffers completed on the output are queued to the
  55. input.
  56. pispbe-stitch_input, pispbe-stitch_output
  57. -----------------------------------------
  58. To realize HDR (high dynamic range) image processing the image stitching and
  59. tonemapping blocks are used. The `pispbe-stitch_output` writes images to memory
  60. and the `pispbe-stitch_input` receives the previously written frame to process
  61. it along with the current input image. Userspace is responsible for maintaining
  62. queues on both devices, and ensuring that buffers completed on the output are
  63. queued to the input.
  64. pispbe-output0, pispbe-output1
  65. ------------------------------
  66. The two capture devices write to memory the pixel data as processed by the ISP.
  67. pispbe-config
  68. -------------
  69. The `pispbe-config` output video devices receives a buffer of configuration
  70. parameters that define the desired image processing to be performed by the ISP.
  71. The format of the ISP configuration parameter is defined by
  72. :c:type:`pisp_be_tiles_config` C structure and the meaning of each parameter is
  73. described in the `Raspberry Pi Image Signal Processor (PiSP) Specification
  74. document`_.
  75. ISP configuration
  76. =================
  77. The ISP configuration is described solely by the content of the parameters
  78. buffer. The only parameter that userspace needs to configure using the V4L2 API
  79. is the image format on the output and capture video devices for validation of
  80. the content of the parameters buffer.
  81. .. _Raspberry Pi Image Signal Processor (PiSP) Specification document: https://datasheets.raspberrypi.com/camera/raspberry-pi-image-signal-processor-specification.pdf