-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PiSP support for RAW14 MIPI Sensor? #172
Comments
Sadly there is an issue with RAW14 (just like RAW16 had issues). So we need to add some software RAW14->16 conversion in the pipeline handler. I don't have an eta on this feature yet though. On a side note, this is not actually the problem you see above. It seems like something is not accurately reporting the format or size in 14-bit more. Perhaps the device driver, or the CFE driver, it's hard to tell. Does |
No unfortunately dmesg doesn't reveal much:
The driver is here: https://github.com/will127534/imx294-v4l2-driver The default driver implementation only contains 12-bit modes, but I have gone ahead and added a couple 10-bit modes successfully, but libcamera errors are only present with 14-bit modes. I'm ready to test / patch things as required to get this mode working. Is there a rough area I can be pointed to as far as fixing this? |
I think your error is because However, as mentioned earlier you will not get valid pixel data output as we need to have some software fixups. |
Still running into an identical error:
and
There must be more on the libcamera end to do with this? notice this line |
Can you share the change you made to Regarding the framerate number, libcamera computes the framerate with the horizontal/vertical blanking limits that are reported by the kernel device driver. Perhaps they are not setup correctly for the 14-bit mode? |
These are the parameters for the readout mode in 12-bit:
and for 14-bit:
so there are differences in VMAX and HMAX that should result in different max frame rate? |
Just as an aside - it might be possible to workaround the hardware limitation where we don't need to software post-process the RAW-14 data. Do you know if this sensor can set a custom CSI2 datatype in the packet header? Normally for 14-bit data, the value is 0x2D. If you can change this to 0x2E, 14-bit should work (above software problems aside), including statistics gathering and everything. |
That's correct, this is a bug in our CSI2-RX that it treats 16-bit data (datatype 0x2E) as 14-bit. Some sensors have the ability to set custom data-type values. So if you can set the sensor up for 14-bit output, but set the datatype as 16-bit (0x2E), it will workaround the bug in our CSI2-RX. |
If that options exists, it's not present in any of the documentation I have access to... CSI2-RX bug is hardware or can be patched in firmware? |
No this cannot be patched in the firmware. We must postprocess the RAW data to generate a sensible output. |
Assuming a similar approach can be taken as the endianness fix for the 16-bit RAW from the IMX585. I'm a little stumped as to what measures need to be taken; given that Libcamera hard crashes with the error I have shown above. With the 16-bit RAW endianness issue, although the pixel data was improper, frames were passing through just as normal, not the case with 14-bit RAW. I've taken a look here at the error itself:
The only further info I could dig out is that the mismatch is that one of them is reported as 14 and the other as 16 ( assuming this is the exact behaviour you are describing in the CSI2-RX bug ) is the CSI2-RX source available? can I modify this and test? |
No, what you are hitting is a purely software issue. Is |
The CSI2 RX driver source can be found at https://github.com/raspberrypi/linux/blob/rpi-6.6.y/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c, but I doubt there is a problem in that. |
Solved a piece to this issue, here in
Now, as expected; the output image is a mess of noisy / malformed pixel data. But I can't tell if it's simply a matter of a bitshift, incorrect endianness or that the RAW is not properly being unpacked? or any number of combination of those |
I've gone into Vooya to view the RAW pixel data, this is what I get: Find attached the .RAW file: My suspicion is RAW14 is not getting properly unpacked ( hence the large black region near the bottom of the frame ) |
Yes, this now looks like an unpacking issue with the hardware that we expect. When I get a chance, I will write a SW unpacker that should give you a correct looking image. But like the 16-bit case, that statistics will not be available. Would you be able to create a PR for the rpicam-apps changes that you made for 14-bit support? |
That will be a acceptable compromise just as with the 16-bit format. I hope to see the changes get pushed into future revisions of the hardware. PR Opened. |
Let me know if there is approximate timeline for this, I am very eager to test. Thanks again! |
Hi @naushir just following up to see if there is any progress on this? I realize this isn't a trivial task, I attempted an implementation myself... but noticed there are a couple of hurdles to deal with with; one to do with the padding added by CFE which makes it less straight forward than just iterating over the data sequentially and unpacking. Also likely needing to cache the at least 2 rows worth of data... |
Unfortunately it's going to be a while before I get to looking at this, sorry :( |
Any chance of a revisit anytime soon? |
Not yet I'm afraid, there's just too much more going on right now that I have to work on. |
Having some issues with getting a RAW14 capable MIPI sensor working in Libcamera. The driver is currently under development such that it is possible there are issues on that end, but also looking at some of the PiSP docs, I don't see any explicit mention of support for this format? which would really suck :(
This is what get's logged when attempting to launch a rpicam-apps instance that calls for RAW14 mode:
CMD:
rpicam-hello -t 0 --viewfinder-mode 3792:2840:14:U --width 3704 --height 2778 --denoise "off" --shutter 20833 --analoggain 1 --framerate 10 --awb="auto"
The text was updated successfully, but these errors were encountered: