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_look_ahead_params.h 23 * 24 * \brief 25 * TODO: 26 * 27 * \date 28 * 29 * \author 30 * ittiam 31 * 32 ****************************************************************************** 33 */ 34 35 #ifndef _RC_LOOK_AHEAD_PARAMS_H_ 36 #define _RC_LOOK_AHEAD_PARAMS_H_ 37 38 /*****************************************************************************/ 39 /* Structure */ 40 /*****************************************************************************/ 41 /* 42 * Frame metrics 43 */ 44 typedef struct 45 { 46 /* Frame variance. Spatial property */ 47 LWORD64 i8_8x8_var_lum; 48 49 /* frame and histogram similarity */ 50 WORD32 ai4_hsim[3]; 51 WORD32 i4_fsim; 52 53 } rc_picture_metrics_t; 54 55 typedef struct 56 { 57 /* common params for both lap_out and rc_lap_out */ 58 59 WORD32 i4_rc_pic_type; 60 WORD32 i4_rc_poc; 61 WORD32 i4_rc_temporal_lyr_id; 62 WORD32 i4_rc_is_ref_pic; 63 WORD32 i4_rc_scene_type; 64 UWORD32 u4_rc_scene_num; 65 WORD32 i4_rc_display_num; 66 WORD32 i4_rc_quality_preset; 67 WORD32 i4_rc_first_field; 68 69 /* rc_lap_out specific params */ 70 71 /** 72 * array of rc_lap_out_params_t pointer to access 73 * the picture metrics of future pictures in capture order till 74 * the look ahead frames 75 */ 76 void *ps_rc_lap_out_next_encode; 77 78 WORD32 i4_next_pic_type; 79 80 WORD32 i4_is_I_only_scd; 81 WORD32 i4_is_non_I_scd; 82 83 LWORD64 i8_frame_satd_act_accum; 84 LWORD64 i8_est_I_pic_header_bits; 85 86 /* Num pels in frame considered while accumulating the above satd metric */ 87 WORD32 i4_num_pels_in_frame_considered; 88 /* Field type i.e either bottom or top is convyed */ 89 WORD32 i4_is_bottom_field; 90 /* Coarse ME accumulated cost for entire frame */ 91 LWORD64 i8_frame_acc_coarse_me_cost; 92 /* Coarse ME accumulated sad for entire frame */ 93 LWORD64 ai8_frame_acc_coarse_me_sad[52]; 94 /* L1 intra SATD */ 95 LWORD64 i8_pre_intra_satd; 96 /* L1 intra SATD */ 97 LWORD64 ai8_pre_intra_sad[52]; 98 /* L1 IPE sad */ 99 LWORD64 i8_raw_pre_intra_sad; 100 /* Frame - level L1 ME sad */ 101 LWORD64 i8_raw_l1_coarse_me_sad; 102 /** Frame - level L1 satd/act accum*/ 103 LWORD64 i8_frame_satd_by_act_L1_accum; 104 /** Frame - level L1 satd/act accum*/ 105 LWORD64 i8_satd_by_act_L1_accum_evaluated; 106 /* Frame satd/act accumulated for L0 predicted based on L1 satd and qp used for L0 processing */ 107 LWORD64 i8_frm_satd_act_accum_L0_frm_L1; 108 109 /* Frames for which online/offline model is not valid */ 110 WORD32 i4_is_model_valid; 111 /* Steady State Frame */ 112 WORD32 i4_is_steady_state; 113 114 LWORD64 i8_est_text_bits; 115 LWORD64 i8_frame_num; 116 117 frame_info_t *ps_frame_info; 118 /* complexity metrics from LAP */ 119 rc_picture_metrics_t s_pic_metrics; 120 121 WORD32 i4_is_cmplx_change_reset_model; 122 WORD32 i4_is_cmplx_change_reset_bits; 123 WORD32 i4_is_rc_model_needs_to_be_updated; 124 WORD32 i4_next_sc_i_in_rc_look_ahead; 125 WORD32 ai4_num_pic_type[MAX_PIC_TYPE]; 126 WORD32 ai4_offsets[5]; 127 WORD32 i4_offsets_set_flag; 128 WORD32 i4_complexity_bin; 129 WORD32 i4_ignore_for_rc_update; 130 WORD32 i4_L1_qp; 131 WORD32 i4_L0_qp; 132 WORD32 i4_enable_lookahead; 133 WORD32 i4_orig_rc_qp; 134 WORD32 i4_use_offline_model_2pass; 135 WORD32 i4_next_scene_type; 136 WORD32 i4_perc_dc_blks; 137 138 /* Used only in ix,vx versions */ 139 LWORD64 i8_frame_acc_satd_cost; 140 WORD32 i4_l1_update_done; 141 WORD32 i4_rc_i_pic_lamda_offset; 142 float f_rc_pred_factor; 143 144 } rc_lap_out_params_t; 145 146 #endif 147