summaryrefslogtreecommitdiffstats
path: root/encoder/irc_rate_control_api_structs.h
blob: ba39e7f14d2e52b162df0f68d3a370ff09c75fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/******************************************************************************
 *
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/

#ifndef _RATE_CONTROL_API_STRUCTS_H_
#define _RATE_CONTROL_API_STRUCTS_H_

/*
 * The following definitions were present in irc_cntrl_param.h, moved to this
 * file as it is used by irc_rate_control_api.c
 */

/* num_frm_in_period = BIT_ALLOC_PERIOD*intra_frame_interval */
#define VBR_BIT_ALLOC_PERIOD 3
#define CBR_BIT_ALLOC_PERIOD 1

/* Rate control state structure */
typedef struct rate_control_api_t
{
    /* RC Algorithm */
    rc_type_e e_rc_type;

    /* Whether MB level rc is enabled or not */
    UWORD8 u1_is_mb_level_rc_on;

    /* Picture handling struct */
    pic_handling_handle ps_pic_handling;

    /* Model struct for I and P frms */
    rc_rd_model_handle aps_rd_model[MAX_PIC_TYPE];

    /* VBR storage VBV structure */
    vbr_storage_vbv_handle ps_vbr_storage_vbv;

    /* Calculate the estimated SAD */
    est_sad_handle ps_est_sad;

    /* Allocation of bits for each frame */
    bit_allocation_handle ps_bit_allocation;

    /* Init Qp(also used for Const Qp scenarios) */
    UWORD8 au1_init_qp[MAX_PIC_TYPE];

    /* MB Level rate control state structure */
    mb_rate_control_handle ps_mb_rate_control;

    UWORD8 au1_is_first_frm_coded[MAX_PIC_TYPE];

    UWORD8 au1_prev_frm_qp[MAX_PIC_TYPE];

    cbr_buffer_handle ps_cbr_buffer;

    UWORD8 u1_scd_detected;

    UWORD8 u1_frm_qp_after_scd;

    UWORD8 au1_avg_bitrate_changed[MAX_PIC_TYPE];

    UWORD8 u1_is_first_frm;

    UWORD8 au1_min_max_qp[(MAX_PIC_TYPE << 1)];

    WORD32 i4_prev_frm_est_bits;

    vbr_str_prms_t s_vbr_str_prms;

    /* Store the values which are to be impacted after a delay */
    UWORD32 u4_frms_in_delay_prd_for_peak_bit_rate_change;

    UWORD32 au4_new_peak_bit_rate[MAX_NUM_DRAIN_RATES];

    picture_type_e prev_ref_pic_type;

} rate_control_api_t;

#endif/*_RATE_CONTROL_API_STRUCTS_H_*/