> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Switch linear vs. SHDR mode automatically

> Enable seamless runtime switching between Linear and SHDR v2 pipelines on QCS6490 platforms.

<div style={{display:'flex',gap:'8px',flexWrap:'wrap',marginBottom:'16px'}}>
  <span style={{background:'#ede9fe',color:'#5b21b6',padding:'2px 10px',borderRadius:'999px',fontSize:'12px',fontWeight:600}}>QCS6490</span>
  <span style={{background:'#f0fdf4',color:'#166534',padding:'2px 10px',borderRadius:'999px',fontSize:'12px',fontWeight:600}}>Stable</span>
</div>

<CardGroup cols={3}>
  <Card title="vhdr=3" icon="toggle-on">Activation Flag</Card>
  <Card title="Linear ↔ SHDR" icon="shuffle">Seamless Switch</Card>
  <Card title="Pre-initialized" icon="bolt">Low Latency</Card>
</CardGroup>

<Note>
  **Platform Scope:**<br />
  This feature is applicable for **QCS6490** only.
</Note>

***

## 01 · What Is It?

This feature enables **on-the-fly switching** between Linear and SHDR v2 mode pipelines without terminating the active camera session.

Key architectural benefits include:

* **Session Continuity:** Prevents video session interruption during light-level (lux) fluctuations.
* **Latency Optimization:** Pipelines are pre-initialized during session creation to minimize switch overhead.
* **Resource Management:** Automatically releases and re-acquires hardware blocks (Sensor, IFE, IPE) during the reconfiguration phase.

<Note>
  This feature works only for **SHDR v2** and **Linear** mode pipelines.
</Note>

***

## 02 · Verification Setup

<Note>
  Connect to the device console using SSH. See [How To SSH?](https://dragonwingdocs.qualcomm.com/Linux/devices/iq9075-evk/set-up-the-device#connect-over-ssh) for instructions.
</Note>

<Steps>
  <Step title="Initialize Log Collection">
    Run the following command on the device to monitor runtime events:

    ```bash Log Collection theme={null}
    # journalctl -f > /opt/log.txt
    ```
  </Step>
</Steps>

***

## 03 · Feature Validation

Use `vhdr=3` in a GST command to enable this feature. To enable the feature and toggle between Linear and SHDR modes:

<Steps>
  <Step title="Execute Metadata Application">
    Run the `gst-camera-metadata-example` application to support runtime vendor tag configuration.

    ```bash GStreamer (Auto Mode Switch) theme={null}
    gst-camera-metadata-example -p "qtiqmmfsrc name=camsrc camera=0 vhdr=3 ! \
    video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1,\
    interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 \
    output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/mux4k.mp4"
    ```
  </Step>

  <Step title="Transition to READY">
    In the application, select **(1) READY**.
  </Step>

  <Step title="Initialize PLAYING State">
    Select **(3) PLAYING**. The camera starts in linear mode.
  </Step>

  <Step title="Open Metadata Menu">
    Select **(4) META**. The following menu is shown:

    ```text Metadata Root Menu theme={null}
     ---------MENU---------
    (1)        video-metadata
    (2)        image-metadata
    (3)        static-metadata
    (4)        session-metadata
    ```
  </Step>

  <Step title="Select Video Category">
    Select **(1) video-metadata**. The following menu is shown:

    ```text Video Metadata Menu theme={null}
     ---------video-metadata---------
    (1)        List all available tags
    (2)        Dump all tags values in a file
    (3)        Dump custom tags values in a file
    (4)        Get a tag
    (5)        Set a tag
    ```
  </Step>

  <Step title="Invoke Tag Modification">
    Select **(5) Set a tag**.
  </Step>

  <Step title="Define Vendor Tag">
    A prompt appears to enter the section name and tag name separated by spaces without quotes. Enter:
    `org.quic.camera.videoHDRmode modeType`
  </Step>

  <Step title="Trigger Mode Switch">
    A prompt appears to set the value. Enter **1** to switch to SHDR mode.

    <Tip>
      To toggle between Linear and SHDR modes, repeat this process and enter **1** (SHDR mode) and **0** (Linear mode) as needed.
    </Tip>
  </Step>
</Steps>

<Warning>
  To close the camera, select **(q) QUIT** or press **CTRL + C**.
</Warning>

***

## 04 · Log Verification

Verify the pipeline reconfiguration by checking the following log signatures:

### Linear Mode Selection

```text CamX Status (Linear) theme={null}
cam-server[1693]: CamX: [REQMAP]1693 2652 [CORE   ] camxsession.cpp:4811
ProcessRequest() chiFrameNum: 0 <==> requestId: 1 <==> sequenceId: 0
<==> CSLSyncId: 1 -- RealTimeFeatureZSLPreviewRawYUV_0
```

### SHDR Mode Selection

```text CamX Status (SHDR) theme={null}
cam-server[1693]: CamX: [REQMAP]1693 2652 [CORE   ] camxsession.cpp:4811
ProcessRequest() chiFrameNum: 296 <==> requestId: 297 <==> sequenceId:
296 <==> CSLSyncId: 297 -- RealTimeSHDR_0
```
