DolWdrSensorMode.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of NVIDIA CORPORATION nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  24. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. /**
  29. * @file
  30. * <b>Libargus Extension: Digital Overlap WDR Sensor Modes</b>
  31. *
  32. * @b Description: Adds extra functionalities for the
  33. * Digital Overlap (DOL) Wide Dynamic Range (WDR) sensor mode type.
  34. */
  35. #ifndef _ARGUS_EXT_DOL_WDR_SENSOR_MODE_H
  36. #define _ARGUS_EXT_DOL_WDR_SENSOR_MODE_H
  37. namespace Argus
  38. {
  39. /**
  40. * Adds extra functionalities for the Digital Overlap (DOL) Wide Dynamic
  41. * Range (WDR) sensor mode type. It introduces one new interface:
  42. * - Ext::IDolWdrSensorMode: Returns the extended properties specific to a Digital Overlap (DOL)
  43. * Wide Dynamic Range (WDR) extended sensor mode. DOL WDR is a
  44. * multi-exposure technology that enables fusion of various exposures
  45. * from a single frame to produce a WDR image.
  46. *
  47. * @defgroup ArgusExtDolWdrSensorMode Ext::DolWdrSensorMode
  48. * @ingroup ArgusExtensions
  49. */
  50. DEFINE_UUID(ExtensionName, EXT_DOL_WDR_SENSOR_MODE, 569fb210,70d9,11e7,9598,08,00,20,0c,9a,66);
  51. namespace Ext
  52. {
  53. /**
  54. * @class IDolWdrSensorMode
  55. *
  56. * Interface to the properties of a DOL WDR device.
  57. *
  58. * Returns the extended properties specific to a Digital Overlap (DOL)
  59. * Wide Dynamic Range (WDR) extended sensor mode. DOL WDR is a multi-exposure technology
  60. * that enables fusion of various exposures from a single frame to produce a WDR image.
  61. *
  62. * A DOL WDR RAW buffer contains different DOL exposures in an interleaved layout. DOL WDR
  63. * supports two exposure (long and short) and three exposure (long, short and very short) schemes.
  64. * These schemes are referred to as DOL-2 and DOL-3 respectively.
  65. *
  66. * Exposures are time staggered which leads to vertical blank period (VBP) rows being inserted
  67. * in between various exposures. This scheme results in (N-1) sections of VBP rows for an N exposure
  68. * DOL WDR frame.
  69. *
  70. * Each exposure is preceded by optical black (OB) rows.
  71. *
  72. * Each row of DOL WDR RAW interleaved frame starts with a few Line Info (LI) marker pixels.
  73. * LI pixels distinguish the kind of row.
  74. * Row types include:
  75. * a. Long Exposure
  76. * b. Short Exposure
  77. * c. Very Short Exposure
  78. * d. Vertical Blank Period
  79. *
  80. * For a DOL-2 exposure scheme, there is only one section of VBP rows. The data layout per exposure
  81. * looks like this:
  82. * Long exposure has OB rows, image rows, VBP rows.
  83. * Short exposure has OB rows, VBP rows, image rows.
  84. *
  85. * The ordering of VBP rows changes across exposures but the count of VBP rows per exposure
  86. * remains the same. The final interleaved DOL WDR RAW frame buffer is produced by interleaving
  87. * each exposure's data on a per row basis in a round robin fashion across exposures.
  88. *
  89. * For a DOL-3 exposure scheme, there are two sections of VBP rows. For the sake of terminology
  90. * these are referred to as VBP[0] and VBP[1]. The data layout per exposure looks like this:
  91. * Long exposure has OB rows, image rows, VBP[0] rows, VBP[1] rows.
  92. * Short exposure has OB rows, VBP[0] rows, image rows, VBP[1] rows.
  93. * Very Short exposure has OB rows, VBP[0] rows, VBP[1] rows, image rows.
  94. *
  95. * Again, only the ordering of VBP[0] and VBP[1] rows changes across exposures but the count of
  96. * VBP[0] and VBP[1] rows remains the same. Similar to the DOL-2 scheme, the final interleaved
  97. * DOL WDR RAW frame buffer for DOL-3 scheme is produced by interleaving each exposure's data
  98. * on a per row basis in a round robin fashion across exposures.
  99. *
  100. * This scheme can be extended to DOL-N exposures with (N-1) sections of VBP rows ranging from
  101. * VBP[0] to VBP[N-2]. When considering the vertical blank period sections for exposure N,
  102. * the rows of VBP[X] will come before the image data if X < N, otherwise they will come
  103. * after the image data.
  104. *
  105. * Hence, a DOL-N RAW buffer would have different dimensions than the fused output
  106. * WDR frame buffer. The resolution of the DOL-N RAW buffer is referred to as physical resolution.
  107. *
  108. * The set of properties for basic sensor modes is still applicable to DOL WDR sensor mode. Those
  109. * properties are available through the ISensorMode interface. The only difference is that the
  110. * resolution property provided by the ISensorMode interface for DOL WDR would be the size of the
  111. * fused WDR frame. WDR fusion typically eliminates LI markers, OB rows and VBP rows and merges the
  112. * individual exposures to create a frame that is smaller in height and width than the
  113. * DOL WDR RAW interleaved frame.
  114. *
  115. * Following the LI marker pixels is the actual pixel data for each row. This data may include
  116. * margin pixels on the left or right side of the row, which are generally used for filtering
  117. * and cropped out of a fused DOL image. The width of these margin pixels can be queried by
  118. * getLeftMarginWidth()/getRightMarginWidth().
  119. * @see ISensorMode
  120. *
  121. * @ingroup ArgusSensorMode ArgusExtDolWdrSensorMode
  122. */
  123. DEFINE_UUID(InterfaceID, IID_DOL_WDR_SENSOR_MODE, a1f4cae0,70dc,11e7,9598,08,00,20,0c,9a,66);
  124. class IDolWdrSensorMode : public Interface
  125. {
  126. public:
  127. static const InterfaceID& id() { return IID_DOL_WDR_SENSOR_MODE; }
  128. /**
  129. * Returns the number of exposures captured per frame for this DOL WDR mode.
  130. * Typically, 2 = Long, Short or 3 = Long, Short, Very Short exposures.
  131. */
  132. virtual uint32_t getExposureCount() const = 0;
  133. /**
  134. * Returns number of Optical Black rows at the start of each exposure in a DOL WDR frame.
  135. */
  136. virtual uint32_t getOpticalBlackRowCount() const = 0;
  137. /**
  138. * Returns number of vertical blank period rows for each DOL WDR exposure.
  139. *
  140. * @param[out] verticalBlankPeriodRowCounts The output vector to store the
  141. * vertical blank period (VBP) rows per DOL WDR exposure. Size of the vector is
  142. * getExposureCount()-1 count values. When considering the vertical blank period
  143. * sections for exposure N, the rows of VBP[X] will come before the image data
  144. * if X < N, otherwise they will come after the image data.
  145. */
  146. virtual Status getVerticalBlankPeriodRowCount(
  147. std::vector<uint32_t>* verticalBlankPeriodRowCounts) const = 0;
  148. /**
  149. * Returns line info markers width in pixels.
  150. * These occur at the start of each pixel row to distinguish row types. There are different
  151. * line info markers to distinguish each different exposure and vertical blank period rows.
  152. *
  153. * Optical black rows have the same line info markers as the exposure type they appear on.
  154. */
  155. virtual uint32_t getLineInfoMarkerWidth() const = 0;
  156. /**
  157. * Returns number of margin pixels on left per row.
  158. */
  159. virtual uint32_t getLeftMarginWidth() const = 0;
  160. /**
  161. * Returns number of margin pixels on right per row.
  162. */
  163. virtual uint32_t getRightMarginWidth() const = 0;
  164. /**
  165. * Returns the physical resolution derived due to the interleaved exposure output from DOL WDR
  166. * frames.
  167. */
  168. virtual Size2D<uint32_t> getPhysicalResolution() const = 0;
  169. protected:
  170. ~IDolWdrSensorMode() {}
  171. };
  172. } // namespace Ext
  173. } // namespace Argus
  174. #endif // _ARGUS_EXT_DOL_WDR_SENSOR_MODE_H