xref: /aosp_15_r20/external/libhevc/encoder/bit_allocation.h (revision c83a76b084498d55f252f48b2e3786804cdf24b7)
1*c83a76b0SSuyog Pawar /******************************************************************************
2*c83a76b0SSuyog Pawar  *
3*c83a76b0SSuyog Pawar  * Copyright (C) 2018 The Android Open Source Project
4*c83a76b0SSuyog Pawar  *
5*c83a76b0SSuyog Pawar  * Licensed under the Apache License, Version 2.0 (the "License");
6*c83a76b0SSuyog Pawar  * you may not use this file except in compliance with the License.
7*c83a76b0SSuyog Pawar  * You may obtain a copy of the License at:
8*c83a76b0SSuyog Pawar  *
9*c83a76b0SSuyog Pawar  * http://www.apache.org/licenses/LICENSE-2.0
10*c83a76b0SSuyog Pawar  *
11*c83a76b0SSuyog Pawar  * Unless required by applicable law or agreed to in writing, software
12*c83a76b0SSuyog Pawar  * distributed under the License is distributed on an "AS IS" BASIS,
13*c83a76b0SSuyog Pawar  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*c83a76b0SSuyog Pawar  * See the License for the specific language governing permissions and
15*c83a76b0SSuyog Pawar  * limitations under the License.
16*c83a76b0SSuyog Pawar  *
17*c83a76b0SSuyog Pawar  *****************************************************************************
18*c83a76b0SSuyog Pawar  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*c83a76b0SSuyog Pawar */
20*c83a76b0SSuyog Pawar /*!
21*c83a76b0SSuyog Pawar ******************************************************************************
22*c83a76b0SSuyog Pawar * \file bit_allocation.h
23*c83a76b0SSuyog Pawar *
24*c83a76b0SSuyog Pawar * \brief
25*c83a76b0SSuyog Pawar *    This file contain bit processing function declarations
26*c83a76b0SSuyog Pawar *
27*c83a76b0SSuyog Pawar * \date
28*c83a76b0SSuyog Pawar *
29*c83a76b0SSuyog Pawar * \author
30*c83a76b0SSuyog Pawar *    ittiam
31*c83a76b0SSuyog Pawar *
32*c83a76b0SSuyog Pawar ******************************************************************************
33*c83a76b0SSuyog Pawar */
34*c83a76b0SSuyog Pawar 
35*c83a76b0SSuyog Pawar #ifndef _BIT_ALLOCATION_H_
36*c83a76b0SSuyog Pawar #define _BIT_ALLOCATION_H_
37*c83a76b0SSuyog Pawar 
38*c83a76b0SSuyog Pawar /*****************************************************************************/
39*c83a76b0SSuyog Pawar /* Constant Macros                                                           */
40*c83a76b0SSuyog Pawar /*****************************************************************************/
41*c83a76b0SSuyog Pawar #define MIN_THRESHOLD_VBV_GOP_ERROR (0.30)
42*c83a76b0SSuyog Pawar #define MAX_THRESHOLD_VBV_GOP_ERROR (0.80)
43*c83a76b0SSuyog Pawar #define MAX_THRESHOLD_VBV_FRM_ERROR (0.80)
44*c83a76b0SSuyog Pawar 
45*c83a76b0SSuyog Pawar /*****************************************************************************/
46*c83a76b0SSuyog Pawar /* Structure                                                                 */
47*c83a76b0SSuyog Pawar /*****************************************************************************/
48*c83a76b0SSuyog Pawar typedef struct bit_allocation_t *bit_allocation_handle;
49*c83a76b0SSuyog Pawar 
50*c83a76b0SSuyog Pawar /*****************************************************************************/
51*c83a76b0SSuyog Pawar /* Function Declarations                                                     */
52*c83a76b0SSuyog Pawar /*****************************************************************************/
53*c83a76b0SSuyog Pawar WORD32 bit_allocation_num_fill_use_free_memtab(
54*c83a76b0SSuyog Pawar     bit_allocation_handle *pps_bit_allocation,
55*c83a76b0SSuyog Pawar     itt_memtab_t *ps_memtab,
56*c83a76b0SSuyog Pawar     ITT_FUNC_TYPE_E e_func_type);
57*c83a76b0SSuyog Pawar 
58*c83a76b0SSuyog Pawar void init_bit_allocation(
59*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
60*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
61*c83a76b0SSuyog Pawar     WORD32 i4_num_intra_frm_interval, /* num such intervals */
62*c83a76b0SSuyog Pawar     WORD32 i4_bit_rate, /* num bits per second */
63*c83a76b0SSuyog Pawar     WORD32 i4_frm_rate, /* num frms in 1000 seconds */
64*c83a76b0SSuyog Pawar     WORD32 *i4_peak_bit_rate,
65*c83a76b0SSuyog Pawar     WORD32 i4_min_bitrate, /* The minimum bit rate that is to be satisfied for a gop */
66*c83a76b0SSuyog Pawar     WORD32 i4_pels_in_frame,
67*c83a76b0SSuyog Pawar     WORD32 i4_is_hbr,
68*c83a76b0SSuyog Pawar     WORD32 i4_num_active_pic_type,
69*c83a76b0SSuyog Pawar     WORD32 i4_lap_window,
70*c83a76b0SSuyog Pawar     WORD32 i4_field_pic,
71*c83a76b0SSuyog Pawar     WORD32 rc_pass,
72*c83a76b0SSuyog Pawar     WORD32 i4_luma_pels,
73*c83a76b0SSuyog Pawar     WORD32 i4_enable_look_ahead);
74*c83a76b0SSuyog Pawar 
75*c83a76b0SSuyog Pawar LWORD64 ba_get_rbip_and_num_frames(
76*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
77*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
78*c83a76b0SSuyog Pawar     WORD32 *pi4_num_frames);
79*c83a76b0SSuyog Pawar void assign_complexity_coeffs(
80*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, float af_sum_weigh[MAX_PIC_TYPE][3]);
81*c83a76b0SSuyog Pawar 
82*c83a76b0SSuyog Pawar void init_prev_header_bits(
83*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, pic_handling_handle ps_pic_handling);
84*c83a76b0SSuyog Pawar /* Estimates the number of texture bits required by the current frame */
85*c83a76b0SSuyog Pawar WORD32 get_cur_frm_est_texture_bits(
86*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
87*c83a76b0SSuyog Pawar     rc_rd_model_handle *pps_rd_model,
88*c83a76b0SSuyog Pawar     est_sad_handle ps_est_sad,
89*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
90*c83a76b0SSuyog Pawar     cbr_buffer_handle ps_cbr_buffer,
91*c83a76b0SSuyog Pawar     picture_type_e e_pic_type,
92*c83a76b0SSuyog Pawar     WORD32 i4_use_model,
93*c83a76b0SSuyog Pawar     WORD32 i4_is_scd_frame,
94*c83a76b0SSuyog Pawar     WORD32 i4_call_type,
95*c83a76b0SSuyog Pawar     float i_to_avg_ratio,
96*c83a76b0SSuyog Pawar     WORD32 i4_is_model_valid);
97*c83a76b0SSuyog Pawar 
98*c83a76b0SSuyog Pawar WORD32 bit_alloc_get_intra_bits(
99*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
100*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
101*c83a76b0SSuyog Pawar     cbr_buffer_handle ps_cbr_buf_handling,
102*c83a76b0SSuyog Pawar     picture_type_e e_pic_type,
103*c83a76b0SSuyog Pawar     number_t *pvq_complexity_estimate,
104*c83a76b0SSuyog Pawar     WORD32 i4_is_scd,
105*c83a76b0SSuyog Pawar     float scd_ratio,
106*c83a76b0SSuyog Pawar     WORD32 i4_call_type,
107*c83a76b0SSuyog Pawar     WORD32 i4_non_I_scd,
108*c83a76b0SSuyog Pawar     float f_percent_head_bits);
109*c83a76b0SSuyog Pawar 
110*c83a76b0SSuyog Pawar /* Estimate the number of header bits required by the current frame */
111*c83a76b0SSuyog Pawar WORD32
112*c83a76b0SSuyog Pawar     get_cur_frm_est_header_bits(bit_allocation_handle ps_bit_allocation, picture_type_e e_pic_type);
113*c83a76b0SSuyog Pawar 
114*c83a76b0SSuyog Pawar /* Get the remaining bits allocated in the period */
115*c83a76b0SSuyog Pawar WORD32 get_rem_bits_in_period(
116*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, pic_handling_handle ps_pic_handling);
117*c83a76b0SSuyog Pawar 
118*c83a76b0SSuyog Pawar WORD32 ba_get_frame_rate(bit_allocation_handle ps_bit_allocation);
119*c83a76b0SSuyog Pawar 
120*c83a76b0SSuyog Pawar WORD32 get_bits_per_frame(bit_allocation_handle ps_bit_allocation);
121*c83a76b0SSuyog Pawar 
122*c83a76b0SSuyog Pawar WORD32 ba_get_bit_rate(bit_allocation_handle ps_bit_allocation);
123*c83a76b0SSuyog Pawar void ba_get_peak_bit_rate(bit_allocation_handle ps_bit_allocation, WORD32 *pi4_peak_bit_rate);
124*c83a76b0SSuyog Pawar 
125*c83a76b0SSuyog Pawar LWORD64 ba_get_buffer_play_bits_for_cur_gop(bit_allocation_handle ps_bit_allocation);
126*c83a76b0SSuyog Pawar LWORD64 ba_get_gop_bits(bit_allocation_handle ps_bit_allocation);
127*c83a76b0SSuyog Pawar LWORD64 ba_get_gop_sad(bit_allocation_handle ps_bit_allocation);
128*c83a76b0SSuyog Pawar 
129*c83a76b0SSuyog Pawar /* Updates the bit allocation module with the actual encoded values */
130*c83a76b0SSuyog Pawar void update_cur_frm_consumed_bits(
131*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
132*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
133*c83a76b0SSuyog Pawar     cbr_buffer_handle ps_cbr_buf_handle,
134*c83a76b0SSuyog Pawar     WORD32 i4_total_frame_bits,
135*c83a76b0SSuyog Pawar     WORD32 i4_model_updation_hdr_bits,
136*c83a76b0SSuyog Pawar     picture_type_e e_pic_type,
137*c83a76b0SSuyog Pawar     UWORD8 u1_is_scd,
138*c83a76b0SSuyog Pawar     WORD32 i4_last_frm_in_gop,
139*c83a76b0SSuyog Pawar     WORD32 i4_lap_comp_bits_reset,
140*c83a76b0SSuyog Pawar     WORD32 i4_suppress_bpic_update,
141*c83a76b0SSuyog Pawar     WORD32 i4_buffer_based_bit_error,
142*c83a76b0SSuyog Pawar     WORD32 i4_stuff_bits,
143*c83a76b0SSuyog Pawar     WORD32 i4_lap_window_comp,
144*c83a76b0SSuyog Pawar     rc_type_e e_rc_type,
145*c83a76b0SSuyog Pawar     WORD32 i4_num_gop,
146*c83a76b0SSuyog Pawar     WORD32 i4_is_pause_to_resume,
147*c83a76b0SSuyog Pawar     WORD32 i4_est_text_bits_ctr_update_qp,
148*c83a76b0SSuyog Pawar     WORD32 *pi4_gop_correction,
149*c83a76b0SSuyog Pawar     WORD32 *pi4_new_correction);
150*c83a76b0SSuyog Pawar 
151*c83a76b0SSuyog Pawar void check_and_update_bit_allocation(
152*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
153*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
154*c83a76b0SSuyog Pawar     WORD32 i4_max_bits_inflow_per_frm);
155*c83a76b0SSuyog Pawar 
156*c83a76b0SSuyog Pawar /* Based on the change in frame/bit rate update the remaining bits in period */
157*c83a76b0SSuyog Pawar void change_remaining_bits_in_period(
158*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
159*c83a76b0SSuyog Pawar     WORD32 i4_bit_rate,
160*c83a76b0SSuyog Pawar     WORD32 i4_frame_rate,
161*c83a76b0SSuyog Pawar     WORD32 *i4_peak_bit_rate);
162*c83a76b0SSuyog Pawar 
163*c83a76b0SSuyog Pawar /* Change the gop size in the middle of a current gop */
164*c83a76b0SSuyog Pawar void change_gop_size(
165*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
166*c83a76b0SSuyog Pawar     WORD32 i4_intra_frm_interval,
167*c83a76b0SSuyog Pawar     WORD32 i4_inter_frm_interval,
168*c83a76b0SSuyog Pawar     WORD32 i4_num_intra_frm_interval);
169*c83a76b0SSuyog Pawar 
170*c83a76b0SSuyog Pawar void update_rem_frms_in_period(
171*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
172*c83a76b0SSuyog Pawar     picture_type_e e_pic_type,
173*c83a76b0SSuyog Pawar     UWORD8 u1_is_first_frm,
174*c83a76b0SSuyog Pawar     WORD32 i4_intra_frm_interval,
175*c83a76b0SSuyog Pawar     WORD32 i4_num_intra_frm_interval);
176*c83a76b0SSuyog Pawar 
177*c83a76b0SSuyog Pawar void change_rem_bits_in_prd_at_force_I_frame(
178*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, pic_handling_handle ps_pic_handling);
179*c83a76b0SSuyog Pawar 
180*c83a76b0SSuyog Pawar void change_ba_peak_bit_rate(bit_allocation_handle ps_bit_allocation, WORD32 *ai4_peak_bit_rate);
181*c83a76b0SSuyog Pawar 
182*c83a76b0SSuyog Pawar void init_intra_header_bits(bit_allocation_handle ps_bit_allocation, WORD32 i4_intra_header_bits);
183*c83a76b0SSuyog Pawar WORD32 get_prev_header_bits(bit_allocation_handle ps_bit_allocation, WORD32 pic_type);
184*c83a76b0SSuyog Pawar void set_Kp_Kb_for_hi_motion(bit_allocation_handle ps_bit_allocation);
185*c83a76b0SSuyog Pawar 
186*c83a76b0SSuyog Pawar void ba_get_qp_offset_offline_data(
187*c83a76b0SSuyog Pawar     WORD32 ai4_offsets[5],
188*c83a76b0SSuyog Pawar     WORD32 i4_ratio,
189*c83a76b0SSuyog Pawar     float f_ratio,
190*c83a76b0SSuyog Pawar     WORD32 i4_num_active_pic_type,
191*c83a76b0SSuyog Pawar     WORD32 *pi4_complexity_bin);
192*c83a76b0SSuyog Pawar 
193*c83a76b0SSuyog Pawar void reset_Kp_Kb(
194*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
195*c83a76b0SSuyog Pawar     float f_i_to_avg_ratio,
196*c83a76b0SSuyog Pawar     WORD32 i4_num_active_pic_type,
197*c83a76b0SSuyog Pawar     float f_hme_sad_per_pixel,
198*c83a76b0SSuyog Pawar     float f_max_hme_sad_per_pixel,
199*c83a76b0SSuyog Pawar     WORD32 *pi4_complexity_bin,
200*c83a76b0SSuyog Pawar     WORD32 i4_rc_pass);
201*c83a76b0SSuyog Pawar 
202*c83a76b0SSuyog Pawar WORD32 get_Kp_Kb(bit_allocation_handle ps_bit_allocation, picture_type_e e_pic_type);
203*c83a76b0SSuyog Pawar 
204*c83a76b0SSuyog Pawar /*get total bits for scene cut frame*/
205*c83a76b0SSuyog Pawar WORD32 get_scene_change_tot_frm_bits(
206*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
207*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
208*c83a76b0SSuyog Pawar     cbr_buffer_handle ps_cbr_buf_handling,
209*c83a76b0SSuyog Pawar     WORD32 i4_num_pixels,
210*c83a76b0SSuyog Pawar     WORD32 i4_f_sim_lap,
211*c83a76b0SSuyog Pawar     float i_to_avg_rest,
212*c83a76b0SSuyog Pawar     WORD32 i4_call_type,
213*c83a76b0SSuyog Pawar     WORD32 i4_non_I_scd,
214*c83a76b0SSuyog Pawar     WORD32 i4_is_infinite_gop);
215*c83a76b0SSuyog Pawar 
216*c83a76b0SSuyog Pawar void update_estimate_status(
217*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
218*c83a76b0SSuyog Pawar     WORD32 i4_est_texture_bits,
219*c83a76b0SSuyog Pawar     WORD32 i4_hdr_bits,
220*c83a76b0SSuyog Pawar     WORD32 i4_est_text_bits_ctr_get_qp);
221*c83a76b0SSuyog Pawar 
222*c83a76b0SSuyog Pawar void bit_allocation_set_num_scd_lap_window(
223*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
224*c83a76b0SSuyog Pawar     WORD32 i4_num_scd_in_lap_window,
225*c83a76b0SSuyog Pawar     WORD32 i4_next_sc_i_in_rc_look_ahead);
226*c83a76b0SSuyog Pawar 
227*c83a76b0SSuyog Pawar void bit_allocation_set_sc_i_in_rc_look_ahead(
228*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, WORD32 i4_num_scd_in_lap_window);
229*c83a76b0SSuyog Pawar 
230*c83a76b0SSuyog Pawar /*updates gop based bit error entropy and rdopt estimate*/
231*c83a76b0SSuyog Pawar void bit_allocation_update_gop_level_bit_error(
232*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, WORD32 i4_error_bits);
233*c83a76b0SSuyog Pawar /*
234*c83a76b0SSuyog Pawar The parsing of stat file is done at the end of init (by that time bit allocation init would have already happened,
235*c83a76b0SSuyog Pawar The memory for gop stat data is alocated inside the parse stat file code. Hence the pointer has to be updated again
236*c83a76b0SSuyog Pawar */
237*c83a76b0SSuyog Pawar 
238*c83a76b0SSuyog Pawar void ba_init_stat_data(
239*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
240*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handling,
241*c83a76b0SSuyog Pawar     void *pv_gop_stat,
242*c83a76b0SSuyog Pawar     WORD32 *pi4_pic_dist_in_cur_gop,
243*c83a76b0SSuyog Pawar     WORD32 i4_total_bits_in_period,
244*c83a76b0SSuyog Pawar     WORD32 i4_excess_bits);
245*c83a76b0SSuyog Pawar 
246*c83a76b0SSuyog Pawar void get_prev_frame_total_header_bits(
247*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
248*c83a76b0SSuyog Pawar     WORD32 *pi4_prev_frame_total_bits,
249*c83a76b0SSuyog Pawar     WORD32 *pi4_prev_frame_header_bits,
250*c83a76b0SSuyog Pawar     picture_type_e e_pic_type);
251*c83a76b0SSuyog Pawar 
252*c83a76b0SSuyog Pawar void rc_update_bit_distribution_gop_level_2pass(
253*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
254*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handle,
255*c83a76b0SSuyog Pawar     void *pv_gop_stat,
256*c83a76b0SSuyog Pawar     rc_type_e e_rc_type,
257*c83a76b0SSuyog Pawar     WORD32 i4_num_gop,
258*c83a76b0SSuyog Pawar     WORD32 i4_start_gop_number,
259*c83a76b0SSuyog Pawar     float f_avg_qscale_first_pass,
260*c83a76b0SSuyog Pawar     WORD32 i4_max_ebf,
261*c83a76b0SSuyog Pawar     WORD32 i4_ebf,
262*c83a76b0SSuyog Pawar     LWORD64 i8_tot_bits_sequence,
263*c83a76b0SSuyog Pawar     WORD32 i4_comp_error);
264*c83a76b0SSuyog Pawar 
265*c83a76b0SSuyog Pawar LWORD64 bit_alloc_get_gop_num(bit_allocation_handle ps_bit_allocation);
266*c83a76b0SSuyog Pawar 
267*c83a76b0SSuyog Pawar float get_cur_peak_factor_2pass(bit_allocation_handle ps_bit_allocation);
268*c83a76b0SSuyog Pawar float get_cur_min_complexity_factor_2pass(bit_allocation_handle ps_bit_allocation);
269*c83a76b0SSuyog Pawar 
270*c83a76b0SSuyog Pawar void set_2pass_total_gops(bit_allocation_handle ps_bit_allocation, WORD32 i4_num_gop);
271*c83a76b0SSuyog Pawar WORD32 ba_get_min_bits_per_frame(bit_allocation_handle ps_bit_allocation);
272*c83a76b0SSuyog Pawar 
273*c83a76b0SSuyog Pawar void set_bit_allocation_i_frames(
274*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation,
275*c83a76b0SSuyog Pawar     cbr_buffer_handle ps_cbr_buffer,
276*c83a76b0SSuyog Pawar     pic_handling_handle ps_pic_handle,
277*c83a76b0SSuyog Pawar     WORD32 i4_lap_window_comp,
278*c83a76b0SSuyog Pawar     WORD32 i4_num_frames);
279*c83a76b0SSuyog Pawar 
280*c83a76b0SSuyog Pawar void bit_alloc_set_curr_i_to_sum_i(bit_allocation_handle ps_bit_allocation, float f_i_to_sum);
281*c83a76b0SSuyog Pawar 
282*c83a76b0SSuyog Pawar void ba_set_gop_stat_in_bit_alloc(
283*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, void *pv_gop_stat_summary);
284*c83a76b0SSuyog Pawar 
285*c83a76b0SSuyog Pawar WORD32 ba_get_luma_pels(bit_allocation_handle ps_bit_allocation);
286*c83a76b0SSuyog Pawar 
287*c83a76b0SSuyog Pawar void overflow_avoided_summation(WORD32 *pi4_accumulator, WORD32 i4_input);
288*c83a76b0SSuyog Pawar 
289*c83a76b0SSuyog Pawar float ba_get_sum_complexity_segment_cross_peak(bit_allocation_handle ps_bit_allocation);
290*c83a76b0SSuyog Pawar 
291*c83a76b0SSuyog Pawar WORD32 ba_get_prev_frame_tot_est_bits(bit_allocation_handle ps_bit_allocation, WORD32 i4_pic);
292*c83a76b0SSuyog Pawar 
293*c83a76b0SSuyog Pawar WORD32 ba_get_prev_frame_tot_bits(bit_allocation_handle ps_bit_allocation, WORD32 i4_pic);
294*c83a76b0SSuyog Pawar 
295*c83a76b0SSuyog Pawar void ba_set_avg_qscale_first_pass(
296*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, float f_average_qscale_1st_pass);
297*c83a76b0SSuyog Pawar 
298*c83a76b0SSuyog Pawar void ba_set_max_avg_qscale_first_pass(
299*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, float f_average_qscale_1st_pass);
300*c83a76b0SSuyog Pawar 
301*c83a76b0SSuyog Pawar float ba_get_max_avg_qscale_first_pass(bit_allocation_handle ps_bit_allocation);
302*c83a76b0SSuyog Pawar 
303*c83a76b0SSuyog Pawar float ba_get_avg_qscale_first_pass(bit_allocation_handle ps_bit_allocation);
304*c83a76b0SSuyog Pawar 
305*c83a76b0SSuyog Pawar float ba_get_min_complexity_for_peak_br(
306*c83a76b0SSuyog Pawar     WORD32 i4_peak_bit_rate,
307*c83a76b0SSuyog Pawar     WORD32 i4_bit_rate,
308*c83a76b0SSuyog Pawar     float f_peak_rate_factor,
309*c83a76b0SSuyog Pawar     float f_max_val,
310*c83a76b0SSuyog Pawar     float f_min_val,
311*c83a76b0SSuyog Pawar     WORD32 i4_pass);
312*c83a76b0SSuyog Pawar 
313*c83a76b0SSuyog Pawar float ba_gop_info_average_qscale_gop_without_offset(bit_allocation_handle ps_bit_allocation);
314*c83a76b0SSuyog Pawar 
315*c83a76b0SSuyog Pawar float ba_get_qscale_max_clip_in_second_pass(bit_allocation_handle ps_bit_allocation);
316*c83a76b0SSuyog Pawar 
317*c83a76b0SSuyog Pawar float ba_gop_info_average_qscale_gop(bit_allocation_handle ps_bit_allocation);
318*c83a76b0SSuyog Pawar WORD32 ba_get_frame_number_in_gop(bit_allocation_handle ps_bit_allocation);
319*c83a76b0SSuyog Pawar 
320*c83a76b0SSuyog Pawar void bit_alloc_set_2pass_total_frames(
321*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, WORD32 i4_total_2pass_frames);
322*c83a76b0SSuyog Pawar 
323*c83a76b0SSuyog Pawar WORD32 ba_get_2pass_total_frames(bit_allocation_handle ps_bit_allocation);
324*c83a76b0SSuyog Pawar 
325*c83a76b0SSuyog Pawar WORD32 ba_get_2pass_bit_rate(bit_allocation_handle ps_bit_allocation);
326*c83a76b0SSuyog Pawar 
327*c83a76b0SSuyog Pawar void ba_set_2pass_bit_rate(bit_allocation_handle ps_bit_allocation, WORD32 i4_2pass_bit_rate);
328*c83a76b0SSuyog Pawar 
329*c83a76b0SSuyog Pawar void ba_set_2pass_avg_bit_rate(
330*c83a76b0SSuyog Pawar     bit_allocation_handle ps_bit_allocation, LWORD64 i8_2pass_avg_bit_rate);
331*c83a76b0SSuyog Pawar 
332*c83a76b0SSuyog Pawar void ba_set_enable_look_ahead(bit_allocation_handle ps_bit_allocation, WORD32 i4_enable_look_ahead);
333*c83a76b0SSuyog Pawar #endif
334