|
|
@@ -5949,28 +5949,37 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
|
var isFullAfbcPipeline = isEncoderSupportAfbc && isDrmInDrmOut && !doOclTonemap;
|
|
|
var swapOutputWandH = doRkVppTranspose && swapWAndH;
|
|
|
- var outFormat = doOclTonemap ? "p010" : (isMjpegEncoder ? "bgra" : "nv12"); // RGA only support full range in rgb fmts
|
|
|
+ var outFormat = doOclTonemap ? "p010" : "nv12";
|
|
|
var hwScaleFilter = GetHwScaleFilter("vpp", "rkrga", outFormat, swapOutputWandH, swpInW, swpInH, reqW, reqH, reqMaxW, reqMaxH);
|
|
|
- var doScaling = GetHwScaleFilter("vpp", "rkrga", string.Empty, swapOutputWandH, swpInW, swpInH, reqW, reqH, reqMaxW, reqMaxH);
|
|
|
+ var doScaling = !string.IsNullOrEmpty(GetHwScaleFilter("vpp", "rkrga", string.Empty, swapOutputWandH, swpInW, swpInH, reqW, reqH, reqMaxW, reqMaxH));
|
|
|
|
|
|
if (!hasSubs
|
|
|
|| doRkVppTranspose
|
|
|
|| !isFullAfbcPipeline
|
|
|
- || !string.IsNullOrEmpty(doScaling))
|
|
|
+ || doScaling)
|
|
|
{
|
|
|
+ var isScaleRatioSupported = IsScaleRatioSupported(inW, inH, reqW, reqH, reqMaxW, reqMaxH, 8.0f);
|
|
|
+
|
|
|
// RGA3 hardware only support (1/8 ~ 8) scaling in each blit operation,
|
|
|
// but in Trickplay there's a case: (3840/320 == 12), enable 2pass for it
|
|
|
- if (!string.IsNullOrEmpty(doScaling)
|
|
|
- && !IsScaleRatioSupported(inW, inH, reqW, reqH, reqMaxW, reqMaxH, 8.0f))
|
|
|
+ if (doScaling && !isScaleRatioSupported)
|
|
|
{
|
|
|
// Vendor provided BSP kernel has an RGA driver bug that causes the output to be corrupted for P010 format.
|
|
|
// Use NV15 instead of P010 to avoid the issue.
|
|
|
// SDR inputs are using BGRA formats already which is not affected.
|
|
|
- var intermediateFormat = string.Equals(outFormat, "p010", StringComparison.OrdinalIgnoreCase) ? "nv15" : outFormat;
|
|
|
+ var intermediateFormat = doOclTonemap ? "nv15" : (isMjpegEncoder ? "bgra" : outFormat);
|
|
|
var hwScaleFilterFirstPass = $"scale_rkrga=w=iw/7.9:h=ih/7.9:format={intermediateFormat}:force_original_aspect_ratio=increase:force_divisible_by=4:afbc=1";
|
|
|
mainFilters.Add(hwScaleFilterFirstPass);
|
|
|
}
|
|
|
|
|
|
+ // The RKMPP MJPEG encoder on some newer chip models no longer supports RGB input.
|
|
|
+ // Use 2pass here to enable RGA output of full-range YUV in the 2nd pass.
|
|
|
+ if (isMjpegEncoder && !doOclTonemap && ((doScaling && isScaleRatioSupported) || !doScaling))
|
|
|
+ {
|
|
|
+ var hwScaleFilterFirstPass = "vpp_rkrga=format=bgra:afbc=1";
|
|
|
+ mainFilters.Add(hwScaleFilterFirstPass);
|
|
|
+ }
|
|
|
+
|
|
|
if (!string.IsNullOrEmpty(hwScaleFilter) && doRkVppTranspose)
|
|
|
{
|
|
|
hwScaleFilter += $":transpose={transposeDir}";
|