1 /*
2  *  Copyright (c) 2019 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef VPX_VP9_VP9_CX_IFACE_H_
12 #define VPX_VP9_VP9_CX_IFACE_H_
13 #include "vp9/encoder/vp9_encoder.h"
14 #include "vp9/common/vp9_onyxc_int.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 VP9EncoderConfig vp9_get_encoder_config(int frame_width, int frame_height,
21                                         vpx_rational_t frame_rate,
22                                         int target_bitrate,
23                                         vpx_enc_pass enc_pass);
24 
25 void vp9_dump_encoder_config(const VP9EncoderConfig *oxcf);
26 
27 FRAME_INFO vp9_get_frame_info(const VP9EncoderConfig *oxcf);
28 
29 static INLINE int64_t
timebase_units_to_ticks(const vpx_rational64_t * timestamp_ratio,int64_t n)30 timebase_units_to_ticks(const vpx_rational64_t *timestamp_ratio, int64_t n) {
31   return n * timestamp_ratio->num / timestamp_ratio->den;
32 }
33 
34 static INLINE int64_t
ticks_to_timebase_units(const vpx_rational64_t * timestamp_ratio,int64_t n)35 ticks_to_timebase_units(const vpx_rational64_t *timestamp_ratio, int64_t n) {
36   int64_t round = timestamp_ratio->num / 2;
37   if (round > 0) --round;
38   return (n * timestamp_ratio->den + round) / timestamp_ratio->num;
39 }
40 
41 void vp9_set_first_pass_stats(VP9EncoderConfig *oxcf,
42                               const vpx_fixed_buf_t *stats);
43 
44 #ifdef __cplusplus
45 }  // extern "C"
46 #endif
47 
48 #endif  // VPX_VP9_VP9_CX_IFACE_H_
49