summaryrefslogtreecommitdiff
path: root/vp9/simple_encode.cc
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2020-03-17 23:32:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-03-17 23:32:15 +0000
commita0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e (patch)
tree1f305d93d71342e36a653cf94c681de6f00e91f7 /vp9/simple_encode.cc
parent223645aa83091fd88473ad2ddf20f80682b60a47 (diff)
parent77c959654c7defafa6b740f37000b973c8ee202a (diff)
downloadlibvpx-a0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e.tar
libvpx-a0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e.tar.gz
libvpx-a0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e.tar.bz2
libvpx-a0765aa9f34e7f5dfa1ba938dbe9e1399a75bf5e.zip
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
Diffstat (limited to 'vp9/simple_encode.cc')
-rw-r--r--vp9/simple_encode.cc16
1 files changed, 8 insertions, 8 deletions
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);