1 /****************************************************************************** 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 RC_RD_MODEL_STRUCT 22 #define RC_RD_MODEL_STRUCT 23 24 /*Enable or diable QUAD model*/ 25 #define ENABLE_QUAD_RC_MODEL 0 26 #define ENABLE_LIN_MODEL_WITH_INTERCEPT 0 27 28 /* Number of elements for QP */ 29 #define MPEG2_QP_ELEM (MAX_MPEG2_QP + 1) 30 31 32 #if ENABLE_QUAD_RC_MODEL 33 #define QUAD 1 34 #define MIN_FRAMES_FOR_QUAD_MODEL 5 35 #endif 36 37 #define MAX_ACTIVE_FRAMES 16 38 #define MIN_FRAMES_FOR_LIN_MODEL 3 39 #define INVALID_FRAME_INDEX 255 40 41 #define UP_THR_SM 1 /* (1 /pow(2,4) = 0.0625 */ 42 #define UP_THR_E 4 43 44 #define LO_THR_SM 368 /* (368.64 / pow(2,14)) = 0.0225 */ 45 #define LO_THR_E 14 46 47 #define LIN_DEV_THR_SM 1 /* (1 / pow(1,2)) = .25*/ 48 #define LIN_DEV_THR_E 2 49 50 #define PREV_FRAME_MODEL 2 51 52 /* Q Factors used for fixed point calculation */ 53 #define Q_FORMAT_GAMMA 8 54 #define Q_FORMAT_ETA 8 55 56 typedef struct rc_rd_model_t 57 { 58 UWORD8 u1_curr_frm_counter; 59 UWORD8 u1_num_frms_in_model; 60 UWORD8 u1_max_frms_to_model; 61 UWORD8 u1_model_used; 62 63 UWORD32 pi4_res_bits[MAX_FRAMES_MODELLED]; 64 UWORD32 pi4_sad[MAX_FRAMES_MODELLED]; 65 66 UWORD8 pu1_num_skips[MAX_FRAMES_MODELLED]; 67 UWORD8 pu1_avg_qp[MAX_FRAMES_MODELLED]; 68 UWORD8 au1_num_frames[MPEG2_QP_ELEM]; 69 70 model_coeff model_coeff_a_lin_wo_int; 71 model_coeff model_coeff_b_lin_wo_int; 72 model_coeff model_coeff_c_lin_wo_int; 73 } rc_rd_model_t; 74 75 #endif /* RC_RD_MODEL_STRUCT */ 76