ref: a0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e
parent: 223645aa83091fd88473ad2ddf20f80682b60a47
parent: 77c959654c7defafa6b740f37000b973c8ee202a
author: Angie Chiang <angiebird@google.com>
date: Tue Mar 17 19:32:15 EDT 2020
Merge changes I8a14fcad,Iad7ca261,I2063c592,I9c5c74ab * changes: Correct time_base of ivf header in SimpleEncode Add detail comments on valid_list in SimpleEncode Add missing Copyright to python files Move member functions up in simple_encode.h
--- a/tools/3D-Reconstruction/MotionEST/Anandan.py
+++ b/tools/3D-Reconstruction/MotionEST/Anandan.py
@@ -1,4 +1,12 @@
-#!/usr/bin/env python
+## Copyright (c) 2020 The WebM 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.
+##
+
# coding: utf-8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/Exhaust.py
+++ b/tools/3D-Reconstruction/MotionEST/Exhaust.py
@@ -1,4 +1,12 @@
-#!/usr/bin/env python
+## Copyright (c) 2020 The WebM 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.
+##
+
# coding: utf-8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/GroundTruth.py
+++ b/tools/3D-Reconstruction/MotionEST/GroundTruth.py
@@ -1,4 +1,12 @@
-#!/ usr / bin / env python
+## Copyright (c) 2020 The WebM 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.
+##
+
#coding : utf - 8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/HornSchunck.py
+++ b/tools/3D-Reconstruction/MotionEST/HornSchunck.py
@@ -1,4 +1,12 @@
-#!/usr/bin/env python
+## Copyright (c) 2020 The WebM 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.
+##
+
# coding: utf-8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/MotionEST.py
+++ b/tools/3D-Reconstruction/MotionEST/MotionEST.py
@@ -1,4 +1,12 @@
-#!/ usr / bin / env python
+## Copyright (c) 2020 The WebM 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.
+##
+
#coding : utf - 8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/SearchSmooth.py
+++ b/tools/3D-Reconstruction/MotionEST/SearchSmooth.py
@@ -1,4 +1,12 @@
-#!/usr/bin/env python
+## Copyright (c) 2020 The WebM 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.
+##
+
# coding: utf-8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/MotionEST/Util.py
+++ b/tools/3D-Reconstruction/MotionEST/Util.py
@@ -1,4 +1,12 @@
-#!/usr/bin/env python
+## Copyright (c) 2020 The WebM 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.
+##
+
# coding: utf-8
import numpy as np
import numpy.linalg as LA
--- a/tools/3D-Reconstruction/genY4M/genY4M.py
+++ b/tools/3D-Reconstruction/genY4M/genY4M.py
@@ -1,3 +1,12 @@
+## Copyright (c) 2020 The WebM 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 argparse
from os import listdir, path
from PIL import Image
--- a/tools/non_greedy_mv/non_greedy_mv.py
+++ b/tools/non_greedy_mv/non_greedy_mv.py
@@ -1,3 +1,12 @@
+## Copyright (c) 2020 The WebM 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 sys
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -123,13 +123,6 @@
return v;
}
-static INLINE vpx_rational_t invert_vpx_rational(vpx_rational_t v) {
- vpx_rational_t inverse_v;
- inverse_v.num = v.den;
- inverse_v.den = v.num;
- return inverse_v;
-}
-
static INLINE FrameType
get_frame_type_from_update_type(FRAME_UPDATE_TYPE update_type) {
switch (update_type) {
@@ -852,7 +845,14 @@
if (out_file_ != nullptr) {
const char *fourcc = "VP90";
- vpx_rational_t time_base = invert_vpx_rational(frame_rate);
+ // In SimpleEncode, we use time_base = 1 / TICKS_PER_SEC.
+ // Based on that, the ivf_timestamp for each image is set to
+ // show_idx * TICKS_PER_SEC / frame_rate
+ // such that each image's actual timestamp in seconds can be computed as
+ // ivf_timestamp * time_base == show_idx / frame_rate
+ // TODO(angiebird): 1) Add unit test for ivf timestamp.
+ // 2) Simplify the frame_rate setting process.
+ vpx_rational_t time_base = make_vpx_rational(1, TICKS_PER_SEC);
ivf_write_file_header_with_video_info(out_file_, *(const uint32_t *)fourcc,
num_frames_, frame_width_,
frame_height_, time_base);
--- a/vp9/simple_encode.h
+++ b/vp9/simple_encode.h
@@ -83,6 +83,7 @@
// kRefFrameTypeLast > kRefFrameTypePast > kRefFrameTypeFuture.
// For example, if kRefFrameTypeLast and kRefFrameTypePast both point to the
// same frame, kRefFrameTypePast will be set to invalid.
+ // 1: the ref frame type is available 0: the ref frame type is not available
int valid_list[kRefFrameTypeMax];
};
@@ -297,7 +298,7 @@
// Therefore it also determines the group of picture size.
// If set, VP9 will use the external arf index to make decision.
// This function should be called only once after ComputeFirstPassStats(),
- // before StartEncde().
+ // before StartEncode().
void SetExternalGroupOfPicture(std::vector<int> external_arf_indexes);
// Initializes the encoder for actual encoding.
@@ -340,6 +341,15 @@
uint64_t GetFramePixelCount() const;
private:
+ // Updates key_frame_group_size_, reset key_frame_group_index_ and init
+ // ref_frame_info_.
+ void UpdateKeyFrameGroup(int key_frame_show_index);
+
+ // Update key_frame_group_index_.
+ void PostUpdateKeyFrameGroupIndex(FrameType frame_type);
+
+ void PostUpdateState(const EncodeFrameResult &encode_frame_result);
+
class EncodeImpl;
int frame_width_; // frame width in pixels.
@@ -358,7 +368,7 @@
// The key frame group size includes one key frame plus the number of
// following inter frames. Note that the key frame group size only counts the
- // show frames. The number of no show frames like alternate refereces are not
+ // show frames. The number of no show frames like alternate references are not
// counted.
int key_frame_group_size_;
@@ -365,13 +375,6 @@
// The index for the to-be-coded show frame in the key frame group.
int key_frame_group_index_;
- // Update key_frame_group_size_, reset key_frame_group_index_ and init
- // ref_frame_info_.
- void UpdateKeyFrameGroup(int key_frame_show_index);
-
- // Update key_frame_group_index_.
- void PostUpdateKeyFrameGroupIndex(FrameType frame_type);
-
// Each show or no show frame is assigned with a coding index based on its
// coding order (starting from zero) in the coding process of the entire
// video. The coding index of the to-be-coded frame.
@@ -384,8 +387,6 @@
// frame appears?
// Reference frames info of the to-be-coded frame.
RefFrameInfo ref_frame_info_;
-
- void PostUpdateState(const EncodeFrameResult &encode_frame_result);
};
} // namespace vp9