# Auto linear vs. SHDR mode switch

Source: [https://docs.qualcomm.com/doc/80-70015-17/topic/auto_linear_vs_shdr_mode_switch_public.html](https://docs.qualcomm.com/doc/80-70015-17/topic/auto_linear_vs_shdr_mode_switch_public.html)

This feature enables on-the-fly switching between Linear and SHDR v2 mode pipelines
        without stopping and starting the camera session.

This feature is helpful to prevent interrupting a video session when there is a SHDR vs.
            Linear mode switch needed based on Lux value. It also helps reduce the pipeline switch
            latency as the pipelines (Linear and SHDR) are pre-initialized during session creation
            time. During mode switch, it will release the hardware resources of the pipeline
            (sensor, IFE, IPE) and then acquire and reconfigure them for the new pipeline.

Note: This feature works only for SHDR v2 and Linear mode
                pipelines. It will be enabled for SHDR v3 and Linear mode in a future
                release.

Note: Connect to the device console using SSH. See [How To SSH?](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh) for instructions. Ensure that you
            enable SSH in Permissive mode.

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

    # journalctl -f > /opt/log.txtCopy to clipboard

Use `vhdr=3` in a GST command to enable this feature. To enable the
            feature and toggle between Linear and SHDR modes:
1. Run the `gst-camera-metadata-example` application, which can
                    support setting the vendor tag to switch the use case during run time. For
                    example:

        gst-camera-metadata-example -p "qtiqmmfsrc name=camsrc camera=0 vhdr=3 ! \
        video/x-raw(memory:GBM),format=NV12,width=3840,height=2160,framerate=30/1,compression=ubwc,\
        interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=5 \
        output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/mux4k.mp4"
        Copy to clipboard
2. In the application, select (1) READY.
3. Select (3) PLAYING. The camera will start in linear
                    mode.
4. Select (4) META. The following menu will be
                    shown:

        ------------------------- MENU -------------------------
           (1) video-metadata
           (2) image-metadata
           (3) static-metadata
           (4) session-metadata
        --------------------------------------------------------
        Copy to clipboard
5. Select (1) video-metadata. The following menu will be
                    shown:

        ------------------------- 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
        ------------------------------------------------------------------
        Copy to clipboard
6. Select (5) Set a tag.
7. A prompt appears to enter the section name and tag name separated by spaces
                    without quotes. Enter `org.quic.camera.videoHDRmode
                    modeType`.
8. A prompt appears to set the value. Enter 1 to switch to SHDR mode.

To toggle between Linear and SHDR modes, repeat this process and enter 1 (SHDR mode) and
            0 (Linear mode) as needed.

To close the camera, select (q) QUIT or press CTRL +
                C.

Verify this feature using the following logs:
- Linear
                    mode

        cam-server[1693]: CamX: [REQMAP]1693 2652 [CORE   ] camxsession.cpp:4811 ProcessRequest() chiFrameNum: 0  <==>  requestId: 1  <==>  sequenceId: 0  <==> CSLSyncId: 1 -- RealTimeFeatureZSLPreviewRawYUV_0Copy to clipboard

- SHDR
                    mode:

        cam-server[1693]: CamX: [REQMAP]1693 2652 [CORE   ] camxsession.cpp:4811 ProcessRequest() chiFrameNum: 296  <==>  requestId: 297  <==>  sequenceId: 296  <==> CSLSyncId: 297 -- RealTimeSHDR_0Copy to clipboard

**Parent Topic:** [Advanced Camera Features](https://docs.qualcomm.com/doc/80-70015-17/topic/advanced_camera_features.html)

Last Published: Oct 17, 2024

[Previous Topic
Multiple ROI streams from single camera input stream](https://docs.qualcomm.com/bundle/publicresource/80-70015-17/topics/multiple_roi_streams_from_single_camera_input_stream_public.md) [Next Topic
Troubleshooting](https://docs.qualcomm.com/bundle/publicresource/80-70015-17/topics/troubleshooting.md)