| Commit-Queue | +1 |
Yao, PTAL at the ads related code, thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return pipeline_metadata_.video_decoder_config.color_space_info().IsHDR();The config should generally indicate the video is hdr, but it is possible for the HDR signaling to only be present in the frame. It's also possible to transition later than first frame. Is that okay for your metrics?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return pipeline_metadata_.video_decoder_config.color_space_info().IsHDR();The config should generally indicate the video is hdr, but it is possible for the HDR signaling to only be present in the frame. It's also possible to transition later than first frame. Is that okay for your metrics?
Thanks for calling that out. I think first frame is fine for measurement. If we intervene we should revisit and consider per-frame enforcement. WDYT?
| Code-Review | +1 |
media lgtm
virtual bool IsHDR() const { return false; }Document what specifically this is checking.
return pipeline_metadata_.video_decoder_config.color_space_info().IsHDR();Josh KarlinThe config should generally indicate the video is hdr, but it is possible for the HDR signaling to only be present in the frame. It's also possible to transition later than first frame. Is that okay for your metrics?
Thanks for calling that out. I think first frame is fine for measurement. If we intervene we should revisit and consider per-frame enforcement. WDYT?
Document what specifically this is checking.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
(element && element->IsAdRelated()) || (frame && frame->IsAdFrame());Should this also check `image->GetAdProvenance().has_value();`? This will catch ads loaded from ad urls but where the element and frame aren't marked as such.
desired_headroom = gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom;WDYT of:
desired_headroom = std::max(desired_headroom, gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom);
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Can you check that this captures the hdr case that inspired this? There are some cases, such as canvas and video poster images, which are not caught by this patch, and it would be good to confirm this works on the real-world cases, if possible (it may no longer be possible).
Can you check that this captures the hdr case that inspired this? There are some cases, such as canvas and video poster images, which are not caught by this patch, and it would be good to confirm this works on the real-world cases, if possible (it may no longer be possible).
I haven't been able to reproduce the reported eye-melting ad unfortunately. This use counter will help to figure out if it's happening often, and if so, on which sites (once there is follow-up ukm). I believe that video and images will be the common approach, so am starting with those.
(element && element->IsAdRelated()) || (frame && frame->IsAdFrame());Should this also check `image->GetAdProvenance().has_value();`? This will catch ads loaded from ad urls but where the element and frame aren't marked as such.
Yes, done, and added a test.
desired_headroom = gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom;WDYT of:
desired_headroom = std::max(desired_headroom, gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom);
The default is high, like nearly 5x. Keeping the code as-is allows the image to use < 1.5.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
PaintImage paint_image = img->PaintImageForCurrentFrame();Can you add a function `cc::PaintImage::GetMaximumRenderedHdrHeadroom`, and move the logic there
(that function will be useful in other contexts, and there are a few cases that are missed here).
if (desired_headroom >= 1.5f) {headroom is on a log2 scale, so 1.5 means "goes up to exp2(1.5)=Xx brighter than white".
}This is fine for getting data, but beware that with ST 2094-50, one can use SDR as the "base video", and then make it bright dynamically (frame-by-frame) using metadata.
(Nothing is doing that today, but it will be common in ~1 year).
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Done, ccameron@ PTAL again, thanks!
PaintImage paint_image = img->PaintImageForCurrentFrame();Can you add a function `cc::PaintImage::GetMaximumRenderedHdrHeadroom`, and move the logic there
(that function will be useful in other contexts, and there are a few cases that are missed here).
Done
headroom is on a log2 scale, so 1.5 means "goes up to exp2(1.5)=Xx brighter than white".
Ack, noted in a new comment.
This is fine for getting data, but beware that with ST 2094-50, one can use SDR as the "base video", and then make it bright dynamically (frame-by-frame) using metadata.
(Nothing is doing that today, but it will be common in ~1 year).
Thanks for potinting it out! Philipi also mentioned this. Seems OK for now, but is something to consider if we later intervene.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
sgtm if log space is fixed
// color space. Returns 1.0f if the image is SDR.It's in log space, so 0 is SDR.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm (with nits)
// color space. Returns 1.0f if the image is SDR.It's in log space, so 0 is SDR.
Done
return 1.0f;Josh Karlinreturn 0 for SDR
Updated the function to return log2 space.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
14 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: cc/paint/paint_image.h
Insertions: 4, Deletions: 3.
@@ -403,9 +403,10 @@
const gfx::HDRMetadata& GetHDRMetadata() const { return hdr_metadata_; }
- // Returns the maximum HDR headroom required to render this image at full HDR
- // brightness, taking into account gainmap ratio max metadata or the image's
- // color space. Returns 1.0f if the image is SDR.
+ // Returns the maximum HDR headroom in log2 space required to render this
+ // image at full HDR brightness, taking into account gainmap ratio max
+ // metadata or the image's color space. Returns 0.0f if the image is SDR (e.g.
+ // 0.5f corresponds to 2^0.5 ~= 1.41x SDR white).
float GetMaximumRenderedHdrHeadroom() const;
std::string ToString() const;
```
```
The name of the file: third_party/blink/renderer/core/layout/layout_object.cc
Insertions: 3, Deletions: 5.
@@ -156,9 +156,7 @@
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"
#include "third_party/skia/include/docs/SkPDFDocument.h"
-#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect_conversions.h"
-#include "ui/gfx/hdr_metadata.h"
namespace blink {
@@ -4583,10 +4581,10 @@
if (is_ad) {
if (Image* img = image->GetImage()) {
- // Headroom is on a log2 scale, so 1.5f corresponds to 2^1.5 ~= 2.83x
- // SDR white.
+ // Headroom is on a log2 scale. 0.5f corresponds to 2^0.5 ~= 1.41x SDR
+ // white.
if (img->PaintImageForCurrentFrame().GetMaximumRenderedHdrHeadroom() >=
- 1.5f) {
+ 0.5f) {
UseCounter::Count(GetDocument(), WebFeature::kAdImageHDR);
}
}
```
```
The name of the file: cc/paint/paint_image.cc
Insertions: 7, Deletions: 5.
@@ -5,6 +5,7 @@
#include "cc/paint/paint_image.h"
#include <algorithm>
+#include <cmath>
#include <memory>
#include <sstream>
#include <utility>
@@ -514,14 +515,15 @@
float PaintImage::GetMaximumRenderedHdrHeadroom() const {
if (HasGainmapInfo()) {
const SkGainmapInfo& gainmap_info = GetGainmapInfo();
- return std::max({gainmap_info.fGainmapRatioMax[0],
- gainmap_info.fGainmapRatioMax[1],
- gainmap_info.fGainmapRatioMax[2]});
+ float max_ratio = std::max({gainmap_info.fGainmapRatioMax[0],
+ gainmap_info.fGainmapRatioMax[1],
+ gainmap_info.fGainmapRatioMax[2]});
+ return std::log2(max_ratio);
}
if (color_space() && gfx::ColorSpace(*color_space()).IsHDR()) {
- return gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom;
+ return std::log2(gfx::HdrMetadataExtendedRange::kDefaultHdrHeadroom);
}
- return 1.0f;
+ return 0.0f;
}
} // namespace cc
```
Add UseCounters to measure HDR images and videos in ads
Adds WebFeature UseCounters (kAdImageHDR and kAdVideoHDR) to measure the
prevalence of bright high dynamic range (HDR) images and videos loaded
inside ad elements and ad subframes.
- kAdImageHDR: Triggered in LayoutObject::ImageNotifyFinished when an image loaded within an ad element or ad frame requests high HDR headroom (>= 1.5x, e.g., via UltraHDR gainmap max ratio or an HDR color space profile). Tested with browsertests and copied an hdr image from WPT.
- kAdVideoHDR: Triggered in HTMLVideoElement::OnFirstFrame when a video stream presented within an ad element or ad frame specifies an HDR color profile (PQ / HLG). Unittests only as I can't seem to figure out how to get hdr video in a headless browsertest.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |