Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions docs/source/about/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1523,12 +1523,12 @@ keybindings
=========== ===========

**Default**
``vbr_latency``
``cbr``

**Example**
.. code-block:: text

amd_rc = vbr_latency
amd_rc = cbr

`amd_usage <https://localhost:47990/config/#amd_usage>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -1543,14 +1543,15 @@ keybindings
.. table::
:widths: auto

=============== ===========
Value Description
=============== ===========
transcoding transcoding (slowest)
webcam webcam (slow)
lowlatency low latency (fast)
ultralowlatency ultra low latency (fastest)
=============== ===========
======================= ===========
Value Description
======================= ===========
transcoding transcoding (slowest)
webcam webcam (slow)
lowlatency_high_quality low latency, high quality (fast)
lowlatency low latency (faster)
ultralowlatency ultra low latency (fastest)
======================= ===========

**Default**
``ultralowlatency``
Expand Down Expand Up @@ -1592,6 +1593,22 @@ keybindings

amd_vbaq = enabled

`amd_enforce_hrd <https://localhost:47990/config/#amd_enforce_hrd>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
Enable Hypothetical Reference Decoder (HRD) enforcement to help constrain the target bitrate.

.. note:: This option only applies when using amdvce `encoder`_.

**Default**
``enabled``

**Example**
.. code-block:: text

amd_enforce_hrd = enabled

