Metal: after experimenting with EDR tone-mapping, it's here but disabled. It's unclear how best to render content from Windows. We get the system calibration peak nits in the Mastering Display Color Volume metadata, but this won't apply to most content.

This commit is contained in:
Andy Grundman
2025-07-22 17:01:57 +08:00
committed by Acaki
parent 4fb3f7fa97
commit e57f0cd723
4 changed files with 70 additions and 48 deletions
+1 -27
View File
@@ -1016,33 +1016,7 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit);
- (void)getAllStats:(video_stats_t *)stats {
if (_renderingBackend == RENDER_METAL) {
#if TARGET_OS_OSX
float edrHeadroom = [[NSScreen mainScreen] maximumExtendedDynamicRangeColorComponentValue];
#else
float edrHeadroom = [[UIScreen mainScreen] currentEDRHeadroom];
UIScreenReferenceDisplayModeStatus referenceStatus = [[UIScreen mainScreen] referenceDisplayModeStatus];
#endif
if (edrHeadroom > 1.0) {
NSString *ref;
// Device has a reference display that may or may not be enabled
switch (referenceStatus) {
case UIScreenReferenceDisplayModeStatusLimited:
ref = @"(Reference mode limited),";
break;
case UIScreenReferenceDisplayModeStatusEnabled:
ref = @"(Reference mode),";
break;
default:
ref = @",";
break;
}
int peakNits = 1000;
stats->renderingBackendString = [NSString stringWithFormat:@"Metal, EDR %.1f %@ tone-mapped: %d nits",
edrHeadroom, ref, peakNits];
} else {
// if HDR
stats->renderingBackendString = [NSString stringWithFormat:@"Metal, tone-mapped: HDR->sRGB"];
}
stats->renderingBackendString = [NSString stringWithFormat:@"Metal, colorspace: %@", [MetalVideoRenderer currentColorSpace]];
} else {
stats->renderingBackendString = @"AVSampleBuffer";
}