Skip to content

Commit

Permalink
指定のchannellayoutが使用可能ならそれを使用するように。( #611 )
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Aug 11, 2024
1 parent d265c55 commit 5da5f0b
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 11 deletions.
4 changes: 4 additions & 0 deletions NVEnc/NVEnc_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions NVEncCore/rgy_avutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,27 @@ uniuqeRGYChannelLayout getChannelLayoutFromString(const std::string& channel_lay
return ch_layout;
}

bool ChannelLayoutExists(const RGYChannelLayout *target, const AVCodec *codec) {
#if AV_CHANNEL_LAYOUT_STRUCT_AVAIL
if (codec->ch_layouts == nullptr) return false;
RGYChannelLayout zero;
memset(&zero, 0, sizeof(RGYChannelLayout));
for (auto ptr = codec->ch_layouts; memcmp(ptr, &zero, sizeof(RGYChannelLayout)) != 0; ptr++) {
if (av_channel_layout_compare(target, ptr) == 0) {
return true;
}
}
#else
if (codec->channel_layouts == nullptr) return false;
for (auto ptr = codec->channel_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
Expand Down
2 changes: 2 additions & 0 deletions NVEncCore/rgy_avutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 AVCodec *codec);

//時刻を表示
std::string getTimestampChar(int64_t ts, const AVRational& timebase);
tstring getTimestampString(int64_t ts, const AVRational& timebase);
Expand Down
10 changes: 6 additions & 4 deletions NVEncCore/rgy_output_avcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
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;
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,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")
Expand Down
8 changes: 6 additions & 2 deletions Readme.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -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の各エンコードモード
Expand Down Expand Up @@ -141,26 +141,30 @@ NVEncを使用したことによる、いかなる損害・トラブルについ
- afs (自動フィールドシフト)
- nnedi
- yadif
- decomb
- decimate
- mpdecimate
- delogo
- 字幕焼きこみ
- 色空間変換 (x64版のみ)
- hdr2sdr
- sdr2hdr (NGX TrueHDR)
- lut3d
- リサイズ
- bilinear
- spline16, spline36, spline64
- lanczos2, lanczos3, lanczos4
- nppライブラリによる各種アルゴリズム (x64版のみ)
- nvvfx-superres
- ngx-vsr
- 回転 / 反転
- パディング(黒帯)の追加
- フレーム間引き(select every)
- バンディング低減
- ノイズ除去
- smooth (dctベースのノイズ除去)
- denoise-dct (dctベースのノイズ除去)
- fft3d (FFTベースの3Dノイズ除去)
- knn (K-nearest neighbor)
- pmd (正則化pmd法)
- gauss (nppライブラリ、x64版のみ)
Expand Down
8 changes: 6 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -145,13 +147,15 @@ 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
- deband
- 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)
Expand Down

0 comments on commit 5da5f0b

Please sign in to comment.