1*c83a76b0SSuyog Pawar /****************************************************************************** 2*c83a76b0SSuyog Pawar * 3*c83a76b0SSuyog Pawar * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 4*c83a76b0SSuyog Pawar * 5*c83a76b0SSuyog Pawar * Licensed under the Apache License, Version 2.0 (the "License"); 6*c83a76b0SSuyog Pawar * you may not use this file except in compliance with the License. 7*c83a76b0SSuyog Pawar * You may obtain a copy of the License at: 8*c83a76b0SSuyog Pawar * 9*c83a76b0SSuyog Pawar * http://www.apache.org/licenses/LICENSE-2.0 10*c83a76b0SSuyog Pawar * 11*c83a76b0SSuyog Pawar * Unless required by applicable law or agreed to in writing, software 12*c83a76b0SSuyog Pawar * distributed under the License is distributed on an "AS IS" BASIS, 13*c83a76b0SSuyog Pawar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*c83a76b0SSuyog Pawar * See the License for the specific language governing permissions and 15*c83a76b0SSuyog Pawar * limitations under the License. 16*c83a76b0SSuyog Pawar * 17*c83a76b0SSuyog Pawar ******************************************************************************/ 18*c83a76b0SSuyog Pawar /** 19*c83a76b0SSuyog Pawar ******************************************************************************* 20*c83a76b0SSuyog Pawar * @file 21*c83a76b0SSuyog Pawar * ihevcd_statistics.h 22*c83a76b0SSuyog Pawar * 23*c83a76b0SSuyog Pawar * @brief 24*c83a76b0SSuyog Pawar * Contains macros for generating stats about hevc decoder 25*c83a76b0SSuyog Pawar * 26*c83a76b0SSuyog Pawar * @author 27*c83a76b0SSuyog Pawar * Naveen SR 28*c83a76b0SSuyog Pawar * 29*c83a76b0SSuyog Pawar * @par List of Functions: 30*c83a76b0SSuyog Pawar * 31*c83a76b0SSuyog Pawar * @remarks 32*c83a76b0SSuyog Pawar * None 33*c83a76b0SSuyog Pawar * 34*c83a76b0SSuyog Pawar ******************************************************************************* 35*c83a76b0SSuyog Pawar */ 36*c83a76b0SSuyog Pawar 37*c83a76b0SSuyog Pawar #ifndef _IHEVCD_STATISTICS_H_ 38*c83a76b0SSuyog Pawar #define _IHEVCD_STATISTICS_H_ 39*c83a76b0SSuyog Pawar 40*c83a76b0SSuyog Pawar #include <stdio.h> 41*c83a76b0SSuyog Pawar #include "ihevc_typedefs.h" 42*c83a76b0SSuyog Pawar #include "iv.h" 43*c83a76b0SSuyog Pawar #include "ivd.h" 44*c83a76b0SSuyog Pawar #include "ihevcd_cxa.h" 45*c83a76b0SSuyog Pawar #include "ithread.h" 46*c83a76b0SSuyog Pawar 47*c83a76b0SSuyog Pawar #include "ihevc_defs.h" 48*c83a76b0SSuyog Pawar #include "ihevc_structs.h" 49*c83a76b0SSuyog Pawar 50*c83a76b0SSuyog Pawar #include "ihevc_cabac_tables.h" 51*c83a76b0SSuyog Pawar #include "ihevcd_defs.h" 52*c83a76b0SSuyog Pawar 53*c83a76b0SSuyog Pawar #include "ihevcd_structs.h" 54*c83a76b0SSuyog Pawar #include "ihevcd_iquant_itrans_recon_ctb.h" 55*c83a76b0SSuyog Pawar #include "ihevcd_statistics.h" 56*c83a76b0SSuyog Pawar 57*c83a76b0SSuyog Pawar #define STATISTICS_ENABLE 0 58*c83a76b0SSuyog Pawar 59*c83a76b0SSuyog Pawar #if STATISTICS_ENABLE 60*c83a76b0SSuyog Pawar 61*c83a76b0SSuyog Pawar typedef struct 62*c83a76b0SSuyog Pawar { 63*c83a76b0SSuyog Pawar UWORD32 num_4x4_dst; 64*c83a76b0SSuyog Pawar UWORD32 num_4x4; 65*c83a76b0SSuyog Pawar UWORD32 num_8x8; 66*c83a76b0SSuyog Pawar UWORD32 num_16x16; 67*c83a76b0SSuyog Pawar UWORD32 num_32x32; 68*c83a76b0SSuyog Pawar UWORD32 num_64x64; 69*c83a76b0SSuyog Pawar }stat_trans_t; 70*c83a76b0SSuyog Pawar 71*c83a76b0SSuyog Pawar typedef struct 72*c83a76b0SSuyog Pawar { 73*c83a76b0SSuyog Pawar /* 4x4 Subblock count */ 74*c83a76b0SSuyog Pawar UWORD32 trans_4x4_dst[1]; 75*c83a76b0SSuyog Pawar UWORD32 trans_4x4[1]; 76*c83a76b0SSuyog Pawar UWORD32 trans_8x8[4]; 77*c83a76b0SSuyog Pawar UWORD32 trans_16x16[16]; 78*c83a76b0SSuyog Pawar UWORD32 trans_32x32[64]; 79*c83a76b0SSuyog Pawar }stat_sblk_histogram_t; 80*c83a76b0SSuyog Pawar 81*c83a76b0SSuyog Pawar typedef struct 82*c83a76b0SSuyog Pawar { 83*c83a76b0SSuyog Pawar /* 4x4 Subblock count */ 84*c83a76b0SSuyog Pawar UWORD32 trans_4x4_dst[16]; 85*c83a76b0SSuyog Pawar UWORD32 trans_4x4[16]; 86*c83a76b0SSuyog Pawar UWORD32 trans_8x8[64]; 87*c83a76b0SSuyog Pawar UWORD32 trans_16x16[256]; 88*c83a76b0SSuyog Pawar UWORD32 trans_32x32[1024]; 89*c83a76b0SSuyog Pawar }stat_coeff_histogram_t; 90*c83a76b0SSuyog Pawar 91*c83a76b0SSuyog Pawar typedef struct 92*c83a76b0SSuyog Pawar { 93*c83a76b0SSuyog Pawar stat_trans_t stat_num_all_trans_block[2]; /* Y and UV */ 94*c83a76b0SSuyog Pawar stat_trans_t stat_num_coded_trans_block[2]; /* Y and UV */ 95*c83a76b0SSuyog Pawar stat_trans_t stat_num_coded_dc_block[2]; /* Y and UV */ 96*c83a76b0SSuyog Pawar stat_trans_t stat_num_coded_one_coeff_block[2]; /* Y and UV */ 97*c83a76b0SSuyog Pawar stat_sblk_histogram_t stat_last_sblk_pos_histogram; /* Y + UV */ 98*c83a76b0SSuyog Pawar stat_sblk_histogram_t stat_num_coded_sblk_histogram; /* Y + UV */ 99*c83a76b0SSuyog Pawar stat_coeff_histogram_t stat_num_coded_coeff_histogram; /* Y + UV */ 100*c83a76b0SSuyog Pawar UWORD32 stat_pu_all_size_hist[16][16]; /* PU Sizes [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 101*c83a76b0SSuyog Pawar UWORD32 stat_pu_skip_size_hist[16][16]; /* PU sizes for skip [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 102*c83a76b0SSuyog Pawar UWORD32 stat_pu_inter_size_hist[16][16]; /* PU sizes for inter [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 103*c83a76b0SSuyog Pawar UWORD32 stat_pu_intra_size_hist[16][16]; /* PU sizes for intra [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 104*c83a76b0SSuyog Pawar UWORD32 stat_pu_bipred_size_hist[16][16]; /* PU sizes for bipred [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 105*c83a76b0SSuyog Pawar UWORD32 stat_pu_merge_size_hist[16][16]; /* PU sizes for merge [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 106*c83a76b0SSuyog Pawar UWORD32 stat_pu_zeromv_size_hist[16][16]; /* PU sizes for Zero MV [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 107*c83a76b0SSuyog Pawar UWORD32 stat_pu_zeromvfpel_size_hist[16][16]; /* PU sizes for Zero MV (includes subpel less than +/- 1 full pel units [Width from 4 to 64 in steps of 4] [Height from 4 to 64 in steps of 4]*/ 108*c83a76b0SSuyog Pawar UWORD32 last_sblk_pos_x; /* Last sblk pos of transform block in processing */ 109*c83a76b0SSuyog Pawar UWORD32 last_sblk_pos_y; 110*c83a76b0SSuyog Pawar UWORD32 num_coded_sblk; 111*c83a76b0SSuyog Pawar UWORD32 num_coded_coeffs; 112*c83a76b0SSuyog Pawar }statistics_t; 113*c83a76b0SSuyog Pawar 114*c83a76b0SSuyog Pawar void ihevcd_update_num_all_trans_blocks(TRANSFORM_TYPE e_trans_type, WORD32 c_idx); 115*c83a76b0SSuyog Pawar void ihevcd_update_num_trans_blocks(TRANSFORM_TYPE e_trans_type, WORD32 c_idx, WORD32 update_type); 116*c83a76b0SSuyog Pawar void ihevcd_update_sblk_and_coeff_histogram(TRANSFORM_TYPE e_trans_type, WORD32 t_skip_or_tq_bypass); 117*c83a76b0SSuyog Pawar void ihevcd_sblk_pos_init(); 118*c83a76b0SSuyog Pawar void ihevcd_sblk_pos_update(TRANSFORM_TYPE e_trans_type, WORD32 t_skip_or_tq_bypass, UWORD32 sblk_x, UWORD32 sblk_y); 119*c83a76b0SSuyog Pawar void ihevcd_print_transform_statistics(); 120*c83a76b0SSuyog Pawar void ihevcd_update_coeff_count(); 121*c83a76b0SSuyog Pawar void ihevcd_update_pu_size(pu_t *ps_pu); 122*c83a76b0SSuyog Pawar void ihevcd_update_pu_skip_size(pu_t *ps_pu); 123*c83a76b0SSuyog Pawar #endif //STATISTICS_ENABLE 124*c83a76b0SSuyog Pawar 125*c83a76b0SSuyog Pawar #if STATISTICS_ENABLE 126*c83a76b0SSuyog Pawar #define STATS_INIT() ihevcd_init_statistics(); 127*c83a76b0SSuyog Pawar #define STATS_UPDATE_ALL_TRANS(e_trans_type, c_idx) ihevcd_update_num_all_trans_blocks(e_trans_type, c_idx); 128*c83a76b0SSuyog Pawar #define STATS_UPDATE_CODED_TRANS(e_trans_type, c_idx, update_type) ihevcd_update_num_trans_blocks(e_trans_type, c_idx, update_type); 129*c83a76b0SSuyog Pawar #define STATS_PRINT() ihevcd_print_statistics(); 130*c83a76b0SSuyog Pawar #define STATS_INIT_SBLK_AND_COEFF_POS() ihevcd_sblk_pos_init(); 131*c83a76b0SSuyog Pawar #define STATS_LAST_SBLK_POS_UPDATE(e_trans_type, t_skip_or_tq_bypass, sblk_x, sblk_y) ihevcd_sblk_pos_update(e_trans_type, t_skip_or_tq_bypass, sblk_x, sblk_y); 132*c83a76b0SSuyog Pawar #define STATS_UPDATE_SBLK_AND_COEFF_HISTOGRAM(e_trans_type, t_skip_or_tq_bypass) ihevcd_update_sblk_and_coeff_histogram(e_trans_type, t_skip_or_tq_bypass); 133*c83a76b0SSuyog Pawar #define STATS_UPDATE_COEFF_COUNT() ihevcd_update_coeff_count(); 134*c83a76b0SSuyog Pawar #define STATS_UPDATE_PU_SIZE(ps_pu) ihevcd_update_pu_size(ps_pu); 135*c83a76b0SSuyog Pawar #define STATS_UPDATE_PU_SKIP_SIZE(ps_pu) ihevcd_update_pu_skip_size(ps_pu); 136*c83a76b0SSuyog Pawar #else 137*c83a76b0SSuyog Pawar #define STATS_INIT() ; 138*c83a76b0SSuyog Pawar #define STATS_UPDATE_ALL_TRANS(e_trans_type, c_idx) ; 139*c83a76b0SSuyog Pawar #define STATS_UPDATE_CODED_TRANS(e_trans_type, c_idx, update_type) ; 140*c83a76b0SSuyog Pawar #define STATS_PRINT() ; 141*c83a76b0SSuyog Pawar #define STATS_INIT_SBLK_AND_COEFF_POS() ; 142*c83a76b0SSuyog Pawar #define STATS_LAST_SBLK_POS_UPDATE(e_trans_type, t_skip_or_tq_bypass, sblk_x, sblk_y) ; 143*c83a76b0SSuyog Pawar #define STATS_UPDATE_SBLK_AND_COEFF_HISTOGRAM(e_trans_type, t_skip_or_tq_bypass) ; 144*c83a76b0SSuyog Pawar #define STATS_UPDATE_COEFF_COUNT() ; 145*c83a76b0SSuyog Pawar #define STATS_UPDATE_PU_SIZE(ps_pu) ; 146*c83a76b0SSuyog Pawar #define STATS_UPDATE_PU_SKIP_SIZE(ps_pu) ; 147*c83a76b0SSuyog Pawar #endif 148*c83a76b0SSuyog Pawar 149*c83a76b0SSuyog Pawar #endif /* _IHEVCD_STATISTICS_H_ */ 150