Skip to content

Commit

Permalink
--log-levelにquietに追加。 ( #527 )
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Oct 18, 2023
1 parent e9f4236 commit fd35387
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 29 deletions.
6 changes: 6 additions & 0 deletions NVEnc/NVEnc_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ NVIDIA グラフィックドライバ 536.23
今後の更新で設定ファイルの互換性がなくなるかもしれません。

【メモ】
2023.10.18 (7.34)
[NVEncC]
- 音声フィルターの切り替えがエンコード中に発生する時に--thread-audio > 1で異常終了する問題を修正。
- --log-levelにquietを追加。
- 新しいAVChannelLayout APIに対応(Windows版)。

2023.10.06 (7.33)
[NVEncC]
- NVEnc 7.32で10bit深度のy4m読みが異常終了する問題を修正。
Expand Down
32 changes: 19 additions & 13 deletions NVEncCore/rgy_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3344,6 +3344,11 @@ int parse_log_level_param(const TCHAR *option_name, const TCHAR *arg_value, RGYP
for (const auto& param : RGY_LOG_TYPE_STR) {
paramList.push_back(tchar_to_string(param.second));
}
std::vector<CX_DESC> logLevelList;
for (const auto& param : RGY_LOG_LEVEL_STR) {
logLevelList.push_back({ param.second, param.first });
}
logLevelList.push_back({ nullptr, 0 });

for (const auto &param : split(arg_value, _T(","))) {
auto pos = param.find_first_of(_T("="));
Expand All @@ -3352,7 +3357,7 @@ int parse_log_level_param(const TCHAR *option_name, const TCHAR *arg_value, RGYP
auto param_val = param.substr(pos + 1);
param_arg = tolowercase(param_arg);
int value = 0;
if (get_list_value(list_log_level, param_val.c_str(), &value)) {
if (get_list_value(logLevelList.data(), param_val.c_str(), &value)) {
auto type_ret = std::find_if(RGY_LOG_TYPE_STR.begin(), RGY_LOG_TYPE_STR.end(), [param_arg](decltype(RGY_LOG_TYPE_STR[0])& type) {
return param_arg == type.second;
});
Expand All @@ -3364,16 +3369,16 @@ int parse_log_level_param(const TCHAR *option_name, const TCHAR *arg_value, RGYP
return 1;
}
} else {
print_cmd_error_invalid_value(tstring(option_name) + _T(" ") + param_arg + _T("="), param_val, list_log_level);
print_cmd_error_invalid_value(tstring(option_name) + _T(" ") + param_arg + _T("="), param_val, logLevelList.data());
return 1;
}
} else {
int value = 0;
if (get_list_value(list_log_level, param.c_str(), &value)) {
if (get_list_value(logLevelList.data(), param.c_str(), &value)) {
loglevel.set((RGYLogLevel)value, RGY_LOGT_ALL);
continue;
} else {
print_cmd_error_invalid_value(option_name, arg_value, list_log_level);
print_cmd_error_invalid_value(option_name, arg_value, logLevelList.data());
return 1;
}
}
Expand Down Expand Up @@ -5190,7 +5195,15 @@ int parse_one_ctrl_option(const TCHAR *option_name, const TCHAR *strInput[], int
}
i++;

auto parse_val = [option_name](RGYThreadAffinity& affinity, const tstring& param_arg, const tstring& param_val) {
std::array<CX_DESC, RGY_THREAD_AFFINITY_MODE_STR.size() + 1> list_thread_affinity_mode;
for (size_t ia = 0; ia < RGY_THREAD_AFFINITY_MODE_STR.size(); ia++) {
list_thread_affinity_mode[ia].value = (int)RGY_THREAD_AFFINITY_MODE_STR[ia].second;
list_thread_affinity_mode[ia].desc = RGY_THREAD_AFFINITY_MODE_STR[ia].first;
}
list_thread_affinity_mode[RGY_THREAD_AFFINITY_MODE_STR.size()].value = 0;
list_thread_affinity_mode[RGY_THREAD_AFFINITY_MODE_STR.size()].desc = nullptr;

auto parse_val = [option_name, &list_thread_affinity_mode](RGYThreadAffinity& affinity, const tstring& param_arg, const tstring& param_val) {
if (param_val.substr(0, 2) == _T("0x")) {
try {
uint64_t affintyValue = std::strtoull(tchar_to_string(param_val).c_str(), nullptr, 16);
Expand Down Expand Up @@ -5226,13 +5239,6 @@ int parse_one_ctrl_option(const TCHAR *option_name, const TCHAR *strInput[], int
if (affinity_mode != RGYThreadAffinityMode::END) {
affinity = RGYThreadAffinity(affinity_mode, affintyValue);
} else {
std::array<CX_DESC, RGY_THREAD_AFFINITY_MODE_STR.size() + 1> list_thread_affinity_mode;
for (size_t i = 0; i < RGY_THREAD_AFFINITY_MODE_STR.size(); i++) {
list_thread_affinity_mode[i].value = (int)RGY_THREAD_AFFINITY_MODE_STR[i].second;
list_thread_affinity_mode[i].desc = RGY_THREAD_AFFINITY_MODE_STR[i].first;
}
list_thread_affinity_mode[RGY_THREAD_AFFINITY_MODE_STR.size()].value = 0;
list_thread_affinity_mode[RGY_THREAD_AFFINITY_MODE_STR.size()].desc = nullptr;
print_cmd_error_invalid_value(tstring(option_name) + _T(" ") + param_arg + _T("="), param_val, list_thread_affinity_mode.data());
return 1;
}
Expand Down Expand Up @@ -5263,7 +5269,7 @@ int parse_one_ctrl_option(const TCHAR *option_name, const TCHAR *strInput[], int
return 1;
}
} else {
print_cmd_error_invalid_value(tstring(option_name) + _T(" ") + param_arg + _T("="), param_val, list_log_level);
print_cmd_error_invalid_value(tstring(option_name) + _T(" ") + param_arg + _T("="), param_val, list_thread_affinity_mode.data());
return 1;
}
} else {
Expand Down
10 changes: 0 additions & 10 deletions NVEncCore/rgy_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
#include "rgy_def.h"
#include "rgy_log.h"

const CX_DESC list_log_level[7] = {
{ _T("trace"), RGY_LOG_TRACE },
{ _T("debug"), RGY_LOG_DEBUG },
{ _T("more"), RGY_LOG_MORE },
{ _T("info"), RGY_LOG_INFO },
{ _T("warn"), RGY_LOG_WARN },
{ _T("error"), RGY_LOG_ERROR },
{ NULL, 0 }
};

tstring VideoVUIInfo::print_main() const {
return tstring(_T("matrix:")) + get_cx_desc(list_colormatrix, matrix) + _T(",")
+ tstring(_T("colorprim:")) + get_cx_desc(list_colorprim, colorprim) + _T(",")
Expand Down
2 changes: 0 additions & 2 deletions NVEncCore/rgy_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,6 @@ static bool is_list_empty(const CX_DESC *list) {
return list[0].desc == nullptr;
}

extern const CX_DESC list_log_level[];

const CX_DESC list_avsync[] = {
{ _T("cfr"), RGY_AVSYNC_ASSUME_CFR },
{ _T("vfr"), RGY_AVSYNC_VFR },
Expand Down
2 changes: 1 addition & 1 deletion NVEncCore/rgy_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void RGYLog::write_log(RGYLogLevel log_level, const RGYLogType logtype, const TC

std::string strHtml;
for (uint32_t i = 0; i < strLines.size() - 1; i++) {
strHtml += strsprintf("<div class=\"%s\">", tchar_to_string(list_log_level[log_level - RGY_LOG_TRACE].desc).c_str());
strHtml += strsprintf("<div class=\"%s\">", rgy_log_level_to_str(log_level));
strHtml += strLines[i];
strHtml += "</div>\n";
}
Expand Down
6 changes: 3 additions & 3 deletions NVEncCore/rgy_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#ifndef __RGY_CONFIG_H__
#define __RGY_CONFIG_H__

#define VER_FILEVERSION 0,7,33,0
#define VER_STR_FILEVERSION "7.33"
#define VER_STR_FILEVERSION_TCHAR _T("7.33")
#define VER_FILEVERSION 0,7,34,0
#define VER_STR_FILEVERSION "7.34"
#define VER_STR_FILEVERSION_TCHAR _T("7.34")

#ifdef _M_IX86
#define BUILD_ARCH_STR _T("x86")
Expand Down
8 changes: 8 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ CHECK_LIBAV_NAMES="libswresample libavutil libavcodec libavformat libavfilter li
LIBAV_CFLAGS=""
LIBAV_LIBS=""
ENABLE_AVSW_READER=1
AV_CHANNEL_LAYOUT_STRUCT_AVAIL=1

CHECK_VAPOURSYNTH_NAMES="vapoursynth vapoursynth-script"
ENABLE_VAPOURSYNTH=1
Expand Down Expand Up @@ -493,6 +494,12 @@ if [ $ENABLE_AVSW_READER -ne 0 ]; then
cnf_write "yes"
fi

if ! cxx_check "AVChannelLayout" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavutil/channel_layout.h" "AVChannelLayout ch_layout;" ; then
cnf_write "no"
AV_CHANNEL_LAYOUT_STRUCT_AVAIL=0
else
cnf_write "yes"
fi
if ! cxx_check "libswresample" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libswresample/swresample.h" "swr_alloc();" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
Expand Down Expand Up @@ -733,6 +740,7 @@ write_enc_config "#define ENABLE_SM_READER 0"
write_enc_config "#define ENABLE_LIBASS_SUBBURN $ENABLE_LIBASS"
write_enc_config "#define ENABLE_VMAF $ENABLE_LIBVMAF"
write_enc_config "#define ENABLE_AVCODEC_OUT_THREAD 1"
write_enc_config "#define AV_CHANNEL_LAYOUT_STRUCT_AVAIL $AV_CHANNEL_LAYOUT_STRUCT_AVAIL"
write_enc_config "#define ENABLE_CPP_REGEX $ENABLE_CPP_REGEX"
write_enc_config "#define ENABLE_DTL $ENABLE_DTL"
write_enc_config "#define ENABLE_PERF_COUNTER 0"
Expand Down

0 comments on commit fd35387

Please sign in to comment.