Skip to content
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

Color dot problem #19

Closed
glddiv opened this issue Mar 22, 2021 · 21 comments
Closed

Color dot problem #19

glddiv opened this issue Mar 22, 2021 · 21 comments

Comments

@glddiv
Copy link

glddiv commented Mar 22, 2021

Hi there,

When I was using libcamera-app, there was a strange color dot problem, but when I switched to qcam, there was no problem.
What could be the cause of this?

raspberry pi:
P4B 8GB

camera:
imx219

system version:
Linux raspberrypi 5.10.17-v7l+ #1 SMP Thu Mar 18 16:45:46 CST 2021 armv7l GNU/Linux

image

@naushir
Copy link
Collaborator

naushir commented Mar 22, 2021

The corruption looks to match the saturated bits of the image quite well. This probably rules out anything to do with the CSI-2 link (i.e. cable, clocking, etc.).

As a guess, I would say colour denoise might be causing this, as qcam disables colour denoise by default. Some further questions:

  • How reproducible is this?
  • What is the command line you are running?
  • Assuming this is libcamera-still, does this happen in preview and capture?
  • Could you try running with the --denoise=cdn_off command line argument and see if you can reproduce this?

@glddiv
Copy link
Author

glddiv commented Mar 23, 2021

Hi @naushir

thanks for the reply,

How reproducible is this?

I have this problem almost every time I run libcamera-hello/vid/still.
I am using imx219, and the json file is also the default.

What is the command line you are running?

libcamera-still/vid/hello -t 0

Assuming this is libcamera-still, does this happen in preview and capture?

