forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This add libgav1 [1] in chromium third_party. The plan is to use OBU parser for AV1 HW decoder in chromium. That said, the sw decoder is not used in chromium immediately after this CL. [1] https://chromium.googlesource.com/codecs/libgav1/ Bug: 1000988, b:142835450 Test: compile chrome Change-Id: I14e42ca0108f96f5931adb7bcad93a1df735f437 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880887 Commit-Queue: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Max Moroz <mmoroz@chromium.org> Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Johann Koenig <johannkoenig@google.com> Cr-Commit-Position: refs/heads/master@{#737661}
- Loading branch information
Hirokazu Honda
authored and
Commit Bot
committed
Feb 3, 2020
1 parent
a00a991
commit fa7af2b
Showing
11 changed files
with
424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2019 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//third_party/libgav1/libgav1_srcs.gni") | ||
import("//third_party/libgav1/options.gni") | ||
|
||
config("libgav1_chromium_config") { | ||
include_dirs = [ | ||
"src", | ||
"src/src", | ||
] | ||
|
||
defines = [ | ||
"LIBGAV1_MAX_BITDEPTH=10", | ||
"LIBGAV1_THREADPOOL_USE_STD_MUTEX", # to avoid abseil dependency. | ||
] | ||
} | ||
|
||
if (use_libgav1) { | ||
# Separate from libgav1 because utils/constants.cc and constants.cc generates | ||
# the same object file, constants.o. | ||
source_set("libgav1_utils") { | ||
configs -= [ "//build/config/compiler:chromium_code" ] | ||
configs += [ | ||
"//build/config/compiler:no_chromium_code", | ||
":libgav1_chromium_config", | ||
] | ||
|
||
sources = gav1_utils_sources | ||
} | ||
|
||
static_library("libgav1") { | ||
configs -= [ "//build/config/compiler:chromium_code" ] | ||
configs += [ | ||
"//build/config/compiler:no_chromium_code", | ||
":libgav1_chromium_config", | ||
] | ||
|
||
public_deps = [ ":libgav1_utils" ] | ||
|
||
# TODO(hiroh): Minimize source as small as obu parser can be built. | ||
sources = gav1_common_sources | ||
sources += gav1_dsp_sources | ||
sources += gav1_gav1_sources | ||
sources += gav1_tile_sources | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tomfinegan@chromium.org | ||
johannkoenig@google.com | ||
jzern@google.com | ||
|
||
# COMPONENT: Internals>Media>Codecs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Name: libgav1 | ||
Short Name: libgav1 | ||
URL: https://chromium.googlesource.com/codecs/libgav1/ | ||
Version: 0 | ||
Date: Wednesday November 13 2019 | ||
Branch: master | ||
Commit: 16e312f5066806284b080665545aef1fa51818a4 | ||
License: Apache 2.0 | ||
License File: libgav1/LICENSE | ||
Security Critical: yes | ||
Source: https://chromium.googlesource.com/codecs/libgav1/ | ||
|
||
Description: | ||
A Main profile (0) & High profile (1) compliant AV1 decoder. | ||
|
||
Please follow these steps to update libgav1 src code | ||
1. Update the code: | ||
roll_dep.py \ | ||
-r <libgav1 OWNER> \ | ||
--log-limit 20 \ | ||
--roll-to <libvpx hash> \ | ||
src/third_party/libgav1/src | ||
|
||
Use the generated commit message for the roll. | ||
|
||
2. Generate .gni and update Date and Commit in README.chromium | ||
cd third_party/libvpx | ||
go run generate_libgav1_src_gni.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// How to run. | ||
// `go run generate_libgav1_src_gni.go.` at //third_party/libgav1. | ||
// libgav1_src.gni is generated. | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"sort" | ||
"strings" | ||
) | ||
|
||
const ( | ||
gniFile = "libgav1_srcs.gni" | ||
commonPrefix = "//third_party/libgav1/" | ||
srcDir = "./src/src" | ||
header = `# This file is generated. Do not edit.` | ||
) | ||
|
||
func getCppFiles(dir string) []string { | ||
files, err := ioutil.ReadDir(dir) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
var paths []string | ||
for _, file := range files { | ||
if file.IsDir() { | ||
paths = append(paths, getCppFiles(filepath.Join(dir, file.Name()))...) | ||
} | ||
ext := filepath.Ext(file.Name()) | ||
if ext == ".cc" || ext == ".h" { | ||
paths = append(paths, filepath.Join(dir, file.Name())) | ||
} | ||
} | ||
return paths | ||
} | ||
|
||
func getTopDirs(dir string) []string { | ||
files, _ := ioutil.ReadDir(dir) | ||
var paths []string | ||
for _, file := range files { | ||
if file.IsDir() { | ||
paths = append(paths, filepath.Join(dir, file.Name())) | ||
} | ||
} | ||
return paths | ||
} | ||
|
||
func format(dir string, files []string, file *os.File) { | ||
sourcesName := "gav1_" + dir + "_sources" | ||
fmt.Fprintf(file, "\n%s = [\n", sourcesName) | ||
for _, f := range files { | ||
fmt.Fprintf(file, " \"%s%s\",\n", commonPrefix, f) | ||
} | ||
fmt.Fprintf(file, "]\n") | ||
} | ||
|
||
func updateReadme() { | ||
gitCmd := exec.Command("bash", "-c", "git --no-pager log -1 --format=\"%cd%n%H\" --date=format:\"%A %B %d %Y\"") | ||
gitCmd.Dir = "src" | ||
out, err := gitCmd.Output() | ||
if err != nil { | ||
panic(fmt.Sprintf("failed to execute git command: %v", err)) | ||
} | ||
|
||
vals := strings.Split(string(out), "\n") | ||
|
||
if len(vals) < 2 { | ||
panic(fmt.Sprintf("unexpected git log result: %v %v", vals)) | ||
} | ||
date := vals[0] | ||
hash := vals[1] | ||
|
||
sedCmd := exec.Command("sed", "-E", "-i.back", "-e", | ||
fmt.Sprintf("s/^(Date:)[[:space:]]+.*$/\\1 %s/", date), "-e", | ||
fmt.Sprintf("s/^(Commit:)[[:space:]]+[a-f0-9]{40}/\\1 %s/", hash), | ||
"README.chromium") | ||
if err := sedCmd.Run(); err != nil { | ||
panic(fmt.Sprintf("failed to execute sed command: %v %v", sedCmd, err)) | ||
} | ||
|
||
rmCmd := exec.Command("rm", "README.chromium.back") | ||
if rmCmd.Run() != nil { | ||
panic(fmt.Sprintf("failed to execute rm command: %v", err)) | ||
} | ||
} | ||
|
||
func main() { | ||
files := getCppFiles(srcDir) | ||
topDirs := getTopDirs(srcDir) | ||
m := make(map[string][]string) | ||
for _, f := range files { | ||
found := false | ||
for _, d := range topDirs { | ||
if strings.HasPrefix(f, d) { | ||
bd := filepath.Base(d) | ||
m[bd] = append(m[bd], f) | ||
found = true | ||
break | ||
} | ||
} | ||
if !found { | ||
m["common"] = append(m["common"], f) | ||
} | ||
} | ||
|
||
if err := os.RemoveAll(gniFile); err != nil { | ||
panic(err) | ||
} | ||
|
||
file, err := os.OpenFile(gniFile, os.O_WRONLY|os.O_CREATE, 0666) | ||
if err != nil { | ||
panic(err) | ||
} | ||
fmt.Fprintf(file, "%s\n", header) | ||
|
||
var keys []string | ||
for k := range m { | ||
keys = append(keys, k) | ||
} | ||
sort.Strings(keys) | ||
|
||
for _, k := range keys { | ||
v := m[k] | ||
format(k, v, file) | ||
} | ||
|
||
updateReadme() | ||
} |
Oops, something went wrong.