blob: ba39e7f14d2e52b162df0f68d3a370ff09c75fc0 [file] [log] [blame]
Hamsalekha S8d3d3032015-03-13 21:24:58 +05301/******************************************************************************
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#ifndef _RATE_CONTROL_API_STRUCTS_H_
22#define _RATE_CONTROL_API_STRUCTS_H_
23
24/*
25 * The following definitions were present in irc_cntrl_param.h, moved to this
26 * file as it is used by irc_rate_control_api.c
27 */
28
29/* num_frm_in_period = BIT_ALLOC_PERIOD*intra_frame_interval */
30#define VBR_BIT_ALLOC_PERIOD 3
31#define CBR_BIT_ALLOC_PERIOD 1
32
33/* Rate control state structure */
34typedef struct rate_control_api_t
35{
36 /* RC Algorithm */
37 rc_type_e e_rc_type;
38
39 /* Whether MB level rc is enabled or not */
40 UWORD8 u1_is_mb_level_rc_on;
41
42 /* Picture handling struct */
43 pic_handling_handle ps_pic_handling;
44
45 /* Model struct for I and P frms */
46 rc_rd_model_handle aps_rd_model[MAX_PIC_TYPE];
47
48 /* VBR storage VBV structure */
49 vbr_storage_vbv_handle ps_vbr_storage_vbv;
50
51 /* Calculate the estimated SAD */
52 est_sad_handle ps_est_sad;
53
54 /* Allocation of bits for each frame */
55 bit_allocation_handle ps_bit_allocation;
56
57 /* Init Qp(also used for Const Qp scenarios) */
58 UWORD8 au1_init_qp[MAX_PIC_TYPE];
59
60 /* MB Level rate control state structure */
61 mb_rate_control_handle ps_mb_rate_control;
62
63 UWORD8 au1_is_first_frm_coded[MAX_PIC_TYPE];
64
65 UWORD8 au1_prev_frm_qp[MAX_PIC_TYPE];
66
67 cbr_buffer_handle ps_cbr_buffer;
68
69 UWORD8 u1_scd_detected;
70
71 UWORD8 u1_frm_qp_after_scd;
72
73 UWORD8 au1_avg_bitrate_changed[MAX_PIC_TYPE];
74
75 UWORD8 u1_is_first_frm;
76
77 UWORD8 au1_min_max_qp[(MAX_PIC_TYPE << 1)];
78
79 WORD32 i4_prev_frm_est_bits;
80
81 vbr_str_prms_t s_vbr_str_prms;
82
83 /* Store the values which are to be impacted after a delay */
84 UWORD32 u4_frms_in_delay_prd_for_peak_bit_rate_change;
85
86 UWORD32 au4_new_peak_bit_rate[MAX_NUM_DRAIN_RATES];
87
88 picture_type_e prev_ref_pic_type;
89
90} rate_control_api_t;
91
92#endif/*_RATE_CONTROL_API_STRUCTS_H_*/
93