@@ -131,7 +131,7 @@ public:
constexpr Span(element_type (&arr)[N],
std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],
element_type (*)[]>::value &&
- N == Extent,
+ N == Extent,
std::nullptr_t> = nullptr) noexcept
: data_(arr)
{
@@ -141,7 +141,7 @@ public:
constexpr Span(std::array<value_type, N> &arr,
std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],
element_type (*)[]>::value &&
- N == Extent,
+ N == Extent,
std::nullptr_t> = nullptr) noexcept
: data_(arr.data())
{
@@ -151,7 +151,7 @@ public:
constexpr Span(const std::array<value_type, N> &arr,
std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],
element_type (*)[]>::value &&
- N == Extent,
+ N == Extent,
std::nullptr_t> = nullptr) noexcept
: data_(arr.data())
{
@@ -160,10 +160,10 @@ public:
template<class Container>
explicit constexpr Span(Container &cont,
std::enable_if_t<!details::is_span<Container>::value &&
- !details::is_array<Container>::value &&
- !std::is_array<Container>::value &&
- std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
- element_type (*)[]>::value,
+ !details::is_array<Container>::value &&
+ !std::is_array<Container>::value &&
+ std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
+ element_type (*)[]>::value,
std::nullptr_t> = nullptr)
: data_(utils::data(cont))
{
@@ -172,10 +172,10 @@ public:
template<class Container>
explicit constexpr Span(const Container &cont,
std::enable_if_t<!details::is_span<Container>::value &&
- !details::is_array<Container>::value &&
- !std::is_array<Container>::value &&
- std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
- element_type (*)[]>::value,
+ !details::is_array<Container>::value &&
+ !std::is_array<Container>::value &&
+ std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
+ element_type (*)[]>::value,
std::nullptr_t> = nullptr)
: data_(utils::data(cont))
{
@@ -185,7 +185,7 @@ public:
template<class U, std::size_t N>
explicit constexpr Span(const Span<U, N> &s,
std::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value &&
- N == Extent,
+ N == Extent,
std::nullptr_t> = nullptr) noexcept
: data_(s.data())
{
@@ -242,10 +242,7 @@ public:
static_assert(Offset <= Extent, "Offset larger than size");
static_assert(Count == dynamic_extent || Count + Offset <= Extent,
"Offset + Count larger than size");
- return Span<element_type, Count != dynamic_extent ? Count : Extent - Offset>{
- data() + Offset,
- Count == dynamic_extent ? size() - Offset : Count
- };
+ return Span < element_type, Count != dynamic_extent ? Count : Extent - Offset > { data() + Offset, Count == dynamic_extent ? size() - Offset : Count };
}
constexpr Span<element_type, dynamic_extent>
@@ -322,10 +319,10 @@ public:
template<class Container>
constexpr Span(Container &cont,
std::enable_if_t<!details::is_span<Container>::value &&
- !details::is_array<Container>::value &&
- !std::is_array<Container>::value &&
- std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
- element_type (*)[]>::value,
+ !details::is_array<Container>::value &&
+ !std::is_array<Container>::value &&
+ std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
+ element_type (*)[]>::value,
std::nullptr_t> = nullptr)
: data_(utils::data(cont)), size_(utils::size(cont))
{
@@ -334,10 +331,10 @@ public:
template<class Container>
constexpr Span(const Container &cont,
std::enable_if_t<!details::is_span<Container>::value &&
- !details::is_array<Container>::value &&
- !std::is_array<Container>::value &&
- std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
- element_type (*)[]>::value,
+ !details::is_array<Container>::value &&
+ !std::is_array<Container>::value &&
+ std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
+ element_type (*)[]>::value,
std::nullptr_t> = nullptr)
: data_(utils::data(cont)), size_(utils::size(cont))
{
@@ -22,11 +22,12 @@
#include <libcamera/control_ids.h>
#include <libcamera/controls.h>
#include <libcamera/framebuffer.h>
+#include <libcamera/request.h>
+
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
#include <libcamera/ipa/raspberrypi.h>
#include <libcamera/ipa/raspberrypi_ipa_interface.h>
-#include <libcamera/request.h>
#include "libcamera/internal/mapped_framebuffer.h"
@@ -10,26 +10,26 @@
#include <fcntl.h>
#include <memory>
#include <mutex>
-#include <queue>
#include <unordered_set>
#include <utility>
+#include <linux/bcm2835-isp.h>
+#include <linux/media-bus-format.h>
+#include <linux/videodev2.h>
+
#include <libcamera/base/shared_fd.h>
#include <libcamera/base/utils.h>
#include <libcamera/camera.h>
#include <libcamera/control_ids.h>
#include <libcamera/formats.h>
-#include <libcamera/ipa/raspberrypi.h>
-#include <libcamera/ipa/raspberrypi_ipa_interface.h>
-#include <libcamera/ipa/raspberrypi_ipa_proxy.h>
#include <libcamera/logging.h>
#include <libcamera/property_ids.h>
#include <libcamera/request.h>
-#include <linux/bcm2835-isp.h>
-#include <linux/media-bus-format.h>
-#include <linux/videodev2.h>
+#include <libcamera/ipa/raspberrypi.h>
+#include <libcamera/ipa/raspberrypi_ipa_interface.h>
+#include <libcamera/ipa/raspberrypi_ipa_proxy.h>
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/camera.h"
@@ -42,6 +42,8 @@
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/v4l2_videodevice.h"
+#include <queue>
+
#include "dma_heaps.h"
#include "rpi_stream.h"
@@ -174,8 +176,12 @@ V4L2SubdeviceFormat findBestFormat(const SensorFormats &formatsMap, const Size &
return bestFormat;
}
-enum class Unicam : unsigned int { Image, Embedded };
-enum class Isp : unsigned int { Input, Output0, Output1, Stats };
+enum class Unicam : unsigned int { Image,
+ Embedded };
+enum class Isp : unsigned int { Input,
+ Output0,
+ Output1,
+ Stats };
} /* namespace */
@@ -250,7 +256,10 @@ public:
* thread. So, we do not need to have any mutex to protect access to any
* of the variables below.
*/
- enum class State { Stopped, Idle, Busy, IpaComplete };
+ enum class State { Stopped,
+ Idle,
+ Busy,
+ IpaComplete };
State state_;
struct BayerFrame {
@@ -544,7 +553,6 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
cfg.stride = format.planes[0].bpl;
cfg.frameSize = format.planes[0].size;
-
}
return status;
@@ -651,8 +659,8 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
PixelFormat pf = mbusCodeToPixelFormat(format.first,
BayerFormat::Packing::CSI2);
if (pf.isValid())
- deviceFormats.emplace(std::piecewise_construct, std::forward_as_tuple(pf),
- std::forward_as_tuple(format.second.begin(), format.second.end()));
+ deviceFormats.emplace(std::piecewise_construct, std::forward_as_tuple(pf),
+ std::forward_as_tuple(format.second.begin(), format.second.end()));
}
} else {
/*
@@ -11,12 +11,12 @@
#include <iostream>
#include <map>
-#include <tiffio.h>
-
#include <libcamera/control_ids.h>
#include <libcamera/formats.h>
#include <libcamera/property_ids.h>
+#include <tiffio.h>
+
using namespace libcamera;
enum CFAPatternColour : uint8_t {
@@ -201,7 +201,7 @@ void packScanlineIPU3(void *output, const void *input, unsigned int width)
if (++x >= width)
return;
- *out++ = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
+ *out++ = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
if (++x >= width)
return;
@@ -235,8 +235,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output,
if (pixelInBlock == 24)
pixelInBlock--;
- const uint8_t *in = static_cast<const uint8_t *>(input)
- + block * 32 + (pixelInBlock / 4) * 5;
+ const uint8_t *in = static_cast<const uint8_t *>(input) + block * 32 + (pixelInBlock / 4) * 5;
uint16_t val1, val2, val3, val4;
switch (pixelInBlock % 4) {
@@ -254,14 +253,14 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output,
break;
case 2:
val1 = (in[3] & 0x3f) << 10 | (in[2] & 0xf0) << 2;
- val2 = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
+ val2 = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
val3 = (in[stride + 3] & 0x3f) << 10 | (in[stride + 2] & 0xf0) << 2;
- val4 = (in[stride + 4] & 0xff) << 8 | (in[stride + 3] & 0xc0) << 0;
+ val4 = (in[stride + 4] & 0xff) << 8 | (in[stride + 3] & 0xc0) << 0;
break;
case 3:
- val1 = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
+ val1 = (in[4] & 0xff) << 8 | (in[3] & 0xc0) << 0;
val2 = (in[6] & 0x03) << 14 | (in[5] & 0xff) << 6;
- val3 = (in[stride + 4] & 0xff) << 8 | (in[stride + 3] & 0xc0) << 0;
+ val3 = (in[stride + 4] & 0xff) << 8 | (in[stride + 3] & 0xc0) << 0;
val4 = (in[stride + 6] & 0x03) << 14 | (in[stride + 5] & 0xff) << 6;
break;
}
@@ -275,77 +274,77 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output,
static const std::map<PixelFormat, FormatInfo> formatInfo = {
{ formats::SBGGR10_CSI2P, {
- .bitsPerSample = 10,
- .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
- .packScanline = packScanlineSBGGR10P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 10,
+ .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
+ .packScanline = packScanlineSBGGR10P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SGBRG10_CSI2P, {
- .bitsPerSample = 10,
- .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
- .packScanline = packScanlineSBGGR10P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 10,
+ .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
+ .packScanline = packScanlineSBGGR10P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SGRBG10_CSI2P, {
- .bitsPerSample = 10,
- .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
- .packScanline = packScanlineSBGGR10P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 10,
+ .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
+ .packScanline = packScanlineSBGGR10P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SRGGB10_CSI2P, {
- .bitsPerSample = 10,
- .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
- .packScanline = packScanlineSBGGR10P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 10,
+ .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
+ .packScanline = packScanlineSBGGR10P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SBGGR12_CSI2P, {
- .bitsPerSample = 12,
- .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
- .packScanline = packScanlineSBGGR12P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 12,
+ .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
+ .packScanline = packScanlineSBGGR12P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SGBRG12_CSI2P, {
- .bitsPerSample = 12,
- .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
- .packScanline = packScanlineSBGGR12P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 12,
+ .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
+ .packScanline = packScanlineSBGGR12P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SGRBG12_CSI2P, {
- .bitsPerSample = 12,
- .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
- .packScanline = packScanlineSBGGR12P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 12,
+ .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
+ .packScanline = packScanlineSBGGR12P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SRGGB12_CSI2P, {
- .bitsPerSample = 12,
- .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
- .packScanline = packScanlineSBGGR12P,
- .thumbScanline = thumbScanlineSBGGRxxP,
- } },
+ .bitsPerSample = 12,
+ .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
+ .packScanline = packScanlineSBGGR12P,
+ .thumbScanline = thumbScanlineSBGGRxxP,
+ } },
{ formats::SBGGR10_IPU3, {
- .bitsPerSample = 16,
- .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
- .packScanline = packScanlineIPU3,
- .thumbScanline = thumbScanlineIPU3,
- } },
+ .bitsPerSample = 16,
+ .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
+ .packScanline = packScanlineIPU3,
+ .thumbScanline = thumbScanlineIPU3,
+ } },
{ formats::SGBRG10_IPU3, {
- .bitsPerSample = 16,
- .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
- .packScanline = packScanlineIPU3,
- .thumbScanline = thumbScanlineIPU3,
- } },
+ .bitsPerSample = 16,
+ .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
+ .packScanline = packScanlineIPU3,
+ .thumbScanline = thumbScanlineIPU3,
+ } },
{ formats::SGRBG10_IPU3, {
- .bitsPerSample = 16,
- .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
- .packScanline = packScanlineIPU3,
- .thumbScanline = thumbScanlineIPU3,
- } },
+ .bitsPerSample = 16,
+ .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
+ .packScanline = packScanlineIPU3,
+ .thumbScanline = thumbScanlineIPU3,
+ } },
{ formats::SRGGB10_IPU3, {
- .bitsPerSample = 16,
- .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
- .packScanline = packScanlineIPU3,
- .thumbScanline = thumbScanlineIPU3,
- } },
+ .bitsPerSample = 16,
+ .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
+ .packScanline = packScanlineIPU3,
+ .thumbScanline = thumbScanlineIPU3,
+ } },
};
int DNGWriter::write(const char *filename, const Camera *camera,
@@ -524,7 +523,8 @@ int DNGWriter::write(const char *filename, const Camera *camera,
*/
unsigned int green = (info->pattern[0] == CFAPatternRed ||
info->pattern[1] == CFAPatternRed)
- ? 0 : 1;
+ ? 0
+ : 1;
for (unsigned int i = 0; i < 4; ++i) {
unsigned int level;
@@ -9,12 +9,12 @@
* Include first to ensure the header is self-contained, as there's no span.cpp
* in libcamera.
*/
-#include <libcamera/base/span.h>
-
#include <array>
#include <iostream>
#include <vector>
+#include <libcamera/base/span.h>
+
#include "test.h"
using namespace std;
Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> --- include/libcamera/base/span.h | 45 +++--- src/ipa/raspberrypi/raspberrypi.cpp | 3 +- .../pipeline/raspberrypi/raspberrypi.cpp | 34 +++-- src/qcam/dng_writer.cpp | 140 +++++++++--------- test/span.cpp | 4 +- 5 files changed, 116 insertions(+), 110 deletions(-) -- 2.25.1