From 2b9b7687028cc85092ffd56ffc6afee0ad288621 Mon Sep 17 00:00:00 2001 From: rigaya Date: Sun, 11 Aug 2024 13:33:33 +0900 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=81=AEchannellayout?= =?UTF-8?q?=E3=81=8C=E4=BD=BF=E7=94=A8=E5=8F=AF=E8=83=BD=E3=81=AA=E3=82=89?= =?UTF-8?q?=E3=81=9D=E3=82=8C=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=80=82(=20#611=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NVEnc/NVEnc_readme.txt | 4 ++++ NVEncCore/rgy_avutil.cpp | 20 ++++++++++++++++++++ NVEncCore/rgy_avutil.h | 2 ++ NVEncCore/rgy_output_avcodec.cpp | 10 ++++++---- NVEncCore/rgy_version.h | 6 +++--- Readme.ja.md | 8 ++++++-- Readme.md | 8 ++++++-- 7 files changed, 47 insertions(+), 11 deletions(-) diff --git a/NVEnc/NVEnc_readme.txt b/NVEnc/NVEnc_readme.txt index fad5762c..e7c4e523 100644 --- a/NVEnc/NVEnc_readme.txt +++ b/NVEnc/NVEnc_readme.txt @@ -215,6 +215,10 @@ NVIDIA グラフィックドライバ 551.23 今後の更新で設定ファイルの互換性がなくなるかもしれません。 【メモ】 +2024.08.11 (7.62) +- mux後のHEVC+alphaが正常に認識されない問題を修正。 +- audio-streamで指定したchannelがそのまま使用されないことがあった問題を修正。 + 2024.08.06 (7.61) - RGB出力機能を追加。(--output-csp rgb) - YUVA420出力機能を追加。(--output-csp yuva420) diff --git a/NVEncCore/rgy_avutil.cpp b/NVEncCore/rgy_avutil.cpp index 3450ed69..97f7d16e 100644 --- a/NVEncCore/rgy_avutil.cpp +++ b/NVEncCore/rgy_avutil.cpp @@ -612,6 +612,26 @@ uniuqeRGYChannelLayout getChannelLayoutFromString(const std::string& channel_lay return ch_layout; } +bool ChannelLayoutExists(const RGYChannelLayout *target, const RGYChannelLayout *ch_layouts) { + if (ch_layouts == nullptr) return false; +#if AV_CHANNEL_LAYOUT_STRUCT_AVAIL + RGYChannelLayout zero; + memset(&zero, 0, sizeof(RGYChannelLayout)); + for (auto ptr = ch_layouts; memcmp(ptr, &zero, sizeof(RGYChannelLayout)) != 0; ptr++) { + if (av_channel_layout_compare(target, ptr) == 0) { + return true; + } + } +#else + for (auto ptr = ch_layouts; *ptr; ptr++) { + if (*ptr == *target) { + return true; + } + } +#endif + return false; +} + uniuqeRGYChannelLayout getDefaultChannelLayout(const int nb_channels) { auto ch_layout = createChannelLayoutEmpty(); #if AV_CHANNEL_LAYOUT_STRUCT_AVAIL diff --git a/NVEncCore/rgy_avutil.h b/NVEncCore/rgy_avutil.h index aaf8de5e..f0e0ca90 100644 --- a/NVEncCore/rgy_avutil.h +++ b/NVEncCore/rgy_avutil.h @@ -418,6 +418,8 @@ uniuqeRGYChannelLayout getDefaultChannelLayout(const int nb_channels); int getChannelLayoutIndexFromChannel(const RGYChannelLayout *ch_layout, const RGYChannel channel); RGYChannel getChannelLayoutChannelFromIndex(const RGYChannelLayout *ch_layout, const int index); +bool ChannelLayoutExists(const RGYChannelLayout *target, const RGYChannelLayout *ch_layouts); + //時刻を表示 std::string getTimestampChar(int64_t ts, const AVRational& timebase); tstring getTimestampString(int64_t ts, const AVRational& timebase); diff --git a/NVEncCore/rgy_output_avcodec.cpp b/NVEncCore/rgy_output_avcodec.cpp index 8cfbb3e6..c4281170 100644 --- a/NVEncCore/rgy_output_avcodec.cpp +++ b/NVEncCore/rgy_output_avcodec.cpp @@ -1438,10 +1438,12 @@ RGY_ERR RGYOutputAvcodec::InitAudio(AVMuxAudio *muxAudio, AVOutputStreamPrm *inp enc_channel_layout = getChannelLayoutFromString(muxAudio->streamChannelOut[muxAudio->inSubStream]); if (muxAudio->streamChannelOut[muxAudio->inSubStream] == RGY_CHANNEL_AUTO) { //チャンネル選択の自動設定を反映 - uniuqeRGYChannelLayout channelSelect = (muxAudio->streamChannelSelect[muxAudio->inSubStream] == RGY_CHANNEL_AUTO) - ? getChannelLayout(muxAudio->outCodecDecodeCtx) - : getChannelLayoutFromString(muxAudio->streamChannelSelect[muxAudio->inSubStream]); - enc_channel_layout = getDefaultChannelLayout(getChannelCount(channelSelect.get())); + uniuqeRGYChannelLayout channelSelect = (muxAudio->streamChannelSelect[muxAudio->inSubStream] == RGY_CHANNEL_AUTO) ? getChannelLayout(muxAudio->outCodecDecodeCtx) : getChannelLayoutFromString(muxAudio->streamChannelSelect[muxAudio->inSubStream]); + if (ChannelLayoutExists(channelSelect.get(), muxAudio->outCodecEncode->ch_layouts)) { + enc_channel_layout = std::move(channelSelect); + } else { + enc_channel_layout = getDefaultChannelLayout(getChannelCount(channelSelect.get())); + } } } int enc_sample_rate = (inputAudio->samplingRate) ? inputAudio->samplingRate : muxAudio->outCodecDecodeCtx->sample_rate; diff --git a/NVEncCore/rgy_version.h b/NVEncCore/rgy_version.h index ba417fb2..ccda0684 100644 --- a/NVEncCore/rgy_version.h +++ b/NVEncCore/rgy_version.h @@ -29,9 +29,9 @@ #ifndef __RGY_CONFIG_H__ #define __RGY_CONFIG_H__ -#define VER_FILEVERSION 0,7,61,0 -#define VER_STR_FILEVERSION "7.61" -#define VER_STR_FILEVERSION_TCHAR _T("7.61") +#define VER_FILEVERSION 0,7,62,0 +#define VER_STR_FILEVERSION "7.62" +#define VER_STR_FILEVERSION_TCHAR _T("7.62") #ifdef _M_IX86 #define BUILD_ARCH_STR _T("x86") diff --git a/Readme.ja.md b/Readme.ja.md index 08a36e9f..7d698b9d 100644 --- a/Readme.ja.md +++ b/Readme.ja.md @@ -94,9 +94,9 @@ NVEncを使用したことによる、いかなる損害・トラブルについ ### NVEnc/NVEncC共通 - NVENCを使用したエンコード - H.264/AVC - - YUV4:4:4対応 + - YUV420 / YUV444 / RGB - H.265/HEVC (第2世代Maxwell以降) - - YUV4:4:4対応 + - YUV420 / YUV444 / RGB / YUVA420 (YUV + alpha channel) - 10bit - AV1 (Ada Lovelace以降) - NVENCの各エンコードモード @@ -141,12 +141,14 @@ NVEncを使用したことによる、いかなる損害・トラブルについ - afs (自動フィールドシフト) - nnedi - yadif + - decomb - decimate - mpdecimate - delogo - 字幕焼きこみ - 色空間変換 (x64版のみ) - hdr2sdr + - sdr2hdr (NGX TrueHDR) - lut3d - リサイズ - bilinear @@ -154,6 +156,7 @@ NVEncを使用したことによる、いかなる損害・トラブルについ - lanczos2, lanczos3, lanczos4 - nppライブラリによる各種アルゴリズム (x64版のみ) - nvvfx-superres + - ngx-vsr - 回転 / 反転 - パディング(黒帯)の追加 - フレーム間引き(select every) @@ -161,6 +164,7 @@ NVEncを使用したことによる、いかなる損害・トラブルについ - ノイズ除去 - smooth (dctベースのノイズ除去) - denoise-dct (dctベースのノイズ除去) + - fft3d (FFTベースの3Dノイズ除去) - knn (K-nearest neighbor) - pmd (正則化pmd法) - gauss (nppライブラリ、x64版のみ) diff --git a/Readme.md b/Readme.md index c6cd2131..0f6a34a3 100644 --- a/Readme.md +++ b/Readme.md @@ -94,9 +94,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. ### Common to NVEnc / NVEncC - Encoding using NVENC - H.264 / AVC - - YUV420 / YUV444 + - YUV420 / YUV444 / RGB - H.265 / HEVC (2nd Gen Maxwell or later) - - YUV420 / YUV444 + - YUV420 / YUV444 / RGB / YUVA420 (YUV + alpha channel) - 10 bits - AV1 (Ada Lovelace or later) - Each encode mode of NVENC @@ -132,10 +132,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. - afs (Automatic field shift) - nnedi - yadif + - decomb - decimate - mpdecimate - colorspace conversion (x64 version only) - hdr2sdr + - sdr2hdr (NGX TrueHDR) - lut3d - delogo - subburn @@ -145,6 +147,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. - lanczos2, lanczos3, lanczos4 - various algorithms by npp library are available (x64 version only) - nvvfx-superres + - ngx-vsr - transpose / rotate / flip - padding - select-every @@ -152,6 +155,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. - noise reduction - smooth (dct based denoise) - denoise-dct (another dct based denoise) + - fft3d (fft based 3D denoise) - knn (K-nearest neighbor) - pmd (modified pmd method) - gauss (npp library, x64 version only)