`amd_coder <https://localhost:47990/config/#amd_coder>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
33 changes: 21 additions & 12 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ namespace config {
#define AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY 1
#define AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY 2
#define AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM 3
#define AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING 0
#define AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY 5
#define AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING 0
#define AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY 1
#define AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY 2
#define AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM 3
#define AMF_VIDEO_ENCODER_USAGE_TRANSCONDING 0
#define AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY 5
#define AMF_VIDEO_ENCODER_USAGE_TRANSCODING 0
#define AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY 1
#define AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY 2
#define AMF_VIDEO_ENCODER_USAGE_WEBCAM 3
#define AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY 5
#define AMF_VIDEO_ENCODER_UNDEFINED 0
#define AMF_VIDEO_ENCODER_CABAC 1
#define AMF_VIDEO_ENCODER_CALV 2
Expand Down Expand Up @@ -144,20 +147,23 @@ namespace config {
enum class usage_av1_e : int {
transcoding = AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING,
webcam = AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM,
lowlatency_high_quality = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY,
lowlatency = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY,
ultralowlatency = AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY
};

enum class usage_hevc_e : int {
transcoding = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING,
transcoding = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING,
webcam = AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM,
lowlatency_high_quality = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY,
lowlatency = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY,
ultralowlatency = AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY
};

enum class usage_h264_e : int {
transcoding = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING,
transcoding = AMF_VIDEO_ENCODER_USAGE_TRANSCODING,
webcam = AMF_VIDEO_ENCODER_USAGE_WEBCAM,
lowlatency_high_quality = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY,
lowlatency = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY,
ultralowlatency = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY
};
Expand Down Expand Up @@ -195,12 +201,13 @@ namespace config {

template <class T>
std::optional<int>
usage_from_view(const std::string_view &rc) {
usage_from_view(const std::string_view &usage) {
#define _CONVERT_(x) \
if (rc == #x##sv) return (int) T::x
if (usage == #x##sv) return (int) T::x
_CONVERT_(transcoding);
_CONVERT_(webcam);
_CONVERT_(lowlatency);
_CONVERT_(lowlatency_high_quality);
_CONVERT_(ultralowlatency);
#undef _CONVERT_
return std::nullopt;
Expand Down Expand Up @@ -346,14 +353,15 @@ namespace config {
(int) amd::quality_h264_e::balanced, // quality (h264)
(int) amd::quality_hevc_e::balanced, // quality (hevc)
(int) amd::quality_av1_e::balanced, // quality (av1)
(int) amd::rc_h264_e::vbr_latency, // rate control (h264)
(int) amd::rc_hevc_e::vbr_latency, // rate control (hevc)
(int) amd::rc_av1_e::vbr_latency, // rate control (av1)
(int) amd::rc_h264_e::cbr, // rate control (h264)
(int) amd::rc_hevc_e::cbr, // rate control (hevc)
(int) amd::rc_av1_e::cbr, // rate control (av1)
(int) amd::usage_h264_e::ultralowlatency, // usage (h264)
(int) amd::usage_hevc_e::ultralowlatency, // usage (hevc)
(int) amd::usage_av1_e::ultralowlatency, // usage (av1)
0, // preanalysis
1, // vbaq
1, // enforce_hrd
(int) amd::coder_e::_auto, // coder
}, // amd

Expand Down Expand Up @@ -991,13 +999,14 @@ namespace config {
std::string usage;
string_f(vars, "amd_usage", usage);
if (!usage.empty()) {
video.amd.amd_usage_h264 = amd::usage_from_view<amd::usage_h264_e>(rc);
video.amd.amd_usage_hevc = amd::usage_from_view<amd::usage_hevc_e>(rc);
video.amd.amd_usage_av1 = amd::usage_from_view<amd::usage_av1_e>(rc);
video.amd.amd_usage_h264 = amd::usage_from_view<amd::usage_h264_e>(usage);
video.amd.amd_usage_hevc = amd::usage_from_view<amd::usage_hevc_e>(usage);
video.amd.amd_usage_av1 = amd::usage_from_view<amd::usage_av1_e>(usage);
}

bool_f(vars, "amd_preanalysis", (bool &) video.amd.amd_preanalysis);
bool_f(vars, "amd_vbaq", (bool &) video.amd.amd_vbaq);
bool_f(vars, "amd_enforce_hrd", (bool &) video.amd.amd_enforce_hrd);

int_f(vars, "vt_coder", video.vt.vt_coder, vt::coder_from_view);
int_f(vars, "vt_software", video.vt.vt_allow_sw, vt::allow_software_from_view);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace config {
std::optional<int> amd_usage_av1;
std::optional<int> amd_preanalysis;
std::optional<int> amd_vbaq;
std::optional<int> amd_enforce_hrd;
int amd_coder;
} amd;

Expand Down
3 changes: 3 additions & 0 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ namespace video {
{ "quality"s, &config::video.amd.amd_quality_av1 },
{ "rc"s, &config::video.amd.amd_rc_av1 },
{ "usage"s, &config::video.amd.amd_usage_av1 },
{ "enforce_hrd"s, &config::video.amd.amd_enforce_hrd },
},
{}, // SDR-specific options
{}, // HDR-specific options
Expand All @@ -693,6 +694,7 @@ namespace video {
{ "rc"s, &config::video.amd.amd_rc_hevc },
{ "usage"s, &config::video.amd.amd_usage_hevc },
{ "vbaq"s, &config::video.amd.amd_vbaq },
{ "enforce_hrd"s, &config::video.amd.amd_enforce_hrd },
},
{}, // SDR-specific options
{}, // HDR-specific options
Expand All @@ -712,6 +714,7 @@ namespace video {
{ "rc"s, &config::video.amd.amd_rc_h264 },
{ "usage"s, &config::video.amd.amd_usage_h264 },
{ "vbaq"s, &config::video.amd.amd_vbaq },
{ "enforce_hrd"s, &config::video.amd.amd_enforce_hrd },
},
// SDR-specific options
{},
Expand Down
15 changes: 13 additions & 2 deletions src_assets/common/assets/web/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,10 @@ <h2 class="accordion-header">
<div class="mb-3">
<label for="amd_rc" class="form-label">{{ $t('config.amd_rc') }}</label>
<select id="amd_rc" class="form-select" v-model="config.amd_rc">
<option value="cbr">{{ $t('config.amd_rc_cbr') }}</option>
<option value="cqp">{{ $t('config.amd_rc_cqp') }}</option>
<option value="vbr_latency">{{ $t('config.amd_rc_vbr_latency') }}</option>
<option value="vbr_peak">{{ $t('config.amd_rc_vbr_peak') }}</option>
<option value="cbr">{{ $t('config.amd_rc_cbr') }}</option>
</select>
</div>

Expand All @@ -902,6 +902,7 @@ <h2 class="accordion-header">
<option value="transcoding">{{ $t('config.amd_usage_transcoding') }}</option>
<option value="webcam">{{ $t('config.amd_usage_webcam') }}</option>
<option value="lowlatency">{{ $t('config.amd_usage_lowlatency') }}</option>
<option value="lowlatency_high_quality">{{ $t('config.amd_usage_lowlatency_high_quality') }}</option>
<option value="ultralowlatency">{{ $t('config.amd_usage_ultralowlatency') }}</option>
</select>
</div>
Expand All @@ -924,6 +925,15 @@ <h2 class="accordion-header">
</select>
</div>

<!-- AMF HRD Enforcement -->
<div class="mb-3">
<label for="amd_enforce_hrd" class="form-label">{{ $t('config.amd_enforce_hrd') }}</label>
<select id="amd_enforce_hrd" class="form-select" v-model="config.amd_enforce_hrd">
<option value="disabled">{{ $t('_common.disabled') }}</option>
<option value="enabled">{{ $t('_common.enabled_def') }}</option>
</select>
</div>

<!-- AMF Coder (H264) -->
<div class="mb-3">
<label for="amd_coder" class="form-label">{{ $t('config.amd_coder') }}</label>
Expand Down Expand Up @@ -1146,10 +1156,11 @@ <h2 class="accordion-header">
name: "AMD AMF Encoder",
options: {
"amd_quality": "balanced",
"amd_rc": "vbr_latency",
"amd_rc": "cbr",
"amd_usage": "ultralowlatency",
"amd_preanalysis": "disabled",
"amd_vbaq": "enabled",
"amd_enforce_hrd": "enabled",
"amd_coder": "auto",
},
},
Expand Down
8 changes: 5 additions & 3 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,20 @@
"always_send_scancodes": "Always Send Scancodes",
"always_send_scancodes_desc": "Sending scancodes enhances compatibility with games and apps but may result in incorrect keyboard input from certain clients that aren't using a US English keyboard layout. Enable if keyboard input is not working at all in certain applications. Disable if keys on the client are generating the wrong input on the host.",
"amd_coder": "AMF Coder (H264)",
"amd_enforce_hrd": "AMF Hypothetical Reference Decoder (HRD) Enforcement",
"amd_preanalysis": "AMF Preanalysis",
"amd_quality": "AMF Quality",
"amd_quality_balanced": "balanced -- balanced (default)",
"amd_quality_quality": "quality -- prefer quality",
"amd_quality_speed": "speed -- prefer speed",
"amd_rc": "AMF Rate Control",
"amd_rc_cbr": "cbr -- constant bitrate",
"amd_rc_cbr": "cbr -- constant bitrate (default)",
"amd_rc_cqp": "cqp -- constant qp mode",
"amd_rc_vbr_latency": "vbr_latency -- latency constrained variable bitrate (default)",
"amd_rc_vbr_latency": "vbr_latency -- latency constrained variable bitrate",
"amd_rc_vbr_peak": "vbr_peak -- peak constrained variable bitrate",
"amd_usage": "AMF Usage",
"amd_usage_lowlatency": "lowlatency - low latency (fast)",
"amd_usage_lowlatency": "lowlatency - low latency (fastest)",
"amd_usage_lowlatency_high_quality": "lowlatency_high_quality - low latency, high quality (fast)",
"amd_usage_transcoding": "transcoding -- transcoding (slowest)",
"amd_usage_ultralowlatency": "ultralowlatency - ultra low latency (fastest)",
"amd_usage_webcam": "webcam -- webcam (slow)",
Expand Down