xref: /aosp_15_r20/external/libvpx/vp9/encoder/vp9_ext_ratectrl.h (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1 /*
2  *  Copyright (c) 2020 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_ENCODER_VP9_EXT_RATECTRL_H_
12 #define VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_
13 
14 #include "vpx/vpx_ext_ratectrl.h"
15 #include "vpx/vpx_tpl.h"
16 #include "vp9/encoder/vp9_firstpass.h"
17 
18 typedef struct EXT_RATECTRL {
19   int ready;
20   int ext_rdmult;
21   vpx_rc_model_t model;
22   vpx_rc_funcs_t funcs;
23   vpx_rc_config_t ratectrl_config;
24   vpx_rc_firstpass_stats_t rc_firstpass_stats;
25   FILE *log_file;
26 } EXT_RATECTRL;
27 
28 vpx_codec_err_t vp9_extrc_init(EXT_RATECTRL *ext_ratectrl);
29 
30 vpx_codec_err_t vp9_extrc_create(vpx_rc_funcs_t funcs,
31                                  vpx_rc_config_t ratectrl_config,
32                                  EXT_RATECTRL *ext_ratectrl);
33 
34 vpx_codec_err_t vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl);
35 
36 vpx_codec_err_t vp9_extrc_send_firstpass_stats(
37     EXT_RATECTRL *ext_ratectrl, const FIRST_PASS_INFO *first_pass_info);
38 
39 vpx_codec_err_t vp9_extrc_send_tpl_stats(EXT_RATECTRL *ext_ratectrl,
40                                          const VpxTplGopStats *tpl_gop_stats);
41 
42 vpx_codec_err_t vp9_extrc_get_encodeframe_decision(
43     EXT_RATECTRL *ext_ratectrl, int gop_index,
44     vpx_rc_encodeframe_decision_t *encode_frame_decision);
45 
46 vpx_codec_err_t vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl,
47                                                     int64_t bit_count,
48                                                     int actual_encoding_qindex);
49 
50 vpx_codec_err_t vp9_extrc_get_key_frame_decision(
51     EXT_RATECTRL *ext_ratectrl,
52     vpx_rc_key_frame_decision_t *key_frame_decision);
53 
54 vpx_codec_err_t vp9_extrc_get_gop_decision(EXT_RATECTRL *ext_ratectrl,
55                                            vpx_rc_gop_decision_t *gop_decision);
56 
57 vpx_codec_err_t vp9_extrc_get_frame_rdmult(
58     EXT_RATECTRL *ext_ratectrl, int show_index, int coding_index, int gop_index,
59     FRAME_UPDATE_TYPE update_type, int gop_size, int use_alt_ref,
60     RefCntBuffer *ref_frame_bufs[MAX_INTER_REF_FRAMES], int ref_frame_flags,
61     int *rdmult);
62 
63 #endif  // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_
64