Merge pull request #12534 from gnattu/new-tonemap-mode
Add new tonemap mode options
This commit is contained in:
commit
9644e894f0
|
@ -66,6 +66,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
private readonly Version _minFFmpegReadrateOption = new Version(5, 0);
|
private readonly Version _minFFmpegReadrateOption = new Version(5, 0);
|
||||||
private readonly Version _minFFmpegWorkingVtHwSurface = new Version(7, 0, 1);
|
private readonly Version _minFFmpegWorkingVtHwSurface = new Version(7, 0, 1);
|
||||||
private readonly Version _minFFmpegDisplayRotationOption = new Version(6, 0);
|
private readonly Version _minFFmpegDisplayRotationOption = new Version(6, 0);
|
||||||
|
private readonly Version _minFFmpegAdvancedTonemapMode = new Version(7, 0, 1);
|
||||||
|
|
||||||
private static readonly Regex _validationRegex = new(ValidationRegex, RegexOptions.Compiled);
|
private static readonly Regex _validationRegex = new(ValidationRegex, RegexOptions.Compiled);
|
||||||
|
|
||||||
|
@ -104,6 +105,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
"m4v",
|
"m4v",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly string[] _legacyTonemapModes = new[] { "max", "rgb" };
|
||||||
|
private static readonly string[] _advancedTonemapModes = new[] { "lum", "itp" };
|
||||||
|
|
||||||
// Set max transcoding channels for encoders that can't handle more than a set amount of channels
|
// Set max transcoding channels for encoders that can't handle more than a set amount of channels
|
||||||
// AAC, FLAC, ALAC, libopus, libvorbis encoders all support at least 8 channels
|
// AAC, FLAC, ALAC, libopus, libvorbis encoders all support at least 8 channels
|
||||||
private static readonly Dictionary<string, int> _audioTranscodeChannelLookup = new(StringComparer.OrdinalIgnoreCase)
|
private static readonly Dictionary<string, int> _audioTranscodeChannelLookup = new(StringComparer.OrdinalIgnoreCase)
|
||||||
|
@ -3294,13 +3298,15 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
args = "tonemap_{0}=format={1}:p=bt709:t=bt709:m=bt709:tonemap={2}:peak={3}:desat={4}";
|
args = "tonemap_{0}=format={1}:p=bt709:t=bt709:m=bt709:tonemap={2}:peak={3}:desat={4}";
|
||||||
|
|
||||||
if (string.Equals(options.TonemappingMode, "max", StringComparison.OrdinalIgnoreCase)
|
var useLegacyTonemapModes = _mediaEncoder.EncoderVersion >= _minFFmpegOclCuTonemapMode
|
||||||
|| string.Equals(options.TonemappingMode, "rgb", StringComparison.OrdinalIgnoreCase))
|
&& _legacyTonemapModes.Contains(options.TonemappingMode, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var useAdvancedTonemapModes = _mediaEncoder.EncoderVersion >= _minFFmpegAdvancedTonemapMode
|
||||||
|
&& _advancedTonemapModes.Contains(options.TonemappingMode, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
if (useLegacyTonemapModes || useAdvancedTonemapModes)
|
||||||
{
|
{
|
||||||
if (_mediaEncoder.EncoderVersion >= _minFFmpegOclCuTonemapMode)
|
args += ":tonemap_mode={5}";
|
||||||
{
|
|
||||||
args += ":tonemap_mode={5}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.TonemappingParam != 0)
|
if (options.TonemappingParam != 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user