huangcm
2024-08-23 d76fb8c8c6d079a3cee81da7072347dcb8bbbc70
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/******************************************************************************
 *
 * Copyright (C) 2018 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
*/
/*!
******************************************************************************
* \file rc_cntrl_param.h
*
* \brief
*    This file should contain only enumerations and macros exported to codec
*    by RC
*
* \date
*
* \author
*    ittiam
*
******************************************************************************
*/
 
#ifndef _RC_CNTRL_PARAM_H_
#define _RC_CNTRL_PARAM_H_
 
/*****************************************************************************/
/* Constant Macros                                                           */
/*****************************************************************************/
#define QSCALE_Q_FAC 6
#define QSCALE_Q_FAC_3 3
 
/*corresponds to hevc qp = 4, not letting it go below 4 for better stability*/
#define MIN_QSCALE_Q6 64
 
#define INVALID_QP (-55)
#define SCD_MIN_HEVC_QP 18
 
/*For very high bitrate reduce min qp limit*/
#define SCD_MIN_HEVC_QP_HBR 14
#define SCD_MIN_HEVC_QP_VHBR 10
 
#define SCD_MAX_HEVC_QP 48
#define MAX_HEVC_QP 51
 
/*classification based on i_to_average rest ratio so that appropriate qp offset can be chosen*/
#define I_TO_REST_EXTREME_FAST (1.5)
#define I_TO_REST_VVFAST (3)
#define I_TO_REST_VFAST (5)
#define I_TO_REST_FAST (8)
#define I_TO_REST_MEDI (10)
#define I_TO_REST_SLOW (14)
 
#define MAX_NUM_FRAME_PARALLEL 8
 
/*****************************************************************************/
/* Enums                                                                     */
/*****************************************************************************/
/* RC algo type */
typedef enum
{
    VBR_STORAGE = 0,
    VBR_STORAGE_DVD_COMP = 1,
    VBR_STREAMING = 2,
    CONST_QP = 3,
    CBR_LDRC = 4,
    CBR_NLDRC = 5,
    CBR_NLDRC_HBR = 6,
    MAX_RC_TYPE
} rc_type_e;
 
/**/
typedef enum
{
    FIELD_OFFSET = 4
} field_offset_e;
 
/* Picture type structure*/
typedef enum
{
    BUF_PIC = -1,
    I_PIC = 0,
    P_PIC,
    B_PIC,
    B1_PIC,
    B2_PIC,
    P1_PIC,
    BB_PIC,
    B11_PIC,
    B22_PIC,
    MAX_PIC_TYPE
} picture_type_e;
 
typedef enum
{
    I_PIC_SCD = 0x100,
    NA_PIC
} picture_type_SCD;
 
/* MB Type structure*/
typedef enum
{
    MB_TYPE_INTRA,
    MB_TYPE_INTER,
    MAX_MB_TYPE /* Based on MB TYPES added the array size increases */
} mb_type_e;
 
typedef enum
{
    VBV_NORMAL,
    VBV_UNDERFLOW,
    VBV_OVERFLOW,
    VBR_CAUTION
} vbv_buf_status_e;
 
#endif