Skip to content

Commit

Permalink
Move gl::HDRMetadata to gfx::HDRMetadata
Browse files Browse the repository at this point in the history
This structure should have originally been put in ui/gfx (with the
rest of the gfx::ColorSpace stuff) instead of ui/gl.

Bug: 1147537
Change-Id: I987c6fae136eb1c3d24dc1f5e953e14096e82d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2531070
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826559}
  • Loading branch information
ccameron-chromium authored and Commit Bot committed Nov 12, 2020
1 parent 332e681 commit 95cd1db
Show file tree
Hide file tree
Showing 63 changed files with 222 additions and 225 deletions.
2 changes: 1 addition & 1 deletion chromecast/media/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ include_rules = [
"+mojo/core/embedder/embedder.h",
"+mojo/public/cpp/bindings",
"+ui/gfx/geometry",
"+ui/gfx/hdr_metadata.h",
"+ui/gfx/overlay_transform.h",
"+ui/gl/hdr_metadata.h",
"+services/service_manager/public",
"+third_party/blink/public/common/tokens/tokens.h",
"+third_party/blink/public/platform/audio/web_audio_device_source_type.h",
Expand Down
4 changes: 2 additions & 2 deletions chromecast/media/cma/base/decoder_config_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "media/base/channel_layout.h"
#include "media/base/encryption_pattern.h"
#include "media/base/encryption_scheme.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace chromecast {
namespace media {
Expand Down Expand Up @@ -332,7 +332,7 @@ VideoConfig DecoderConfigAdapter::ToCastVideoConfig(
video_config.matrix = static_cast<MatrixID>(config.color_space_info().matrix);
video_config.range = static_cast<RangeID>(config.color_space_info().range);

base::Optional<::gl::HDRMetadata> hdr_metadata = config.hdr_metadata();
base::Optional<::gfx::HDRMetadata> hdr_metadata = config.hdr_metadata();
if (hdr_metadata) {
video_config.have_hdr_metadata = true;
video_config.hdr_metadata.max_content_light_level =
Expand Down
2 changes: 1 addition & 1 deletion chromecast/renderer/cast_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ bool CastContentRendererClient::IsSupportedVideoType(
// TODO(servolk): make use of eotf.

// TODO(1066567): Check attached screen for support of type.hdr_metadata_type.
if (type.hdr_metadata_type != ::gl::HdrMetadataType::kNone) {
if (type.hdr_metadata_type != ::gfx::HdrMetadataType::kNone) {
NOTIMPLEMENTED() << "HdrMetadataType support signaling not implemented.";
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion components/viz/common/quads/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ specific_include_rules = {
"+cc/test",
],
"yuv_video_draw_quad.*": [
"+ui/gl/hdr_metadata.h",
"+ui/gfx/hdr_metadata.h",
],
}
6 changes: 3 additions & 3 deletions components/viz/common/quads/draw_quad_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include "components/viz/common/quads/yuv_video_draw_quad.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/effects/SkBlurImageFilter.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gfx/transform.h"
#include "ui/gl/hdr_metadata.h"

namespace viz {
namespace {
Expand Down Expand Up @@ -421,7 +421,7 @@ TEST(DrawQuadTest, CopyYUVVideoDrawQuad) {
gfx::ProtectedVideoType protected_video_type =
gfx::ProtectedVideoType::kHardwareProtected;
gfx::ColorSpace video_color_space = gfx::ColorSpace::CreateJpeg();
gl::HDRMetadata hdr_metadata = gl::HDRMetadata();
gfx::HDRMetadata hdr_metadata = gfx::HDRMetadata();
hdr_metadata.max_content_light_level = 1000;
hdr_metadata.max_frame_average_light_level = 100;

Expand All @@ -447,7 +447,7 @@ TEST(DrawQuadTest, CopyYUVVideoDrawQuad) {
EXPECT_EQ(resource_multiplier, copy_quad->resource_multiplier);
EXPECT_EQ(bits_per_channel, copy_quad->bits_per_channel);
EXPECT_EQ(gfx::ProtectedVideoType::kClear, copy_quad->protected_video_type);
EXPECT_EQ(gl::HDRMetadata(), copy_quad->hdr_metadata);
EXPECT_EQ(gfx::HDRMetadata(), copy_quad->hdr_metadata);

CREATE_QUAD_ALL(YUVVideoDrawQuad, ya_tex_coord_rect, uv_tex_coord_rect,
ya_tex_size, uv_tex_size, y_plane_resource_id,
Expand Down
2 changes: 1 addition & 1 deletion components/viz/common/quads/render_pass_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ bool YUVVideoDrawQuadFromDict(const base::Value& dict,
static_cast<float>(resource_multiplier.value()),
static_cast<uint32_t>(bits_per_channel.value()),
static_cast<gfx::ProtectedVideoType>(protected_video_type_index),
gl::HDRMetadata());
gfx::HDRMetadata());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion components/viz/common/quads/render_pass_io_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ TEST(RenderPassIOTest, QuadList) {
gfx::RectF(0.f, 0.f, 0.5f, 0.6f), gfx::RectF(0.1f, 0.2f, 0.7f, 0.8f),
gfx::Size(400, 200), gfx::Size(800, 400), 1u, 2u, 3u, 4u,
gfx::ColorSpace::CreateCustom(primary_matrix, transfer_func), 3.f,
1.1f, 12u, gfx::ProtectedVideoType::kClear, gl::HDRMetadata());
1.1f, 12u, gfx::ProtectedVideoType::kClear, gfx::HDRMetadata());
++sqs_index;
++quad_count;
}
Expand Down
4 changes: 2 additions & 2 deletions components/viz/common/quads/yuv_video_draw_quad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "base/trace_event/traced_value.h"
#include "base/values.h"
#include "cc/base/math_util.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace viz {

Expand Down Expand Up @@ -68,7 +68,7 @@ void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
float multiplier,
uint32_t bits_per_channel,
gfx::ProtectedVideoType protected_video_type,
gl::HDRMetadata hdr_metadata) {
gfx::HDRMetadata hdr_metadata) {
DrawQuad::SetAll(shared_quad_state, DrawQuad::Material::kYuvVideoContent,
rect, visible_rect, needs_blending);
this->ya_tex_coord_rect = ya_tex_coord_rect;
Expand Down
6 changes: 3 additions & 3 deletions components/viz/common/quads/yuv_video_draw_quad.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gfx/video_types.h"
#include "ui/gl/hdr_metadata.h"

namespace viz {

Expand Down Expand Up @@ -73,7 +73,7 @@ class VIZ_COMMON_EXPORT YUVVideoDrawQuad : public DrawQuad {
float multiplier,
uint32_t bits_per_channel,
gfx::ProtectedVideoType protected_video_type,
gl::HDRMetadata hdr_metadata);
gfx::HDRMetadata hdr_metadata);

gfx::RectF ya_tex_coord_rect;
gfx::RectF uv_tex_coord_rect;
Expand All @@ -86,7 +86,7 @@ class VIZ_COMMON_EXPORT YUVVideoDrawQuad : public DrawQuad {
gfx::ColorSpace video_color_space;
gfx::ProtectedVideoType protected_video_type =
gfx::ProtectedVideoType::kClear;
gl::HDRMetadata hdr_metadata;
gfx::HDRMetadata hdr_metadata;

static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*);

Expand Down
4 changes: 2 additions & 2 deletions components/viz/service/display/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ include_rules = [
"+third_party/skia",
"+third_party/perfetto/protos/perfetto/trace/track_event",
"+ui/latency",
"+ui/gfx/video_types.h",
"+ui/gfx/android/android_surface_control_compat.h",
"+ui/gfx/hdr_metadata.h",
"+ui/gfx/video_types.h",
"+ui/gl/ca_renderer_layer_params.h",
"+ui/gl/dc_renderer_layer_params.h",
"+ui/gl/gl_utils.h",
"+ui/gl/gpu_switching_manager.h",
"+ui/gl/gpu_switching_observer.h",
"+ui/gl/hdr_metadata.h",
"+ui/gl/trace_util.h",
"+gpu/ipc/common/vulkan_ycbcr_info.h",
"+gpu/ipc/gpu_task_scheduler_helper.h",
Expand Down
4 changes: 2 additions & 2 deletions components/viz/service/display/dc_layer_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gfx/video_types.h"
#include "ui/gl/gpu_switching_observer.h"
#include "ui/gl/hdr_metadata.h"

namespace viz {
struct DebugRendererSettings;
Expand Down Expand Up @@ -70,7 +70,7 @@ class VIZ_SERVICE_EXPORT DCLayerOverlay {
gfx::ProtectedVideoType protected_video_type =
gfx::ProtectedVideoType::kClear;

gl::HDRMetadata hdr_metadata;
gfx::HDRMetadata hdr_metadata;
};

typedef std::vector<DCLayerOverlay> DCLayerOverlayList;
Expand Down
4 changes: 2 additions & 2 deletions media/base/android/jni_hdr_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include "media/base/android/media_jni_headers/HdrMetadata_jni.h"
#include "media/base/video_color_space.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace media {

JniHdrMetadata::JniHdrMetadata(const VideoColorSpace& color_space,
const gl::HDRMetadata& hdr_metadata)
const gfx::HDRMetadata& hdr_metadata)
: color_space_(color_space), hdr_metadata_(hdr_metadata) {
JNIEnv* env = base::android::AttachCurrentThread();
jobject_ = Java_HdrMetadata_create(env, reinterpret_cast<jlong>(this));
Expand Down
6 changes: 3 additions & 3 deletions media/base/android/jni_hdr_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "base/android/jni_android.h"
#include "base/macros.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace media {

Expand All @@ -16,7 +16,7 @@ class VideoColorSpace;
class JniHdrMetadata {
public:
JniHdrMetadata(const VideoColorSpace& color_space,
const gl::HDRMetadata& hdr_metadata);
const gfx::HDRMetadata& hdr_metadata);
~JniHdrMetadata();

base::android::ScopedJavaLocalRef<jobject> obj() { return jobject_; }
Expand Down Expand Up @@ -58,7 +58,7 @@ class JniHdrMetadata {

private:
const VideoColorSpace& color_space_;
const gl::HDRMetadata& hdr_metadata_;
const gfx::HDRMetadata& hdr_metadata_;
base::android::ScopedJavaLocalRef<jobject> jobject_;

DISALLOW_COPY_AND_ASSIGN(JniHdrMetadata);
Expand Down
4 changes: 2 additions & 2 deletions media/base/android/media_codec_bridge_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "media/base/media_export.h"
#include "media/base/video_decoder_config.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace media {

Expand Down Expand Up @@ -54,7 +54,7 @@ class MEDIA_EXPORT VideoCodecConfig {

// VP9 HDR metadata is only embedded in the container. HDR10 metadata is
// embedded in the video stream.
base::Optional<gl::HDRMetadata> hdr_metadata;
base::Optional<gfx::HDRMetadata> hdr_metadata;

// Enables the async MediaCodec.Callback API. |on_buffers_available_cb|
// will be called when input or output buffers are available. This will be
Expand Down
6 changes: 3 additions & 3 deletions media/base/ipc/media_param_traits_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include "media/base/watch_time_keys.h"
#include "media/media_buildflags.h"
#include "media/video/supported_video_decoder_config.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
#include "ui/gl/hdr_metadata.h"

#if BUILDFLAG(ENABLE_MEDIA_DRM_STORAGE)
#include "media/base/media_drm_key_type.h"
Expand Down Expand Up @@ -183,7 +183,7 @@ IPC_STRUCT_TRAITS_BEGIN(media::VideoColorSpace)
IPC_STRUCT_TRAITS_MEMBER(range)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(gl::MasteringMetadata)
IPC_STRUCT_TRAITS_BEGIN(gfx::MasteringMetadata)
IPC_STRUCT_TRAITS_MEMBER(primary_r)
IPC_STRUCT_TRAITS_MEMBER(primary_g)
IPC_STRUCT_TRAITS_MEMBER(primary_b)
Expand All @@ -192,7 +192,7 @@ IPC_STRUCT_TRAITS_BEGIN(gl::MasteringMetadata)
IPC_STRUCT_TRAITS_MEMBER(luminance_min)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(gl::HDRMetadata)
IPC_STRUCT_TRAITS_BEGIN(gfx::HDRMetadata)
IPC_STRUCT_TRAITS_MEMBER(mastering_metadata)
IPC_STRUCT_TRAITS_MEMBER(max_content_light_level)
IPC_STRUCT_TRAITS_MEMBER(max_frame_average_light_level)
Expand Down
6 changes: 3 additions & 3 deletions media/base/media_serializers.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "media/base/text_track_config.h"
#include "media/base/video_decoder_config.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace media {

Expand Down Expand Up @@ -212,8 +212,8 @@ struct MediaSerializer<VideoColorSpace> {

// Class (complex)
template <>
struct MediaSerializer<gl::HDRMetadata> {
static base::Value Serialize(const gl::HDRMetadata& value) {
struct MediaSerializer<gfx::HDRMetadata> {
static base::Value Serialize(const gfx::HDRMetadata& value) {
// TODO(tmathmeyer) serialize more fields here potentially.
base::Value result(base::Value::Type::DICTIONARY);
FIELD_SERIALIZE("luminance range",
Expand Down
2 changes: 1 addition & 1 deletion media/base/media_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct MEDIA_EXPORT VideoType {
VideoCodecProfile profile;
int level;
VideoColorSpace color_space;
gl::HdrMetadataType hdr_metadata_type;
gfx::HdrMetadataType hdr_metadata_type;
};

MEDIA_EXPORT bool operator==(const AudioType& x, const AudioType& y);
Expand Down
10 changes: 5 additions & 5 deletions media/base/supported_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ namespace media {

namespace {

bool IsSupportedHdrMetadata(const gl::HdrMetadataType& hdr_metadata_type) {
bool IsSupportedHdrMetadata(const gfx::HdrMetadataType& hdr_metadata_type) {
switch (hdr_metadata_type) {
case gl::HdrMetadataType::kNone:
case gfx::HdrMetadataType::kNone:
return true;

case gl::HdrMetadataType::kSmpteSt2086:
case gl::HdrMetadataType::kSmpteSt2094_10:
case gl::HdrMetadataType::kSmpteSt2094_40:
case gfx::HdrMetadataType::kSmpteSt2086:
case gfx::HdrMetadataType::kSmpteSt2094_10:
case gfx::HdrMetadataType::kSmpteSt2094_40:
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions media/base/supported_types_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeWithHdrMetadataBasics) {
// No HDR metadata types are supported.
EXPECT_FALSE(
IsSupportedVideoType({kCodecVP8, VP8PROFILE_ANY, kUnspecifiedLevel,
color_space, gl::HdrMetadataType::kSmpteSt2086}));
color_space, gfx::HdrMetadataType::kSmpteSt2086}));

EXPECT_FALSE(IsSupportedVideoType({kCodecVP8, VP8PROFILE_ANY,
kUnspecifiedLevel, color_space,
gl::HdrMetadataType::kSmpteSt2094_10}));
gfx::HdrMetadataType::kSmpteSt2094_10}));

EXPECT_FALSE(IsSupportedVideoType({kCodecVP8, VP8PROFILE_ANY,
kUnspecifiedLevel, color_space,
gl::HdrMetadataType::kSmpteSt2094_40}));
gfx::HdrMetadataType::kSmpteSt2094_40}));
}
} // namespace media
8 changes: 4 additions & 4 deletions media/base/video_decoder_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "media/base/video_types.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

namespace media {

Expand Down Expand Up @@ -151,10 +151,10 @@ class MEDIA_EXPORT VideoDecoderConfig {
const VideoColorSpace& color_space_info() const { return color_space_info_; }

// Dynamic range of the image data.
void set_hdr_metadata(const gl::HDRMetadata& hdr_metadata) {
void set_hdr_metadata(const gfx::HDRMetadata& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}
const base::Optional<gl::HDRMetadata>& hdr_metadata() const {
const base::Optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}

Expand Down Expand Up @@ -189,7 +189,7 @@ class MEDIA_EXPORT VideoDecoderConfig {
EncryptionScheme encryption_scheme_ = EncryptionScheme::kUnencrypted;

VideoColorSpace color_space_info_;
base::Optional<gl::HDRMetadata> hdr_metadata_;
base::Optional<gfx::HDRMetadata> hdr_metadata_;

// Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
// generated copy constructor and assignment operator. Since the extra data is
Expand Down
8 changes: 4 additions & 4 deletions media/base/video_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/hdr_metadata.h"
#include "ui/gfx/hdr_metadata.h"

#if defined(OS_MAC)
#include <CoreVideo/CVPixelBuffer.h>
Expand Down Expand Up @@ -439,11 +439,11 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
color_space_ = color_space;
}

const base::Optional<gl::HDRMetadata>& hdr_metadata() const {
const base::Optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}

void set_hdr_metadata(const base::Optional<gl::HDRMetadata>& hdr_metadata) {
void set_hdr_metadata(const base::Optional<gfx::HDRMetadata>& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}

Expand Down Expand Up @@ -724,7 +724,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
const int unique_id_;

gfx::ColorSpace color_space_;
base::Optional<gl::HDRMetadata> hdr_metadata_;
base::Optional<gfx::HDRMetadata> hdr_metadata_;

// Sampler conversion information which is used in vulkan context for android.
base::Optional<gpu::VulkanYCbCrInfo> ycbcr_info_;
Expand Down
Loading

0 comments on commit 95cd1db

Please sign in to comment.