Home | History | Annotate | Download | only in encoder
      1 /******************************************************************************
      2  *
      3  * Copyright (C) 2018 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 * \file rc_cntrl_param.h
     23 *
     24 * \brief
     25 *    This file should contain only enumerations and macros exported to codec
     26 *    by RC
     27 *
     28 * \date
     29 *
     30 * \author
     31 *    ittiam
     32 *
     33 ******************************************************************************
     34 */
     35 
     36 #ifndef _RC_CNTRL_PARAM_H_
     37 #define _RC_CNTRL_PARAM_H_
     38 
     39 /*****************************************************************************/
     40 /* Constant Macros                                                           */
     41 /*****************************************************************************/
     42 #define QSCALE_Q_FAC 6
     43 #define QSCALE_Q_FAC_3 3
     44 
     45 /*corresponds to hevc qp = 4, not letting it go below 4 for better stability*/
     46 #define MIN_QSCALE_Q6 64
     47 
     48 #define INVALID_QP (-55)
     49 #define SCD_MIN_HEVC_QP 18
     50 
     51 /*For very high bitrate reduce min qp limit*/
     52 #define SCD_MIN_HEVC_QP_HBR 14
     53 #define SCD_MIN_HEVC_QP_VHBR 10
     54 
     55 #define SCD_MAX_HEVC_QP 48
     56 #define MAX_HEVC_QP 51
     57 
     58 /*classification based on i_to_average rest ratio so that appropriate qp offset can be chosen*/
     59 #define I_TO_REST_EXTREME_FAST (1.5)
     60 #define I_TO_REST_VVFAST (3)
     61 #define I_TO_REST_VFAST (5)
     62 #define I_TO_REST_FAST (8)
     63 #define I_TO_REST_MEDI (10)
     64 #define I_TO_REST_SLOW (14)
     65 
     66 #define MAX_NUM_FRAME_PARALLEL 8
     67 
     68 /*****************************************************************************/
     69 /* Enums                                                                     */
     70 /*****************************************************************************/
     71 /* RC algo type */
     72 typedef enum
     73 {
     74     VBR_STORAGE = 0,
     75     VBR_STORAGE_DVD_COMP = 1,
     76     VBR_STREAMING = 2,
     77     CONST_QP = 3,
     78     CBR_LDRC = 4,
     79     CBR_NLDRC = 5,
     80     CBR_NLDRC_HBR = 6,
     81     MAX_RC_TYPE
     82 } rc_type_e;
     83 
     84 /**/
     85 typedef enum
     86 {
     87     FIELD_OFFSET = 4
     88 } field_offset_e;
     89 
     90 /* Picture type structure*/
     91 typedef enum
     92 {
     93     BUF_PIC = -1,
     94     I_PIC = 0,
     95     P_PIC,
     96     B_PIC,
     97     B1_PIC,
     98     B2_PIC,
     99     P1_PIC,
    100     BB_PIC,
    101     B11_PIC,
    102     B22_PIC,
    103     MAX_PIC_TYPE
    104 } picture_type_e;
    105 
    106 typedef enum
    107 {
    108     I_PIC_SCD = 0x100,
    109     NA_PIC
    110 } picture_type_SCD;
    111 
    112 /* MB Type structure*/
    113 typedef enum
    114 {
    115     MB_TYPE_INTRA,
    116     MB_TYPE_INTER,
    117     MAX_MB_TYPE /* Based on MB TYPES added the array size increases */
    118 } mb_type_e;
    119 
    120 typedef enum
    121 {
    122     VBV_NORMAL,
    123     VBV_UNDERFLOW,
    124     VBV_OVERFLOW,
    125     VBR_CAUTION
    126 } vbv_buf_status_e;
    127 
    128 #endif
    129