{"@attributes":{"version":"2.0"},"channel":{"title":"uajain's musings","link":"https:\/\/dev.uajain.com\/","description":"Recent content on uajain's musings","generator":"Hugo","language":"en-us","managingEditor":"email@uajain.com (Umang Jain)","webMaster":"email@uajain.com (Umang Jain)","lastBuildDate":"Tue, 16 Sep 2025 12:55:18 +0530","item":{"title":"Testing out libcamera Software-ISP on RPi3\/4","link":"https:\/\/dev.uajain.com\/blog\/software-isp-libcamera\/","pubDate":"Tue, 16 Sep 2025 12:55:18 +0530","author":"email@uajain.com (Umang Jain)","guid":"https:\/\/dev.uajain.com\/blog\/software-isp-libcamera\/","description":"<h2 id=\"introduction\">Introduction<\/h2>\n<p>In this post, we are going to test libcamera software-isp on RaspberryPi 3\/4\nhardware. The post is intended for the curious, to test out the SoftISP and\nperhaps hack on it, on a relatively easy-to-grab hardware platform.<\/p>\n<h2 id=\"the-software-isp-in-libcamera\">The Software-ISP in libcamera<\/h2>\n<p>SoftISP in itself, is quite an independent project in libcamera itself.\nCurrently, the ISP module merged in libcamera mainline, runs on CPU but\nefforts are in full-swing to develop and merge a GPU-based Software ISP in\nlibcamera [1].<\/p>\n<p>Ideally, you can use SoftwareISP on any platform by just adding the platform\nmatching string, in the list of supportedDevices of simple pipeline handler\nand setting the SoftwareISP flag as true. We are doing to the same for RPi3\/4,\nin order to test it.<\/p>\n<p>Add &lsquo;unicam&rsquo; CSI-2 receiver for RPi 3\/4 in the list of simple pipeline handler&rsquo;s\nlist of supported devices. Additionally, set SoftwareISP flag to true, in order\nto engage it.<\/p>\n<pre tabindex=\"0\"><code>static const SimplePipelineInfo supportedDevices[] = {\n    { &#34;dcmipp&#34;, {}, false },\n    { &#34;imx7-csi&#34;, { { &#34;pxp&#34;, 1 } }, false },\n    { &#34;intel-ipu6&#34;, {}, true },\n    { &#34;j721e-csi2rx&#34;, {}, true },\n    { &#34;mtk-seninf&#34;, { { &#34;mtk-mdp&#34;, 3 } }, false },\n    { &#34;mxc-isi&#34;, {}, false },\n    { &#34;qcom-camss&#34;, {}, true },\n    { &#34;sun6i-csi&#34;, {}, false },\n+   { &#34;unicam&#34;, {}, true },\n};\n<\/code><\/pre><h2 id=\"build-libcamera\">Build libcamera<\/h2>\n<p>We need to build libcamera now, without the Rpi3\/4 pipeline handler but with\nsimple pipeline handler. One can specify this by passing <code>-Dpipelines=simple<\/code>\nto meson.<\/p>\n<pre tabindex=\"0\"><code>($) meson setup -Dpipelines=simple -Dcam=enabled build\n($) ninja -C build\n<\/code><\/pre><p>The extensive build instructions are stated \n<a href=\"https:\/\/libcamera.org\/getting-started.html\">here<\/a>\n.<\/p>\n<p>Tip: You can pass <code>--buildtype=release<\/code> to meson for an perf-optimised build.<\/p>\n<h2 id=\"test-the-build\">Test the build<\/h2>\n<p>Once a camera sensor is connected to RPi3\/4 and libcamera has been build, one\ncan easily if the above configuration took effect and you are ready to\nstream\/route the frames from sensor to SoftwareISP.<\/p>\n<pre tabindex=\"0\"><code>($) .\/build\/src\/apps\/cam\/cam --list\n<\/code><\/pre><p>Now that you have verified that the camera pipeline is setup successfully, you\ncan be sure that the frames captured by the camera sensor are routed through\nthe SoftwareISP (instead of the bcm2835-isp present on RPi)<\/p>\n<pre tabindex=\"0\"><code>($) .\/build\/src\/apps\/cam\/cam --camera 1 --capture\n<\/code><\/pre><p>Tip: Pass one of <code>--display<\/code>, <code>--sdl<\/code> or <code>--file=filename<\/code> options to <code>cam<\/code> to direct\nprocessed frames to one of the sinks.<\/p>\n<h2 id=\"oops-streaming-failed\">Oops! Streaming failed?<\/h2>\n<p>Oh, well, it did happen to me when the RPi was connected to IMX219 sensor.\nI happen to debug the issue and found that the simple pipeline handler does\nnot take into sensor transforms into the account during <code>configure()<\/code>. A patch\nhas been submitted \n<a href=\"https:\/\/patchwork.libcamera.org\/patch\/24092\/\">upstream<\/a>\n,\nhopfully should land soon!<\/p>\n<p>Still facing issues? Get in touch at the upstream IRC channel or libcamera\n\n<a href=\"https:\/\/libcamera.org\/contributing.html#mailing-list\">mailing list<\/a>\n.<\/p>\n<p>Happy hacking!<\/p>\n"}}}