I tried several times, but the image saved by still has no problem (because the color dots have been flashing, I'm not sure if I got a good frame), but the h264 file saved by vid has this problem.

Could you try running with the --denoise=cdn_off command line argument and see if you can reproduce this?

This problem disappeared after adding the --denoise=cdn_off parameter.

@naushir
Copy link
Collaborator

naushir commented Mar 23, 2021

This problem disappeared after adding the --denoise=cdn_off parameter.

Thanks for confirming. This does sound like video CDN causing this corruption.

Unfortunately, I did not manage to reproduce this yet for myself, will keep trying. @davidplowman, are you able to see this corruption on your setup?

@naushir
Copy link
Collaborator

naushir commented Mar 23, 2021

@glddiv if you point the camera at a dark scene, without any bright lights or windows to saturate the image, do you still see the corruption?

@davidplowman
Copy link
Collaborator

No, I'm not seeing it but will keep an eye open.

@glddiv
Copy link
Author

glddiv commented Mar 23, 2021

Hi @naushir,

This was shot under my desk, but there was still corrosion.
image

h264_file.zip

@naushir
Copy link
Collaborator

naushir commented Mar 23, 2021

@glddiv thank you for trying that out. So it does not seem to be specific to saturated bits in the image. I will need to look at the code in a bit more detail....

@naushir
Copy link
Collaborator

naushir commented Mar 25, 2021

I'm really struggling with this one. I cannot reproduce it, and nothing in the code seems wrong as far as I can tell.

@glddiv, to rule out hardware problems, can you do the following (if possible):

  • Swap to another sensor board if you have one.
  • Add core_freq_min=300 at the bottom of /boot/config.txt and reboot and re-test.

@glddiv
Copy link
Author

glddiv commented Mar 26, 2021

Hi @naushir

I tried IMX219 and IMX477, no luck.
I also tried core_freq_min=300, but it did not improve.

Today I tried to update everything to the latest, and now the program cannot run.
image
image

config.txt
image

@naushir
Copy link
Collaborator

naushir commented Mar 26, 2021

Today I tried to update everything to the latest, and now the program cannot run.

Things going from bad to worse :-(

I did just try a full rebuild and update of kernel and firmware and I do not see the same problem. Here is my version strings:

pi@pi4:~ $ uname -a
Linux pi4-naush 5.10.25-v7l+ #12 SMP Fri Mar 26 07:20:46 GMT 2021 armv7l GNU/Linux

pi@pi4:~ $ sudo vcdbg version
vcos_build_version     = 0dee547b98252c8013f6603f5d1c79e24a42a6e8 (clean)
vcos_build_branch      = bcm2711_2
debug_sym: ReadVideoCoreMemoryBySymbol: Symbol not found: 'vcos_build_application'
vcos_build_application = ?
vcos_build_date        = Mar 26 2021
vcos_build_time        = 07:24:28
vcos_build_user        = naushir
vcos_build_hostname    = naush-laptop
vcos_build_platform    = raspberrypi_linux
debug_sym: ReadVideoCoreMemoryBySymbol: Symbol not found: 'vcos_build_type'
vcos_build_type        = ?

Any chance you might have another Raspberry Pi board to try this on?

@glddiv
Copy link
Author

glddiv commented Mar 26, 2021

update:
I think I figured it out. I used the IMX219 without ATSHA204A. I disabled the camera in raspi-config and it can be used normally. Is this a bug?
Anyway, the corruption still exists.

Strange, I flashed an sd card again and performed the operations in the libcamera document, but the same error persists. Am I missing something?
Tried Pi3B V1.2 and Pi4B, no luck.
image

image

image

@naushir
Copy link
Collaborator

naushir commented Mar 26, 2021

Just to clarify, the update I did was a custom build on ToT for linux and firmware. I have subsequently done a rpi-update, and it now matches exactly with your versions:

pi@pi4:~ $ uname -a
Linux pi4-naush 5.10.25-v7l+ #1408 SMP Mon Mar 22 12:49:24 GMT 2021 armv7l GNU/Linux
pi@pi4:~ $ sudo vcdbg version
vcos_build_version     = 81fb91910274d9cb53baee496477fa7b6c6df739 (clean)
vcos_build_branch      = bcm2711_2
debug_sym: ReadVideoCoreMemoryBySymbol: Symbol not found: 'vcos_build_application'
vcos_build_application = ?
vcos_build_date        = Mar 23 2021
vcos_build_time        = 22:05:02
vcos_build_user        = dom
vcos_build_hostname    = buildbot
vcos_build_platform    = raspberrypi_linux
debug_sym: ReadVideoCoreMemoryBySymbol: Symbol not found: 'vcos_build_type'
vcos_build_type        = ?

Everything still works fine for me. @davidplowman, are you able to do an update on your device and see if you get any errors?

@davidplowman
Copy link
Collaborator

I've just been round the "install fresh image, follow all those instructions" loop with my Pi4 and imx219, and it works with no problems. So this is definitely proving very puzzling. I shall continue to look out for the "dots", however...

@glddiv
Copy link
Author

glddiv commented Mar 27, 2021

Hi @naushir
I tried different cameras IMX219, IMX219 NO-IR and IMX477 (Arducam), tried different cables, tried Pi4B 4GB, Pi4B 8GB and Pi3B, they all have the same problem.
So I moved my gaze to other places. All the Raspberry Pis tested used the same SD card but I tried two and re-flashed one of them, so I think this should not be a problem. There is no lightning sign when running the program, so we can rule out the power supply problem.
I moved my gaze to the peripheral interface. I connected the USB HUB (with the mouse and keyboard connected to it) and the network cable every time.
Then I tried to remove the network cable, and the magic happened, the corrosion did not appear, no matter how I moved the camera or switched scenes, there would be no corrosion. At this time, I connected the network cable back again, and the corrosion problem came back (sometimes I need to shake the camera a few times before it appears).

Photos of my hardware settings:
image

@glddiv
Copy link
Author

glddiv commented Mar 29, 2021

Things have become even more weird. It seems to have the same problem when connecting to WIFI. I recorded a simple video to show this phenomenon.

https://drive.google.com/file/d/1YyGSmgeqwu5lObZBVF4lhFM-o57lf9W6/view?usp=sharing

@naushir
Copy link
Collaborator

naushir commented Mar 29, 2021

@glddiv thanks for the update.

I'm using wifi in my setup at home, but I have also tried with an Ethernet cable and still no luck reproducing. If it's an electrical issue, it does seem strange that switching off colour denosie seems to solve it, I can't really explain that....

Will continue to try and reproduce.

@glddiv
Copy link
Author

glddiv commented Mar 29, 2021

@naushir
I think if no one else can reproduce this problem, maybe there are some special operations I haven't noticed. I will update again if there is more information.

@naushir
Copy link
Collaborator

naushir commented Mar 30, 2021

@glddiv, thank you for your help debugging this. I will continue looking at this in the background. If you have any updates, please do post them here.

popcornmix added a commit to raspberrypi/firmware that referenced this issue Apr 21, 2021
See: raspberrypi/linux#4303

kernel: HDMI support for modes that require the scrambler (4k @ 60Hz, most importantly)
See: raspberrypi/linux#4302

kernel: overlays: spi-rtc: Add ds3232 and ds3234
See: raspberrypi/linux#4292

firmware: isp: Ensure the VRF is locked when setting up video colour denoise
See: raspberrypi/rpicam-apps#19

firmware: isp: Remove custom EV mappings from camera tunings

firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware

firmware: Two UART1 patches
See: #1566
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Apr 21, 2021
See: raspberrypi/linux#4303

kernel: HDMI support for modes that require the scrambler (4k @ 60Hz, most importantly)
See: raspberrypi/linux#4302

kernel: overlays: spi-rtc: Add ds3232 and ds3234
See: raspberrypi/linux#4292

firmware: isp: Ensure the VRF is locked when setting up video colour denoise
See: raspberrypi/rpicam-apps#19

firmware: isp: Remove custom EV mappings from camera tunings

firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware

firmware: Two UART1 patches
See: raspberrypi/firmware#1566
@popcornmix
Copy link

A fix has been pushed to the latest rpi-update firmware.

@naushir
Copy link
Collaborator

naushir commented Apr 22, 2021

@glddiv the fix in rpi-update might just solve your colour dots problem. It's hard to tell, as I cannot reproduce the original fault, but I did fix a problem in the colour denoise code that could cause pixel corruption in the right circumstances.

If you do get a chance to try it out, please let us know the results.

@glddiv
Copy link
Author

glddiv commented Apr 30, 2021

Hi @popcornmix , @naushir

Thank you.
I just ran the test and so far I haven't found corrosion.
It seems that the fix has worked, and I think I can close this issue now.

@glddiv glddiv closed this as completed Apr 30, 2021
mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this issue Dec 3, 2021
- firmware: isp: Fix handling of different YUV colour spaces

- firmware: poe_hat: Actually close the I2C handle

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: video_decode lockup handling

- firmware: isp: Initialise extras to avoid vpitch being random

- firmware: usb: Fix dropouts with USB ethernet gadget
  See: raspberrypi/linux#4084

- firmware: imx477: Allow long exposures for the binned modes.
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=297521

- firmware: arm_dispmanx: Use ALPHA_MIX flag
  See: https://www.raspberrypi.org/forums/viewtopic.php?t=300769

- firmware: power: Refactor the interface to the PMICs

- firmware: platform: vl805: Get BAR2 address from PCIe BAR2 registers

- firmware: arm_loader: Return all borrowed DMA channels
  See: #1541

- firmware: hdmi_2711: Rework I2C driver to NOT use the AUTO-I2C block

- firmware: gencmd: Allow groups of clocks/plls to be read together

- firmware: power: Fix DA9090 under-voltage detection

- firmware: NVME boot support

- firmware: brfs: Fix USB bulk-read in start.elf
  See: Hexxeh/rpi-firmware#258

- firmware: hdmi_2711_i2c: Correct handling of start/stop codes for long read
  See: #1548

- firmware: video_decode: For VC1/WMV with no signalled header bytes, use start of 1st buffer
  See: raspberrypi/linux#4113

- firmware: vl805: Remove redundant log statement and fix warning

- firmware: power: Fix DA9090 ADC1 register definition

- firmware: arm_loader: Only report clocks arm has set, not siblings

- firmware: arm_loader: Don't report clocks set as turbo side effect of arm clock

- firmware: arm_loader: 2711: gpu clocks are not dependant

- firmware: platform: Need to clear cached versions of get_max_clock_internal vars

- firmware: Move core to PLLA and support accurate clk108
  See: xbmc/xbmc#19263

- firmware: board_info: Separate memory size from OTP field encoding

- firmware: power: Swap DA9090 ADC assignments to match XR77004

- firmware: board-info: Fix memsize on 3B+

- firmware: vcfw/power: Add a new latch for power_pad_control
  See: #1552

- firmware: arm_loader: kernel_old=1 should force kernel_address=0
  See: #1561

- firmware: scalerlib: Fix offset applied to x coordinate of YUV10COL image
  See: https://forum.kodi.tv/showthread.php?tid=361164&pid=3024654#pid3024654

- firmware: isp: Ensure the VRF is locked when setting up video colour denoise
  See: raspberrypi/rpicam-apps#19

- firmware: isp: Remove custom EV mappings from camera tunings

- firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware

- firmware: Two UART1 patches
  See: #1566

- firmware: Pi400: Reduce MII clock freq when probing ethernet PHY

- firmware: platform: Remove build-time constant for MICROVOLTS_PER_PIP

- firmware: dt-blob.dts: Correct HDMI HPD and EMMC_ENABLE for CM4
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&p=1858516

- firmware: vcfw/hdmi: CUSTOM modes used for FKMS didn't set RGB quant range correctly
  See: #1580

- firmware: PoE+ HAT support
  See: raspberrypi/linux#4367

- firmware: arm_loader: Use Pi4 bootloader MAC_ADDRESS if set

- firmware: platform: Apply ARM thermal throttling rules on BCM2711

- firmware: bcm_host: Recognise all Pi 4 variants, add BCM2711
  See: raspberrypi/userland#695

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: hdmi-2711: Wait for HDMI hardware scheduler to activate in HDMI mode

- arm_loader: Add message to release firmware framebuffer

- firmware: arm_loader: Add rng-seed DT property
  See: #1595

- firmware: isp: Set the YUV420/YVU420 format stride to 64 byte

- firmware: Revert: video_decode: Use the ISP instead of vc_image_convert

- firmware: cec: Avoid sending messages with kms
  See: raspberrypi/linux#4460

- firmware: hdmi_cec: Remove TX/RX SW_INIT on power_on
  See: Hexxeh/rpi-firmware#267
  See: https://www.raspberrypi.org/forums/viewtopic.php?p=1895082#p1895082

- firmware: arm_dt: Limit CMA to 256MB if total_mem < 2GB or gpu_mem > 256MB
  See: #1603

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: video_decode: Correct support for YVU formats using ISP

- firmware: firmware: Disable VLL loading from file system
  See: #1605

- firmware: arm_loader: Make most arm clock requests required
  See: #1598

- firmware: arm_loader: Consider required flags from GET_CLOCK_RATE
  See: #1598

- firmware: arm_dt: Load overlays for detected cameras

- firmware: Make more use of the user-warnings DT property

- firmware: hdmi_2711: Use HDMI block REPEAT_PIXEL instead of PV
  See: https://forum.libreelec.tv/thread/24415-le-10-beta-for-i4-force-hdmi-resolution

- firmware: DSI display autodetection for kms

- firmware: arm_loader: Allow hvs interrupt during SET_NOTIFY_DISPLAY_DONE

- firmware: arm_display: Allow null buffer in successful call
  See: raspberrypi/linux#4540

- firmware: video_decode: Ensure all buffers are flushed before port disable completes

- firmware: filesystem: sdcard: Fix Hybrid GPT partitions
  See: #1465

- firmware: tvservice: Add check to warn when running with kms

- firmware: arm_loader: Allow non-optional reads of current clock
  See: #1619

- firmware: dispmanx: Demote null eptr from vcos_verify to no warning
  See: raspberrypi/linux#4592

- firmware: filesystem: sdcard: Probe FAT type in GPT ESD partitions

- firmware: clock-2711: Limit PLLB VCO frequency to the high range

- firmware: arm_dt: Export the boot-mode, partition and usb state via device-tree
  See: #1621

- firmware: video_decode: i/p port enable/disable without o/p active could stall
  See: RPi-Distro/vlc#48
  See: Hexxeh/rpi-firmware#272
  See: #1637

- firmware: userland: Reduce debug_sym error messages
  See: https://forums.raspberrypi.com/viewtopic.php?f=98&t=322238

- firmware: arm_dt: Increase maximum line length to 98
  See: raspberrypi/linux#4638

- firmware: arm_loader: Allow VEC clock to be controlled by arm

- firmware: platform: Remove licence on VP6, VP8, Theora, and FLAC
  See: raspberrypi/linux#4661

- firmware: ISP: Fix magenta colour in right hand image of stereo pair
  See: https://forums.raspberrypi.com/viewtopic.php?t=321089

- firmware: platform: Fix incorrect turbo voltage scaling on Pi0
  See: raspberrypi/documentation#2255

- firmware: platform: Declare CM4's SIO_1V8_SEL and SD_PWR_ON
  See: raspberrypi/Raspberry-Pi-OS-64bit#188

- firmware: hello_fft: Update outdated link to V3D spec

- firmware: hello_fft: Remove unused function declaration
  See: #1645
  See: raspberrypi/userland#710

- firmware: dtoverlay: Rebase aliases in overlays like labels

- firmware: isp: Set core/vpu min clock to 320Mhz during ISP operation

- firmware: arm_loader: Enable watchdog early if wanted
  See: #1651

- firmware: board_info: Add upstream dtb names for cm1 & 3

- firmware: board_info: Add upstream dtb name for cm4
  See: #1660

- firmware: platform: Allow users to disable camera boot HMAC check
  See: #1657

- firmware: clock: 2711: Fix potential API issue in 2711 VCO setup

- firmware: arm_loader: Enable USB MSD boot mode on Zero 2 W

- firmware: isp: Fix Rec.709 colour space problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants