xref: /aosp_15_r20/external/libavc/encoder/ih264e_rate_control.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /**
22 *******************************************************************************
23 * @file
24 *  ih264e_rate_control.h
25 *
26 * @brief
27 *  This file contains declarations of api functions for h264 rate control
28 *
29 * @author
30 *  ittiam
31 *
32 * @remarks
33 *  none
34 *
35 *******************************************************************************
36 */
37 
38 #ifndef _IH264E_RATE_CONTROL_H_
39 #define _IH264E_RATE_CONTROL_H_
40 
41 /*****************************************************************************/
42 /* Function Declarations                                                     */
43 /*****************************************************************************/
44 
45 void ih264e_rc_init(void *pv_rc_api,
46                     void *pv_frame_time,
47                     void *pv_time_stamp,
48                     void *pv_pd_frm_rate,
49                     UWORD32 u4_max_frm_rate,
50                     UWORD32 u4_src_frm_rate,
51                     UWORD32 u4_tgt_frm_rate,
52                     rc_type_e e_rate_control_type,
53                     UWORD32 u4_avg_bit_rate,
54                     UWORD32 u4_peak_bit_rate,
55                     UWORD32 u4_max_delay,
56                     UWORD32 u4_intra_frame_interval,
57                     WORD32  i4_inter_frm_int,
58                     UWORD8 *pu1_init_qp,
59                     WORD32 i4_max_inter_frm_int,
60                     UWORD8 *pu1_min_max_qp,
61                     UWORD8 u1_profile_level);
62 
63 picture_type_e ih264e_rc_get_picture_details(void *pv_rc_api,
64                                              WORD32 *pi4_pic_id,
65                                              WORD32 *pi4_pic_disp_order_no);
66 
67 WORD32 ih264e_update_rc_framerates(void *ps_rate_control_api,
68                                    void *ps_pd_frm_rate,
69                                    void *ps_time_stamp,
70                                    void *ps_frame_time);
71 
72 void ih264e_update_rc_mb_info(frame_info_t *ps_frame_info, void *pv_proc);
73 
74 void ih264e_rc_get_buffer_status(void *pv_rc_api,
75                                  WORD32 i4_total_frame_bits,
76                                  picture_type_e e_pic_type,
77                                  WORD32 *pi4_num_bits_to_prevent_vbv_underflow,
78                                  UWORD8 *pu1_is_enc_buf_overflow,
79                                  UWORD8 *pu1_is_enc_buf_underflow);
80 
81 WORD32 ih264e_rc_post_enc(void *ps_rate_control_api,
82                          frame_info_t *ps_frame_info,
83                          void *ps_pd_frm_rate,
84                          void *ps_time_stamp,
85                          void *ps_frame_time,
86                          WORD32 i4_total_mb_in_frame,
87                          picture_type_e *pe_vop_coding_type,
88                          WORD32 i4_is_first_frame,
89                          WORD32 *pi4_is_post_encode_skip,
90                          UWORD8 u1_frame_qp,
91                          WORD32 *pi4_num_intra_in_prev_frame,
92                          WORD32 *pi4_avg_activity);
93 
94 void ih264e_update_rc_bits_info(frame_info_t *ps_frame_info, void *pv_entropy);
95 
96 #endif /* _IH264E_RATE_CONTROL_H_ */
97 
98