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 /** 22 ******************************************************************************* 23 * @file 24 * ih264e_statistics.h 25 * 26 * @brief 27 * Contains macros for generating stats about h264 encoder 28 * 29 * @author 30 * ittiam 31 * 32 * @remarks 33 * None 34 * 35 ******************************************************************************* 36 */ 37 38 #ifndef IH264E_STATISTICS_H_ 39 #define IH264E_STATISTICS_H_ 40 41 #if CAVLC_LEVEL_STATS 42 43 /*****************************************************************************/ 44 /* Extern global declarations */ 45 /*****************************************************************************/ 46 47 /** 48 ****************************************************************************** 49 * @brief In cavlc encoding, a lut is used for encoding levels. It is not possible 50 * to use look up for all possible levels. The extent to which look up is generated 51 * is based on the statistics that were collected in the following global variables. 52 * 53 * gu4_cavlc_level_bin_lt_4 represents the number coefficients with abs(level) < 4 54 * gu4_cavlc_level_bin_lt_16 represents the number coefficients with 4 < abs(level) < 16 55 * gu4_cavlc_level_bin_lt_32 represents the number coefficients with 16 < abs(level) < 32 56 * and so on ... 57 * ****************************************************************************** 58 */ 59 extern UWORD32 gu4_cavlc_level_bin_lt_4; 60 extern UWORD32 gu4_cavlc_level_bin_lt_16; 61 extern UWORD32 gu4_cavlc_level_bin_lt_32; 62 extern UWORD32 gu4_cavlc_level_bin_lt_64; 63 extern UWORD32 gu4_cavlc_level_bin_lt_128; 64 extern UWORD32 gu4_cavlc_level_bin_else_where; 65 extern UWORD32 gu4_cavlc_level_lut_hit_rate; 66 67 /*****************************************************************************/ 68 /* Extern function declarations */ 69 /*****************************************************************************/ 70 71 /** 72 ****************************************************************************** 73 * @brief print cavlc stats 74 ****************************************************************************** 75 */ 76 void print_cavlc_level_stats(void); 77 78 #define GATHER_CAVLC_STATS1() \ 79 if (u4_abs_level < 4)\ 80 gu4_cavlc_level_bin_lt_4 ++; \ 81 else if (u4_abs_level < 16) \ 82 gu4_cavlc_level_bin_lt_16 ++; \ 83 else if (u4_abs_level < 32) \ 84 gu4_cavlc_level_bin_lt_32 ++; \ 85 else if (u4_abs_level < 64) \ 86 gu4_cavlc_level_bin_lt_64 ++; \ 87 else if (u4_abs_level < 128) \ 88 gu4_cavlc_level_bin_lt_128 ++; \ 89 else \ 90 gu4_cavlc_level_bin_else_where ++; 91 92 #define GATHER_CAVLC_STATS2() \ 93 gu4_cavlc_level_lut_hit_rate ++; 94 95 #else 96 97 #define GATHER_CAVLC_STATS1() 98 99 #define GATHER_CAVLC_STATS2() 100 101 #endif 102 103 104 #if GATING_STATS 105 106 /*****************************************************************************/ 107 /* Extern global declarations */ 108 /*****************************************************************************/ 109 110 /** 111 ****************************************************************************** 112 * @brief During encoding at fastest preset, some times if the inter threshold 113 * is lesser than the predefined threshold, intra analysis is not done. The 114 * below variable keeps track of the number of mb for which intra analysis is not 115 * done 116 * ****************************************************************************** 117 */ 118 extern UWORD32 gu4_mb_gated_cnt; 119 120 /*****************************************************************************/ 121 /* Extern function declarations */ 122 /*****************************************************************************/ 123 124 /** 125 ****************************************************************************** 126 * @brief print gating stats 127 ****************************************************************************** 128 */ 129 void print_gating_stats(void); 130 131 #define GATHER_GATING_STATS() \ 132 gu4_mb_gated_cnt ++; 133 134 #else 135 136 #define GATHER_GATING_STATS() 137 138 #endif 139 140 141 #endif /* IH264E_STATISTICS_H_ */ 142