# Enable high dynamic range

Note

This section is only applicable for QCS6490.

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.

Note

Connect to the device console using SSH. See [How To SSH?](https://docs.qualcomm.com/bundle/publicresource/topics/80-80022-254/how_to.html#use-ssh) for instructions.

To collect the log, run the following command on the device:

# journalctl -f > /opt/log.txt
    Copy to clipboard

## Prerequisites

Before running any SHDR use cases (for example, SHDRv2, SHDRv3, and defog), you must configure the `cam-server systemd` service to use the Adreno OpenCL ICD library:

sed -i '/^\[Install\]/i Environment="OCL_ICD_FILENAMES=/usr/lib/libOpenCL_adreno.so.1"' \
      /usr/lib/systemd/system/cam-server.service && \
      systemctl daemon-reload && \
      systemctl restart cam-server
    Copy to clipboard

### 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:

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
    Copy to clipboard

The video file is saved at `/opt/cam_4k.mp4`.

To verify the SHDR v3 use case is selected, check for the following log:

cam-server: CamX: [CORE_CFG]891 23288 [CORE  ] camxpipeline.h:3024 SetPipelineStatus() RealTimeYUVSHDR_0 status is now PipelineStatus::STREAM_ON
    Copy to clipboard

### 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:

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
    Copy to clipboard

The video file is saved at `/opt/cam_4k.mp4`.

To verify the SHDR v2 use case is selected, check for the following log:

cam-server: CamX: [CORE_CFG]852 2070 [CORE] camxpipeline.h:3015 SetPipelineStatus()
    RealTimeSHDR_0 status is now PipelineStatus::STREAM_ON
    Copy to clipboard

### 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.

To validate the defog feature:

1. Use the following override settings in `/var/cache/camera/camxoverridesettings.txt` to verify the defog feature is working:

logInfoMask=0x50000
        logVerboseMask=0x50000
        Copy to clipboard
2. Test the defog feature.

> 
> 
> - Run the following command to test defog with a SHDR v2 use case:
> 
> 
> 
> 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
>     Copy to clipboard
> 
> - Run the following command to test defog with a SHDR v3 use case:
> 
> 
> 
> 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
>     Copy to clipboard

3. Enable defog.

    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;
            Copy to clipboard
    8. Close the camera by selecting **(b) BACK** and then **(q) QUIT**. The video file is saved at/opt/cam\_4k.mp4.
4. Check for the following logs to verify the defog feature is enabled:

    - SHDR v2:

> 
> 
> 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
>             Copy to clipboard
    - SHDR v3:

> 
> 
> 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
>             Copy to clipboard

Last Published: May 26, 2026

[Previous Topic
Support software TNR/MCTF](https://docs.qualcomm.com/bundle/publicresource/80-80022-17/topics/support-software-tnr-mctf.md) [Next Topic
Enable EIS and LDC](https://docs.qualcomm.com/bundle/publicresource/80-80022-17/topics/enable-eis-and-ldc.md)
<meta name="mathjax-injected">