Skip to content

Commit

Permalink
Delete media/base/yuv_convert and dependents. Prefer libyuv.
Browse files Browse the repository at this point in the history
libyuv has equivalent functionality for all functions now, stop
maintaining our own versions!

BUG=158462
TEST=none

Review-Url: https://codereview.chromium.org/2694113002
Cr-Commit-Position: refs/heads/master@{#450210}
  • Loading branch information
dalecurtis authored and Commit bot committed Feb 14, 2017
1 parent 0311cb9 commit 6e361a1
Show file tree
Hide file tree
Showing 41 changed files with 33 additions and 5,030 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ vs-chromium-project.txt
/llvm
/media/cast/logging/cast_logging_proto_lib.xml
/media/cdm/api
/media/media_asm.xml
/media/media_mojo_bindings.xml
/media/test/data/internal
/media/yuv_convert_simd_x86.xml
/metro_driver
/mojo/hello_world_service.xml
/mojo/mojo_application_bindings.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
#include "content/test/test_web_contents.h"
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
#include "media/base/yuv_convert.h"
#include "media/capture/video/video_capture_buffer_pool_impl.h"
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
#include "media/capture/video/video_capture_device_client.h"
#include "media/capture/video_capture_types.h"
#include "skia/ext/platform_canvas.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libyuv/include/libyuv.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/layout.h"
#include "ui/display/display.h"
Expand Down Expand Up @@ -85,8 +85,8 @@ void RunCurrentLoopWithDeadline() {

SkColor ConvertRgbToYuv(SkColor rgb) {
uint8_t yuv[3];
media::ConvertRGB32ToYUV(reinterpret_cast<uint8_t*>(&rgb), yuv, yuv + 1,
yuv + 2, 1, 1, 1, 1, 1);
libyuv::ARGBToI420(reinterpret_cast<uint8_t*>(&rgb), 1, yuv, 1, yuv + 1, 1,
yuv + 2, 1, 1, 1);
return SkColorSetRGB(yuv[0], yuv[1], yuv[2]);
}

Expand Down
26 changes: 11 additions & 15 deletions content/renderer/pepper/pepper_media_stream_video_track_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "content/renderer/media/media_stream_video_track.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/video_util.h"
#include "media/base/yuv_convert.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_media_stream_video_track.h"
#include "ppapi/c/ppb_video_frame.h"
Expand Down Expand Up @@ -110,20 +109,17 @@ void ConvertFromMediaVideoFrame(const scoped_refptr<media::VideoFrame>& src,
dst_size.width(),
dst_size.height());
} else {
media::ScaleYUVToRGB32(src->visible_data(VideoFrame::kYPlane),
src->visible_data(VideoFrame::kUPlane),
src->visible_data(VideoFrame::kVPlane),
dst,
src->visible_rect().width(),
src->visible_rect().height(),
dst_size.width(),
dst_size.height(),
src->stride(VideoFrame::kYPlane),
src->stride(VideoFrame::kUPlane),
dst_size.width() * 4,
media::YV12,
media::ROTATE_0,
media::FILTER_BILINEAR);
libyuv::YUVToARGBScaleClip(
src->visible_data(VideoFrame::kYPlane),
src->stride(VideoFrame::kYPlane),
src->visible_data(VideoFrame::kUPlane),
src->stride(VideoFrame::kUPlane),
src->visible_data(VideoFrame::kVPlane),
src->stride(VideoFrame::kVPlane), libyuv::FOURCC_YV12,
src->visible_rect().width(), src->visible_rect().height(), dst,
dst_size.width() * 4, libyuv::FOURCC_ARGB, dst_size.width(),
dst_size.height(), 0, 0, dst_size.width(), dst_size.height(),
kFilterMode);
}
} else if (dst_format == PP_VIDEOFRAME_FORMAT_YV12 ||
dst_format == PP_VIDEOFRAME_FORMAT_I420) {
Expand Down
89 changes: 1 addition & 88 deletions media/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ target(link_target_type, "base") {
"serial_runner.h",
"silent_sink_suspender.cc",
"silent_sink_suspender.h",
"simd/convert_rgb_to_yuv.h",
"simd/convert_rgb_to_yuv_c.cc",
"simd/convert_yuv_to_rgb.h",
"simd/convert_yuv_to_rgb_c.cc",
"simd/filter_yuv.h",
"simd/filter_yuv_c.cc",
"sinc_resampler.cc",
"sinc_resampler.h",
"stream_parser.cc",
Expand Down Expand Up @@ -265,8 +259,6 @@ target(link_target_type, "base") {
"video_util.h",
"wall_clock_time_source.cc",
"wall_clock_time_source.h",
"yuv_convert.cc",
"yuv_convert.h",
]

allow_circular_includes_from = []
Expand Down Expand Up @@ -337,16 +329,6 @@ target(link_target_type, "base") {
defines += [ "DISABLE_USER_INPUT_MONITOR" ]
}

if (current_cpu == "x86" || current_cpu == "x64") {
sources += [
"simd/convert_rgb_to_yuv_sse2.cc",
"simd/convert_rgb_to_yuv_ssse3.cc",
"simd/convert_yuv_to_rgb_x86.cc",
"simd/filter_yuv_sse2.cc",
]
deps += [ ":media_yasm" ]
}

if (is_linux || is_win) {
sources += [
"keyboard_event_counter.cc",
Expand Down Expand Up @@ -457,7 +439,6 @@ source_set("unit_tests") {
"video_frame_unittest.cc",
"video_util_unittest.cc",
"wall_clock_time_source_unittest.cc",
"yuv_convert_unittest.cc",
]
configs += [
"//build/config/compiler:no_size_t_to_int_warning",
Expand All @@ -473,6 +454,7 @@ source_set("unit_tests") {
"//skia",
"//testing/gmock",
"//testing/gtest",
"//third_party/libyuv",
]

# Even if FFmpeg is enabled on Android we don't want these.
Expand All @@ -491,9 +473,6 @@ source_set("unit_tests") {
]
}

if (current_cpu == "x86" || current_cpu == "x64") {
sources += [ "simd/convert_rgb_to_yuv_unittest.cc" ]
}
if (is_linux || is_win) {
sources += [ "keyboard_event_counter_unittest.cc" ]
}
Expand Down Expand Up @@ -523,7 +502,6 @@ source_set("perftests") {
"run_all_perftests.cc",
"sinc_resampler_perftest.cc",
"vector_math_perftest.cc",
"yuv_convert_perftest.cc",
]
configs += [ "//media:media_config" ]
deps = [
Expand All @@ -534,78 +512,13 @@ source_set("perftests") {
"//testing/gmock",
"//testing/gtest",
"//testing/perf",
"//third_party/libyuv",
]

if (media_use_ffmpeg) {
sources += [ "demuxer_perftest.cc" ]
}
}

if (current_cpu == "x86" || current_cpu == "x64") {
import("//third_party/yasm/yasm_assemble.gni")
yasm_assemble("media_yasm") {
sources = [
"simd/convert_rgb_to_yuv_ssse3.asm",
"simd/convert_yuv_to_rgb_sse.asm",
"simd/convert_yuva_to_argb_mmx.asm",
"simd/empty_register_state_mmx.asm",
"simd/linear_scale_yuv_to_rgb_mmx.asm",
"simd/linear_scale_yuv_to_rgb_sse.asm",
"simd/scale_yuv_to_rgb_mmx.asm",
"simd/scale_yuv_to_rgb_sse.asm",
]

yasm_flags = [
"-DCHROMIUM",

# In addition to the same path as source asm, let yasm %include
# search path be relative to src/ per Chromium policy.
"-I",
rebase_path("..", root_build_dir),
]

if (is_component_build) {
yasm_flags += [ "-DEXPORT_SYMBOLS" ]
}

inputs = [
"//third_party/x86inc/x86inc.asm",
"simd/convert_rgb_to_yuv_ssse3.inc",
"simd/convert_yuv_to_rgb_mmx.inc",
"simd/convert_yuva_to_argb_mmx.inc",
"simd/linear_scale_yuv_to_rgb_mmx.inc",
"simd/media_export.asm",
"simd/scale_yuv_to_rgb_mmx.inc",
]

if (current_cpu == "x86") {
yasm_flags += [ "-DARCH_X86_32" ]
} else if (current_cpu == "x64") {
yasm_flags += [ "-DARCH_X86_64" ]
sources += [
"simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
"simd/scale_yuv_to_rgb_sse2_x64.asm",
]
}

if (is_mac || is_ios) {
yasm_flags += [
"-DPREFIX",
"-DMACHO",
]
} else {
if (is_posix) {
yasm_flags += [ "-DELF" ]
if (current_cpu == "x64") {
# TODO(ajwong): Why isn't this true in mac?
yasm_flags += [ "-DPIC" ]
}
}
}
}
}

fuzzer_test("media_bit_reader_fuzzer") {
sources = [
"bit_reader_fuzzertest.cc",
Expand Down
4 changes: 0 additions & 4 deletions media/base/media.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "base/metrics/field_trial.h"
#include "base/trace_event/trace_event.h"
#include "media/base/media_switches.h"
#include "media/base/yuv_convert.h"

#if defined(OS_ANDROID)
#include "base/android/build_info.h"
Expand All @@ -29,9 +28,6 @@ class MediaInitializer {
TRACE_EVENT_WARMUP_CATEGORY("audio");
TRACE_EVENT_WARMUP_CATEGORY("media");

// Perform initialization of libraries which require runtime CPU detection.
InitializeCPUSpecificYUVConversions();

#if !defined(MEDIA_DISABLE_FFMPEG)
// Initialize CPU flags outside of the sandbox as this may query /proc for
// details on the current CPU for NEON, VFP, etc optimizations.
Expand Down
79 changes: 0 additions & 79 deletions media/base/simd/convert_rgb_to_yuv.h

This file was deleted.

Loading

0 comments on commit 6e361a1

Please sign in to comment.