diff options
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/Anandan.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/Exhaust.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/GroundTruth.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/HornSchunck.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/MotionEST.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/SearchSmooth.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/MotionEST/Util.py | 10 | ||||
-rw-r--r-- | tools/3D-Reconstruction/genY4M/genY4M.py | 9 | ||||
-rw-r--r-- | tools/non_greedy_mv/non_greedy_mv.py | 9 | ||||
-rw-r--r-- | vp9/simple_encode.cc | 16 | ||||
-rw-r--r-- | vp9/simple_encode.h | 23 |
11 files changed, 101 insertions, 26 deletions
diff --git a/tools/3D-Reconstruction/MotionEST/Anandan.py b/tools/3D-Reconstruction/MotionEST/Anandan.py index b96cd9fd0..5ff9e9893 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/Exhaust.py b/tools/3D-Reconstruction/MotionEST/Exhaust.py index 97cfc41de..2d6a4d811 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/GroundTruth.py b/tools/3D-Reconstruction/MotionEST/GroundTruth.py index 20eb5f1eb..12bc53ff7 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/HornSchunck.py b/tools/3D-Reconstruction/MotionEST/HornSchunck.py index 38fcae1e7..976bd4a17 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/MotionEST.py b/tools/3D-Reconstruction/MotionEST/MotionEST.py index a9a4acedc..0959530fa 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/SearchSmooth.py b/tools/3D-Reconstruction/MotionEST/SearchSmooth.py index e0b7fb638..2dc6771ee 100644 --- 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 diff --git a/tools/3D-Reconstruction/MotionEST/Util.py b/tools/3D-Reconstruction/MotionEST/Util.py index a5265f44e..551881cfd 100644 --- 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 diff --git a/tools/3D-Reconstruction/genY4M/genY4M.py b/tools/3D-Reconstruction/genY4M/genY4M.py index 6ef5c6c8c..8028102f0 100644 --- 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 diff --git a/tools/non_greedy_mv/non_greedy_mv.py b/tools/non_greedy_mv/non_greedy_mv.py index 513faa435..a46b7e760 100644 --- 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 diff --git a/vp9/simple_encode.cc b/vp9/simple_encode.cc index 6d9860fa8..c417a2589 100644 --- a/vp9/simple_encode.cc +++ b/vp9/simple_encode.cc @@ -123,13 +123,6 @@ static INLINE vpx_rational_t make_vpx_rational(int num, int den) { 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 @@ void SimpleEncode::StartEncode() { 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); diff --git a/vp9/simple_encode.h b/vp9/simple_encode.h index 452fc6a63..4221a7015 100644 --- a/vp9/simple_encode.h +++ b/vp9/simple_encode.h @@ -83,6 +83,7 @@ struct RefFrameInfo { // 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 @@ class SimpleEncode { // 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 @@ class SimpleEncode { 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,20 +368,13 @@ class SimpleEncode { // 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_; // 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 @@ class SimpleEncode { // frame appears? // Reference frames info of the to-be-coded frame. RefFrameInfo ref_frame_info_; - - void PostUpdateState(const EncodeFrameResult &encode_frame_result); }; } // namespace vp9 |