mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	enhance workload when tone mapping with AMF
zscale filter is required.
This commit is contained in:
		
							parent
							
								
									db07510017
								
							
						
					
					
						commit
						2124bc2e18
					
				@ -858,6 +858,20 @@ namespace MediaBrowser.Controller.MediaEncoding
 | 
			
		||||
            }
 | 
			
		||||
            else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
 | 
			
		||||
                || string.Equals(videoEncoder, "hevc_amf", StringComparison.OrdinalIgnoreCase))
 | 
			
		||||
            {
 | 
			
		||||
                var videoStream = state.VideoStream;
 | 
			
		||||
                var isColorDepth10 = IsColorDepth10(state);
 | 
			
		||||
 | 
			
		||||
                if (isColorDepth10
 | 
			
		||||
                    && _mediaEncoder.SupportsHwaccel("opencl")
 | 
			
		||||
                    && encodingOptions.EnableTonemapping
 | 
			
		||||
                    && !string.IsNullOrEmpty(videoStream.VideoRange)
 | 
			
		||||
                    && videoStream.VideoRange.Contains("HDR", StringComparison.OrdinalIgnoreCase))
 | 
			
		||||
                {
 | 
			
		||||
                    // Enhance quality and workload when tone mapping with AMF
 | 
			
		||||
                    param += "-quality quality -preanalysis true";
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    switch (encodingOptions.EncoderPreset)
 | 
			
		||||
                    {
 | 
			
		||||
@ -884,6 +898,7 @@ namespace MediaBrowser.Controller.MediaEncoding
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (string.Equals(videoEncoder, "libvpx", StringComparison.OrdinalIgnoreCase)) // webm
 | 
			
		||||
            {
 | 
			
		||||
                // Values 0-3, 0 being highest quality but slower
 | 
			
		||||
@ -2123,19 +2138,18 @@ namespace MediaBrowser.Controller.MediaEncoding
 | 
			
		||||
                    if (isSwDecoder || isD3d11vaDecoder)
 | 
			
		||||
                    {
 | 
			
		||||
                        isScalingInAdvance = true;
 | 
			
		||||
                        // Add scaling filter before tonemapping filter for performance.
 | 
			
		||||
                        filters.AddRange(
 | 
			
		||||
                            GetScalingFilters(
 | 
			
		||||
                                state,
 | 
			
		||||
                                inputWidth,
 | 
			
		||||
                                inputHeight,
 | 
			
		||||
                                threeDFormat,
 | 
			
		||||
                                videoDecoder,
 | 
			
		||||
                                outputVideoCodec,
 | 
			
		||||
                                request.Width,
 | 
			
		||||
                                request.Height,
 | 
			
		||||
                                request.MaxWidth,
 | 
			
		||||
                                request.MaxHeight));
 | 
			
		||||
                        // Add zscale filter before tone mapping filter for performance.
 | 
			
		||||
                        var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
 | 
			
		||||
                        if (width.HasValue && height.HasValue)
 | 
			
		||||
                        {
 | 
			
		||||
                            filters.Add(
 | 
			
		||||
                                string.Format(
 | 
			
		||||
                                    CultureInfo.InvariantCulture,
 | 
			
		||||
                                    "zscale=s={0}x{1}",
 | 
			
		||||
                                    width.Value,
 | 
			
		||||
                                    height.Value));
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // Convert to hardware pixel format p010 when using SW decoder.
 | 
			
		||||
                        filters.Add("format=p010");
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user