kthelgason 194f40a2e7 Refactor QualityScaler and MovingAverage
The MovingAverage class was very specific to the QualityScaler. This
commit generalizes the MovingAverage class to be useful in other
situations as well, and adapts the QualityScaler to use the new
MovingAverage.

BUG=webrtc:6304

Review-Url: https://codereview.webrtc.org/2310853002
Cr-Commit-Position: refs/heads/master@{#14207}
2016-09-14 09:15:02 +00:00

329 lines
8.7 KiB
Plaintext

# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../build/webrtc.gni")
rtc_source_set("video_coding") {
sources = [
"codec_database.cc",
"codec_database.h",
"codec_timer.cc",
"codec_timer.h",
"decoding_state.cc",
"decoding_state.h",
"encoded_frame.cc",
"encoded_frame.h",
"fec_tables_xor.h",
"frame_buffer.cc",
"frame_buffer.h",
"frame_buffer2.cc",
"frame_buffer2.h",
"frame_object.cc",
"frame_object.h",
"generic_decoder.cc",
"generic_decoder.h",
"generic_encoder.cc",
"generic_encoder.h",
"histogram.cc",
"histogram.h",
"include/video_coding.h",
"include/video_coding_defines.h",
"inter_frame_delay.cc",
"inter_frame_delay.h",
"internal_defines.h",
"jitter_buffer.cc",
"jitter_buffer.h",
"jitter_buffer_common.h",
"jitter_estimator.cc",
"jitter_estimator.h",
"media_opt_util.cc",
"media_opt_util.h",
"media_optimization.cc",
"media_optimization.h",
"nack_fec_tables.h",
"nack_module.cc",
"nack_module.h",
"packet.cc",
"packet.h",
"packet_buffer.cc",
"packet_buffer.h",
"percentile_filter.cc",
"percentile_filter.h",
"protection_bitrate_calculator.cc",
"protection_bitrate_calculator.h",
"receiver.cc",
"receiver.h",
"rtp_frame_reference_finder.cc",
"rtp_frame_reference_finder.h",
"rtt_filter.cc",
"rtt_filter.h",
"session_info.cc",
"session_info.h",
"timestamp_map.cc",
"timestamp_map.h",
"timing.cc",
"timing.h",
"video_coding_impl.cc",
"video_coding_impl.h",
"video_receiver.cc",
"video_sender.cc",
]
# TODO(jschuh): Bug 1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":video_coding_utility",
":webrtc_h264",
":webrtc_i420",
":webrtc_vp8",
":webrtc_vp9",
"../..:webrtc_common",
"../../common_video",
"../../system_wrappers",
]
}
rtc_source_set("video_coding_utility") {
sources = [
"utility/frame_dropper.cc",
"utility/frame_dropper.h",
"utility/h264_bitstream_parser.cc",
"utility/h264_bitstream_parser.h",
"utility/ivf_file_writer.cc",
"utility/ivf_file_writer.h",
"utility/moving_average.cc",
"utility/moving_average.h",
"utility/qp_parser.cc",
"utility/qp_parser.h",
"utility/quality_scaler.cc",
"utility/quality_scaler.h",
"utility/simulcast_rate_allocator.cc",
"utility/simulcast_rate_allocator.h",
"utility/vp8_header_parser.cc",
"utility/vp8_header_parser.h",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"../../common_video",
"../../system_wrappers",
]
}
rtc_source_set("webrtc_h264") {
sources = [
"codecs/h264/h264.cc",
"codecs/h264/include/h264.h",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
defines = []
deps = [
"../../system_wrappers",
]
if (is_ios) {
sources += [ "codecs/h264/h264_objc.mm" ]
deps += [ ":webrtc_h264_video_toolbox" ]
}
if (rtc_use_h264) {
defines += [ "WEBRTC_USE_H264" ]
if (rtc_initialize_ffmpeg) {
defines += [ "WEBRTC_INITIALIZE_FFMPEG" ]
}
sources += [
"codecs/h264/h264_decoder_impl.cc",
"codecs/h264/h264_decoder_impl.h",
"codecs/h264/h264_encoder_impl.cc",
"codecs/h264/h264_encoder_impl.h",
]
deps += [
"../../common_video",
"//third_party/ffmpeg:ffmpeg",
"//third_party/openh264:encoder",
]
}
}
if (is_ios) {
rtc_source_set("webrtc_h264_video_toolbox") {
sources = [
"codecs/h264/h264_video_toolbox_decoder.cc",
"codecs/h264/h264_video_toolbox_decoder.h",
"codecs/h264/h264_video_toolbox_encoder.h",
"codecs/h264/h264_video_toolbox_encoder.mm",
"codecs/h264/h264_video_toolbox_nalu.cc",
"codecs/h264/h264_video_toolbox_nalu.h",
]
configs += [
"../..:common_objc",
"//build/config/compiler:enable_arc",
]
# TODO(hbos): Make webrtc_h264_video_toolbox compile with the standard set
# of warnings.
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6307
suppressed_configs += [ rtc_common_config ]
deps = [
"../../sdk:rtc_sdk_common_objc",
]
libs = [
"CoreFoundation.framework",
"CoreMedia.framework",
"CoreVideo.framework",
"VideoToolbox.framework",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (rtc_build_libyuv) {
deps += [ "$rtc_libyuv_dir" ]
public_deps = [
"$rtc_libyuv_dir",
]
} else {
# Need to add a directory normally exported by libyuv.
include_dirs += [ "$rtc_libyuv_dir/include" ]
}
}
}
rtc_source_set("webrtc_i420") {
sources = [
"codecs/i420/i420.cc",
"codecs/i420/include/i420.h",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"../../system_wrappers",
]
}
rtc_source_set("webrtc_vp8") {
sources = [
"codecs/vp8/default_temporal_layers.cc",
"codecs/vp8/default_temporal_layers.h",
"codecs/vp8/include/vp8.h",
"codecs/vp8/include/vp8_common_types.h",
"codecs/vp8/realtime_temporal_layers.cc",
"codecs/vp8/reference_picture_selection.cc",
"codecs/vp8/reference_picture_selection.h",
"codecs/vp8/screenshare_layers.cc",
"codecs/vp8/screenshare_layers.h",
"codecs/vp8/simulcast_encoder_adapter.cc",
"codecs/vp8/simulcast_encoder_adapter.h",
"codecs/vp8/temporal_layers.h",
"codecs/vp8/vp8_impl.cc",
"codecs/vp8/vp8_impl.h",
]
# TODO(jschuh): Bug 1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":video_coding_utility",
"../..:webrtc_common",
"../../common_video",
"../../system_wrappers",
]
if (rtc_build_libvpx) {
deps += [ rtc_libvpx_dir ]
}
}
rtc_source_set("webrtc_vp9") {
sources = [
"codecs/vp9/include/vp9.h",
"codecs/vp9/screenshare_layers.cc",
"codecs/vp9/screenshare_layers.h",
"codecs/vp9/vp9_frame_buffer_pool.cc",
"codecs/vp9/vp9_frame_buffer_pool.h",
"codecs/vp9/vp9_impl.cc",
"codecs/vp9/vp9_impl.h",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":video_coding_utility",
"../../common_video",
"../../system_wrappers",
]
if (rtc_build_libvpx) {
deps += [ rtc_libvpx_dir ]
}
}
if (rtc_include_tests) {
rtc_source_set("video_codecs_test_framework") {
testonly = true
sources = [
"codecs/test/mock/mock_packet_manipulator.h",
"codecs/test/packet_manipulator.cc",
"codecs/test/packet_manipulator.h",
"codecs/test/predictive_packet_manipulator.cc",
"codecs/test/predictive_packet_manipulator.h",
"codecs/test/stats.cc",
"codecs/test/stats.h",
"codecs/test/videoprocessor.cc",
"codecs/test/videoprocessor.h",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"../../test:test_support",
]
}
}