Skip to content

Commit

Permalink
libaom: Add flag to enable encoder
Browse files Browse the repository at this point in the history
Since encoder needs decoder, there is only 1 flag now for both.

Bug: 1055917
Change-Id: If09ae1eddda2855371599718fda0b8f4372ab44f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2103318
Reviewed-by: James Zern <jzern@google.com>
Reviewed-by: Ted Meyer <tmathmeyer@chromium.org>
Commit-Queue: Jerome Jiang <jianj@google.com>
Cr-Commit-Position: refs/heads/master@{#750869}
  • Loading branch information
jeromejj authored and Commit Bot committed Mar 17, 2020
1 parent 0d2d389 commit eeff987
Show file tree
Hide file tree
Showing 69 changed files with 171,303 additions and 785 deletions.
4 changes: 2 additions & 2 deletions media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "media/filters/vpx_video_decoder.h"
#endif

#if BUILDFLAG(ENABLE_LIBAOM_DECODER)
#if BUILDFLAG(ENABLE_LIBAOM)
#include "media/filters/aom_video_decoder.h"
#endif

Expand Down Expand Up @@ -320,7 +320,7 @@ std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder(
#if BUILDFLAG(ENABLE_DAV1D_DECODER)
if (config.codec == cdm::kCodecAv1)
video_decoder.reset(new Dav1dVideoDecoder(null_media_log.get()));
#elif BUILDFLAG(ENABLE_LIBAOM_DECODER)
#elif BUILDFLAG(ENABLE_LIBAOM)
if (config.codec == cdm::kCodecAv1)
video_decoder.reset(new AomVideoDecoder(null_media_log.get()));
#endif
Expand Down
4 changes: 2 additions & 2 deletions media/filters/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jumbo_source_set("filters") {
deps += [ "//third_party/libvpx" ]
}

if (enable_libaom_decoder) {
if (enable_libaom) {
sources += [
"aom_video_decoder.cc",
"aom_video_decoder.h",
Expand Down Expand Up @@ -375,7 +375,7 @@ source_set("unit_tests") {
sources += [ "vpx_video_decoder_unittest.cc" ]
}

if (enable_libaom_decoder) {
if (enable_libaom) {
sources += [ "aom_video_decoder_unittest.cc" ]
}

Expand Down
2 changes: 1 addition & 1 deletion media/media_options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ declare_args() {

declare_args() {
enable_av1_decoder =
enable_dav1d_decoder || enable_libaom_decoder || enable_libgav1_decoder
enable_dav1d_decoder || enable_libaom || enable_libgav1_decoder
}

# enable_hls_sample_aes can only be true if enable_mse_mpeg2ts_stream_parser is.
Expand Down
4 changes: 2 additions & 2 deletions media/renderers/default_decoder_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "media/filters/fuchsia/fuchsia_video_decoder.h"
#endif

#if BUILDFLAG(ENABLE_LIBAOM_DECODER)
#if BUILDFLAG(ENABLE_LIBAOM)
#include "media/filters/aom_video_decoder.h"
#endif

Expand Down Expand Up @@ -148,7 +148,7 @@ void DefaultDecoderFactory::CreateVideoDecoders(
#if BUILDFLAG(ENABLE_DAV1D_DECODER)
video_decoders->push_back(
std::make_unique<OffloadingDav1dVideoDecoder>(media_log));
#elif BUILDFLAG(ENABLE_LIBAOM_DECODER)
#elif BUILDFLAG(ENABLE_LIBAOM)
video_decoders->push_back(std::make_unique<AomVideoDecoder>(media_log));
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions media/test/pipeline_integration_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "media/test/test_media_source.h"
#include "third_party/libaom/libaom_buildflags.h"

#if BUILDFLAG(ENABLE_LIBAOM_DECODER)
#if BUILDFLAG(ENABLE_LIBAOM)
#include "media/filters/aom_video_decoder.h"
#endif

Expand Down Expand Up @@ -89,7 +89,7 @@ static std::vector<std::unique_ptr<VideoDecoder>> CreateVideoDecodersForTest(
#if BUILDFLAG(ENABLE_DAV1D_DECODER)
video_decoders.push_back(
std::make_unique<OffloadingDav1dVideoDecoder>(media_log));
#elif BUILDFLAG(ENABLE_LIBAOM_DECODER)
#elif BUILDFLAG(ENABLE_LIBAOM)
video_decoders.push_back(std::make_unique<AomVideoDecoder>(media_log));
#endif
}
Expand Down
33 changes: 31 additions & 2 deletions third_party/libaom/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import("//third_party/yasm/yasm_assemble.gni")
buildflag_header("libaom_buildflags") {
header = "libaom_buildflags.h"

flags = [ "ENABLE_LIBAOM_DECODER=$enable_libaom_decoder" ]
flags = [ "ENABLE_LIBAOM=$enable_libaom" ]
}

if (enable_libaom_decoder) {
if (enable_libaom) {
# Sets the architecture name for building libaom.
if (current_cpu == "x86") {
cpu_arch_full = "ia32"
Expand Down Expand Up @@ -74,6 +74,12 @@ if (enable_libaom_decoder) {
sources = aom_dsp_common_asm_sse2
sources += aom_dsp_common_asm_ssse3
sources += aom_ports_asm_x86
sources += aom_av1_encoder_asm_sse2
sources += aom_av1_encoder_asm_ssse3_x86_64
sources += aom_dsp_encoder_asm_sse2
sources += aom_dsp_encoder_asm_sse2_x86_64
sources += aom_dsp_encoder_asm_ssse3_x86_64
sources += aom_dsp_encoder_avx_asm_x86_64
defines = [ "CHROMIUM" ]
include_dirs = libaom_include_dirs
}
Expand All @@ -93,6 +99,18 @@ if (enable_libaom_decoder) {
}
sources = aom_av1_common_intrin_sse2
sources += aom_dsp_common_intrin_sse2
sources += aom_av1_encoder_intrin_sse2
sources += aom_dsp_encoder_intrin_sse2
}

source_set("libaom_intrinsics_sse3") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":libaom_config" ]
if (!is_win || is_clang) {
cflags = [ "-msse3" ]
}
sources = aom_av1_encoder_intrin_sse3
}

source_set("libaom_intrinsics_ssse3") {
Expand All @@ -104,6 +122,7 @@ if (enable_libaom_decoder) {
}
sources = aom_av1_common_intrin_ssse3
sources += aom_dsp_common_intrin_ssse3
sources += aom_dsp_encoder_intrin_ssse3
}

source_set("libaom_intrinsics_sse4_1") {
Expand All @@ -115,6 +134,8 @@ if (enable_libaom_decoder) {
}
sources = aom_av1_common_intrin_sse4_1
sources += aom_dsp_common_intrin_sse4_1
sources += aom_av1_encoder_intrin_sse4_1
sources += aom_dsp_encoder_intrin_sse4_1
}

source_set("libaom_intrinsics_sse4_2") {
Expand All @@ -124,6 +145,7 @@ if (enable_libaom_decoder) {
if (!is_win || is_clang) {
cflags = [ "-msse4.2" ]
}
sources = aom_av1_encoder_intrin_sse4_2
}

source_set("libaom_intrinsics_avx") {
Expand All @@ -148,6 +170,8 @@ if (enable_libaom_decoder) {
}
sources = aom_av1_common_intrin_avx2
sources += aom_dsp_common_intrin_avx2
sources += aom_av1_encoder_intrin_avx2
sources += aom_dsp_encoder_intrin_avx2
}
}

Expand All @@ -167,6 +191,8 @@ if (enable_libaom_decoder) {
[ "//third_party/libaom/source/libaom/aom_ports/arm_cpudetect.c" ]
sources += aom_av1_common_intrin_neon
sources += aom_dsp_common_intrin_neon
sources += aom_av1_encoder_intrin_neon
sources += aom_dsp_encoder_intrin_neon
}
}

Expand All @@ -187,12 +213,15 @@ if (enable_libaom_decoder) {
sources += aom_scale_sources
sources += aom_sources
sources += aom_util_sources
sources += aom_av1_encoder_sources
sources += aom_dsp_encoder_sources
deps = []
if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) {
deps += [
":libaom_intrinsics_avx",
":libaom_intrinsics_avx2",
":libaom_intrinsics_sse2",
":libaom_intrinsics_sse3",
":libaom_intrinsics_sse4_1",
":libaom_intrinsics_sse4_2",
":libaom_intrinsics_ssse3",
Expand Down
2 changes: 1 addition & 1 deletion third_party/libaom/cmake_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ trap '{

all_platforms="-DCONFIG_SIZE_LIMIT=1"
all_platforms+=" -DDECODE_HEIGHT_LIMIT=16384 -DDECODE_WIDTH_LIMIT=16384"
all_platforms+=" -DCONFIG_AV1_ENCODER=0"
all_platforms+=" -DCONFIG_AV1_ENCODER=1"
all_platforms+=" -DCONFIG_LOWBITDEPTH=1"
all_platforms+=" -DCONFIG_MAX_DECODE_PROFILE=0"
all_platforms+=" -DCONFIG_NORMAL_TILE_MODE=1"
Expand Down
121 changes: 121 additions & 0 deletions third_party/libaom/libaom_srcs.gni
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,127 @@ aom_dsp_decoder_sources = [
"//third_party/libaom/source/libaom/aom_dsp/grain_synthesis.h",
]

aom_dsp_encoder_asm_sse2 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_sad4d_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_sad_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_subpel_variance_impl_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_variance_impl_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad4d_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/subpel_variance_sse2.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/subtract_sse2.asm",
]

aom_dsp_encoder_asm_sse2_x86_64 =
[ "//third_party/libaom/source/libaom/aom_dsp/x86/ssim_sse2_x86_64.asm" ]

aom_dsp_encoder_asm_ssse3_x86_64 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/fwd_txfm_ssse3_x86_64.asm",
"//third_party/libaom/source/libaom/aom_dsp/x86/quantize_ssse3_x86_64.asm",
]

aom_dsp_encoder_avx_asm_x86_64 =
[ "//third_party/libaom/source/libaom/aom_dsp/x86/quantize_avx_x86_64.asm" ]

aom_dsp_encoder_intrin_avx2 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/masked_sad_intrin_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/subtract_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_quantize_intrin_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/adaptive_quantize_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_adaptive_quantize_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad4d_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad_highbd_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sad_impl_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/variance_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_variance_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sse_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/variance_impl_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/obmc_sad_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/obmc_variance_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/blk_sse_sum_avx2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sum_squares_avx2.c",
]

aom_dsp_encoder_intrin_msa = [
"//third_party/libaom/source/libaom/aom_dsp/mips/sad_msa.c",
"//third_party/libaom/source/libaom/aom_dsp/mips/subtract_msa.c",
"//third_party/libaom/source/libaom/aom_dsp/mips/variance_msa.c",
"//third_party/libaom/source/libaom/aom_dsp/mips/sub_pixel_variance_msa.c",
]

aom_dsp_encoder_intrin_neon = [
"//third_party/libaom/source/libaom/aom_dsp/arm/sad4d_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/sad_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/subpel_variance_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/variance_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/hadamard_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/avg_neon.c",
"//third_party/libaom/source/libaom/aom_dsp/arm/sse_neon.c",
]

aom_dsp_encoder_intrin_sse2 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/fwd_txfm_impl_sse2.h",
"//third_party/libaom/source/libaom/aom_dsp/x86/fwd_txfm_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/fwd_txfm_sse2.h",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_quantize_intrin_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_subtract_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_variance_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/quantize_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/adaptive_quantize_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_adaptive_quantize_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/quantize_x86.h",
"//third_party/libaom/source/libaom/aom_dsp/x86/blk_sse_sum_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sum_squares_sse2.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/variance_sse2.c",
]

aom_dsp_encoder_intrin_sse4_1 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/highbd_variance_sse4.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/sse_sse4.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/obmc_sad_sse4.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/obmc_variance_sse4.c",
]

aom_dsp_encoder_intrin_ssse3 = [
"//third_party/libaom/source/libaom/aom_dsp/x86/masked_sad_intrin_ssse3.h",
"//third_party/libaom/source/libaom/aom_dsp/x86/masked_sad_intrin_ssse3.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/masked_variance_intrin_ssse3.h",
"//third_party/libaom/source/libaom/aom_dsp/x86/masked_variance_intrin_ssse3.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/quantize_ssse3.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/variance_impl_ssse3.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/jnt_variance_ssse3.c",
"//third_party/libaom/source/libaom/aom_dsp/x86/jnt_sad_ssse3.c",
]

aom_dsp_encoder_sources = [
"//third_party/libaom/source/libaom/aom_dsp/binary_codes_writer.c",
"//third_party/libaom/source/libaom/aom_dsp/binary_codes_writer.h",
"//third_party/libaom/source/libaom/aom_dsp/bitwriter.h",
"//third_party/libaom/source/libaom/aom_dsp/blk_sse_sum.c",
"//third_party/libaom/source/libaom/aom_dsp/daalaboolwriter.c",
"//third_party/libaom/source/libaom/aom_dsp/daalaboolwriter.h",
"//third_party/libaom/source/libaom/aom_dsp/entenc.c",
"//third_party/libaom/source/libaom/aom_dsp/entenc.h",
"//third_party/libaom/source/libaom/aom_dsp/fwd_txfm.c",
"//third_party/libaom/source/libaom/aom_dsp/grain_table.c",
"//third_party/libaom/source/libaom/aom_dsp/grain_table.h",
"//third_party/libaom/source/libaom/aom_dsp/noise_model.c",
"//third_party/libaom/source/libaom/aom_dsp/noise_model.h",
"//third_party/libaom/source/libaom/aom_dsp/noise_util.c",
"//third_party/libaom/source/libaom/aom_dsp/noise_util.h",
"//third_party/libaom/source/libaom/aom_dsp/psnr.c",
"//third_party/libaom/source/libaom/aom_dsp/psnr.h",
"//third_party/libaom/source/libaom/aom_dsp/quantize.c",
"//third_party/libaom/source/libaom/aom_dsp/quantize.h",
"//third_party/libaom/source/libaom/aom_dsp/sad.c",
"//third_party/libaom/source/libaom/aom_dsp/sad_av1.c",
"//third_party/libaom/source/libaom/aom_dsp/sse.c",
"//third_party/libaom/source/libaom/aom_dsp/sum_squares.c",
"//third_party/libaom/source/libaom/aom_dsp/variance.c",
"//third_party/libaom/source/libaom/aom_dsp/variance.h",
]

aom_encoder_stats_sources = [
"//third_party/libaom/source/libaom/stats/aomstats.c",
"//third_party/libaom/source/libaom/stats/aomstats.h",
Expand Down
4 changes: 3 additions & 1 deletion third_party/libaom/options.gni
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import("//build/config/gclient_args.gni")

declare_args() {
# Enable decoding AV1 video files.
# Enable encoding and decoding AV1 video files.
enable_libaom = false
# To be deprecated soon.
enable_libaom_decoder = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARCH_X86_64 equ 0
CONFIG_ACCOUNTING equ 0
CONFIG_ANALYZER equ 0
CONFIG_AV1_DECODER equ 1
CONFIG_AV1_ENCODER equ 0
CONFIG_AV1_ENCODER equ 1
CONFIG_AV1_HIGHBITDEPTH equ 1
CONFIG_BIG_ENDIAN equ 0
CONFIG_BITSTREAM_DEBUG equ 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "aom/aom_codec.h"
static const char* const cfg = "cmake ../source/libaom -G \"Unix Makefiles\" -DCMAKE_TOOLCHAIN_FILE=\"../source/libaom/build/cmake/toolchains/armv7-ios.cmake\" -DCONFIG_AV1_ENCODER=0 -DCONFIG_LIBYUV=0 -DCONFIG_MAX_DECODE_PROFILE=0 -DCONFIG_NORMAL_TILE_MODE=1 -DCONFIG_SIZE_LIMIT=1 -DDECODE_HEIGHT_LIMIT=16384 -DDECODE_WIDTH_LIMIT=16384";
static const char* const cfg = "cmake ../source/libaom -G \"Unix Makefiles\" -DCMAKE_TOOLCHAIN_FILE=\"../source/libaom/build/cmake/toolchains/armv7-ios.cmake\" -DCONFIG_AV1_ENCODER=1 -DCONFIG_LIBYUV=0 -DCONFIG_MAX_DECODE_PROFILE=0 -DCONFIG_NORMAL_TILE_MODE=1 -DCONFIG_SIZE_LIMIT=1 -DDECODE_HEIGHT_LIMIT=16384 -DDECODE_WIDTH_LIMIT=16384";
const char *aom_codec_build_config(void) {return cfg;}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define CONFIG_ACCOUNTING 0
#define CONFIG_ANALYZER 0
#define CONFIG_AV1_DECODER 1
#define CONFIG_AV1_ENCODER 0
#define CONFIG_AV1_ENCODER 1
#define CONFIG_AV1_HIGHBITDEPTH 1
#define CONFIG_BIG_ENDIAN 0
#define CONFIG_BITSTREAM_DEBUG 0
Expand Down
Loading

0 comments on commit eeff987

Please sign in to comment.