Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp (C++)

Code before:
      hdr10.GreenPrimary[0] = 13250;
      hdr10.GreenPrimary[1] = 34500;
      hdr10.BluePrimary[0] = 7500;
      hdr10.BluePrimary[1] = 3000;
      hdr10.WhitePoint[0] = 15635;
      hdr10.WhitePoint[1] = 16450;
      hdr10.MaxMasteringLuminance = 1000 * 10000; // 1000 nits
      hdr10.MinMasteringLuminance = 50; // 0.005 nits
      DX::Windowing()->SetHdrMetaData(hdr10);
      CLog::LogF(LOGINFO, "Switching to HDR rendering");
      DX::Windowing()->SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020);
      m_HdrType = HDR_TYPE::HDR_HLG;
      m_lastHdr10 = hdr10;
    }
  }
  // SDR
  else
  {
    if (m_HdrType != HDR_TYPE::HDR_NONE_SDR)
    {
      // Switch to SDR rendering
      CLog::LogF(LOGINFO, "Switching to SDR rendering");
      // color space already sdr or set by the swap chain re-creation
      if (m_AutoSwitchHDR)
      {
        if (DX::Windowing()->IsHDROutput())
          DX::Windowing()->ToggleHDR(); // Toggle display HDR OFF
      }
      else
      {
        DX::Windowing()->SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709);
      }
      m_HdrType = HDR_TYPE::HDR_NONE_SDR;
      m_lastHdr10 = {};
    }
  }
}

DEBUG_INFO_VIDEO CRendererBase::GetDebugInfo(int idx)
{
  CRenderBuffer* rb = m_renderBuffers[idx];

  const char* px = av_get_pix_fmt_name(rb->pixelFormat);
  const char* pr = av_color_primaries_name(rb->primaries);
  const char* opr = av_color_primaries_name(rb->m_originalPrimaries);
  const char* tr = av_color_transfer_name(rb->color_transfer);

  const std::string pixel = px ? px : "unknown";
  const std::string oprim = opr ? opr : "unknown";
  const std::string trans = tr ? tr : "unknown";
  const std::string prim =

Review comment (suggestion):
ok for the text I was suggesting moving it where more appropriate
```suggestion
      if (m_AutoSwitchHDR)
      {
        // color space already sdr or set by the swap chain re-creation
        if (DX::Windowing()->IsHDROutput())
```

Code after:
      hdr10.GreenPrimary[0] = 13250;
      hdr10.GreenPrimary[1] = 34500;
      hdr10.BluePrimary[0] = 7500;
      hdr10.BluePrimary[1] = 3000;
      hdr10.WhitePoint[0] = 15635;
      hdr10.WhitePoint[1] = 16450;
      hdr10.MaxMasteringLuminance = 1000 * 10000; // 1000 nits
      hdr10.MinMasteringLuminance = 50; // 0.005 nits
      DX::Windowing()->SetHdrMetaData(hdr10);
      CLog::LogF(LOGINFO, "Switching to HDR rendering");
      DX::Windowing()->SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020);
      m_HdrType = HDR_TYPE::HDR_HLG;
      m_lastHdr10 = hdr10;
    }
  }
  // SDR
  else
  {
    if (m_HdrType != HDR_TYPE::HDR_NONE_SDR)
    {
      // Switch to SDR rendering
      CLog::LogF(LOGINFO, "Switching to SDR rendering");
      if (m_AutoSwitchHDR)
      {
        // color space already sdr or set by the swap chain re-creation
        if (DX::Windowing()->IsHDROutput())
          DX::Windowing()->ToggleHDR(); // Toggle display HDR OFF
      }
      else
      {
        DX::Windowing()->SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709);
      }
      m_HdrType = HDR_TYPE::HDR_NONE_SDR;
      m_lastHdr10 = {};
    }
  }
}

DEBUG_INFO_VIDEO CRendererBase::GetDebugInfo(int idx)
{
  CRenderBuffer* rb = m_renderBuffers[idx];

  const char* px = av_get_pix_fmt_name(rb->pixelFormat);
  const char* pr = av_color_primaries_name(rb->primaries);
  const char* opr = av_color_primaries_name(rb->m_originalPrimaries);
  const char* tr = av_color_transfer_name(rb->color_transfer);

  const std::string pixel = px ? px : "unknown";
  const std::string oprim = opr ? opr : "unknown";
  const std::string trans = tr ? tr : "unknown";
  const std::string prim =