Skip to main content
QCS6490Stable

LEF/SEF

Dual Exposure

DOL

Row Interleaved

v3

Dual VC

v2

Single VC
Platform Scope:
This section is only applicable for QCS6490.

01 · What Is It?

Staggered High Dynamic Range (SHDR) mode is a sensor feature that outputs frames with different exposure times - Long exposure frame (LEF) and short exposure frame (SEF).
  • The sensor outputs a pair of two lines as one unit. The frame of LEF and the frame of SEF are output alternately in the pair of these two lines.
  • The rolling shutter readout is staggered (row interleaved) so that the short integration starts immediately (within the same frame) after sampling of the long integration. This is also called Digital Overlap (DOL) mode.
  • The SHDR sensors are capable of outputting LEF and SEF frames with a single virtual channel (the single frame contains both LEF and SEF in an interleaved manner) or different virtual channels (LEF and SEF frames are output separately on different virtual channels).
  • On Qualcomm chipsets, there are two solutions (SHDR v3 and SHDR v2). SHDR v3 works for dual virtual channels. SHDR v2 works for single virtual channel.
Connect to the device console using SSH. See How To SSH? for instructions.
Collect the logs by running: journalctl -f > /opt/log.txt

02 · SHDR v3 - Dual virtual channel with two-frame exposure

The SHDR v3 solution uses sensors that can send the exposure frames (LEF, SEF) on different CSI virtual channels. Long and short exposure frames are transmitted on different virtual channels. Use the following GStreamer command to enable SHDR v3:
GStreamer (SHDRv3)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 vhdr=2 ! \
video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/cam_4k.mp4
The video file is saved at /opt/cam_4k.mp4. To verify the SHDR v3 use case is selected, check for the following log:
Log Verification
cam-server: CamX: [CORE_CFG]891 23288 [CORE  ] camxpipeline.h:3024 SetPipelineStatus() RealTimeYUVSHDR_0 status is now PipelineStatus::STREAM_ON

03 · SHDR v2 - Single virtual channel with two-frame exposure

The SHDR v2 solution requires the sensor to output both LEF and SEF on a single virtual channel in an interleaved manner (also referred to as DOL mode). The rolling shutter readout is staggered (row interleaved) so that the short integration starts immediately (within the same frame) after sampling of the long integration. Use the following GStreamer command to enable SHDR v2:
GStreamer (SHDRv2)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 vhdr=1 ! \
video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/cam_4k.mp4
The video file is saved at /opt/cam_4k.mp4. To verify the SHDR v2 use case is selected, check for the following log:
Log Verification
cam-server: CamX: [CORE_CFG]852 2070 [CORE] camxpipeline.h:3015 SetPipelineStatus()
RealTimeSHDR_0 status is now PipelineStatus::STREAM_ON

04 · Defog feature

Defog is a fog detection and removal technique. This feature allows users to remove the foggy effect in poor weather conditions, such as rain, smog, haze, or fog. It provides a defogged image by improving the image quality in SHDR v2 and SHDR v3 use cases. The defog library performs defog operations with the statistics and interpolation data collected from IFE, BPS, and IPE and generates new tables for the IQ modules to apply in the next frame.

Validation

1

Configure override settings

Use the following override settings in /var/cache/camera/camxoverridesettings.txt to verify the defog feature is working:
Camx Override Settings
logInfoMask=0x50000
logVerboseMask=0x50000
2

Test the defog feature

Run the following command to test defog with a SHDR v2 use case:
GStreamer (Defog with SHDRv2)
gst-pipeline-app -e qtiqmmfsrc name=camsrc vhdr=1  ! \
video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=4 \
output-io-mode=5  extra-controls="controls,video_bitrate=6000000,video_bitrate_mode=0;" ! queue ! \
h264parse ! mp4mux ! queue ! filesink location=/opt/cam_4k.mp4
Run the following command to test defog with a SHDR v3 use case:
GStreamer (Defog with SHDRv3)
gst-pipeline-app -e qtiqmmfsrc name=camsrc vhdr=2 ! \
video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=4 \
output-io-mode=5 extra-controls="controls,video_bitrate=6000000,video_bitrate_mode=0;" ! queue ! \
h264parse ! mp4mux ! queue ! filesink location=/opt/cam_4k.mp4
3

Enable defog manually

  1. Select (1) READY.
  2. Select (3) PLAYING.
  3. Press Enter.
  4. Select (p) Plugin Mode.
  5. Select (8) camsrc.
  6. Select (24) defog-table.
  7. Enter the following string to enable defog:
    org.quic.camera.defog, enable=true, strength=3, ates_strength=1;
    
  8. Close the camera by selecting (b) BACK and then (q) QUIT. The video file is saved at /opt/cam_4k.mp4.
4

Verify log output

Check for the following logs to verify the defog feature is enabled:SHDR v2:
Log Verification
CamX: [ INFO]2149 2256 [CORE   ] camxpipeline.cpp:5331 FillSHDRSensorModeInfo() isSHDREnabled=1 isSHDRRAWMode=1 isSHDRVCMode=0 isSHDRUseFusedStats=1 numVCSupported=0 isDefogEnablewithSHDR=1
CamX: [ VERB]2149 2182 [CHI    ] camxchinodedefog.cpp:1988 SetDeFog2ConfigParams() Previous (  defog_en = 1  defog_strength = 3 ates_strength = 1
CamX: [ VERB]2149 2182 [CHI    ] camxchinodedefog.cpp:1991 SetDeFog2ConfigParams() Current (  defog_en = 1  defog_strength = 3 ates_strength = 1
SHDR v3:
Log Verification
CamX: [ INFO]2149 2256 [CORE   ] camxpipeline.cpp:5285 FillSHDRSensorModeInfo() isSHDREnabled:1 isSHDRRAWMode:0 isSHDRVCMode:1 isSHDRUseFusedStats:0 numVCSupported:2 isDefogEnablewithSHDR:1
CamX: [ VERB]2149 2182 [CHI    ] camxchinodedefog.cpp:1988 SetDeFog2ConfigParams() Previous (  defog_en = 1  defog_strength = 3 ates_strength = 1
CamX: [ VERB]2149 2182 [CHI    ] camxchinodedefog.cpp:1991 SetDeFog2ConfigParams() Current (  defog_en = 1  defog_strength = 3 ates_strength = 1