1/* 2 * Copyright (c) 2013 Intel Corporation. All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the 6 * "Software"), to deal in the Software without restriction, including 7 * without limitation the rights to use, copy, modify, merge, publish, 8 * distribute, sub license, and/or sell copies of the Software, and to 9 * permit persons to whom the Software is furnished to do so, subject to 10 * the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the 13 * next paragraph) shall be included in all copies or substantial portions 14 * of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 19 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25/** 26 * \file va_intel_statistics.h 27 * \brief the Intel statistics API 28 * 29*/ 30 31#ifndef VA_INTEL_STATISTICS_H 32#define VA_INTEL_STATISTICS_H 33 34#ifdef __cplusplus 35extern "C" { 36#endif 37 38/** \brief Processing function for getting motion vectors and statistics. */ 39 40/** This processing function can output motion vectors, distortions (pure pixel distortion, no cost), 41 * number of non-zero coefficients, MB variance and MB pixel average. 42 * The purpose is to assist application to perform SCD, complexity analysis, segmentation, BRC, etc. 43 **/ 44 45 46/** \brief Motion Vector and Statistics frame level controls. 47 * VAStatsStatisticsParameterBufferTypeIntel for 16x16 block 48 **/ 49typedef struct _VAStatsStatisticsParameter16x16Intel 50{ 51 /** \brief Source surface ID. */ 52 VASurfaceID input; 53 54 VASurfaceID *past_references; 55 unsigned int num_past_references; 56 VASurfaceID *future_references; 57 unsigned int num_future_references; 58 59 /** \brief ID of the output surface. 60 * The number of outputs is determined by below DisableMVOutput and DisableStatisticsOutput. 61 * The output layout is defined by VAStatsStatisticsBufferType and VAStatsMotionVectorBufferType. 62 **/ 63 VASurfaceID *outputs; 64 65 /** \brief MV predictor. It is valid only when mv_predictor_ctrl is not 0. 66 * Each 16x16 block has a pair of MVs, one for past and one for future reference 67 * as defined by VAMotionVector. The 16x16 block is in raster scan order. 68 * Buffer size shall not be less than the number of 16x16 blocks multiplied by sizeof(VAMotionVector). 69 **/ 70 VASurfaceID mv_predictor; 71 72 /** \brief Qp input surface. It is valid only when mb_qp is set to 1. 73 * The data in this buffer correspond to the input source. 74 * One Qp per 16x16 block in raster scan order, each Qp is a signed char (8-bit) value. 75 **/ 76 VASurfaceID qp; 77 78 unsigned int frame_qp : 8; 79 unsigned int len_sp : 8; 80 unsigned int max_len_sp : 8; 81 unsigned int reserved0 : 8; 82 83 unsigned int sub_mb_part_mask : 7; 84 unsigned int sub_pel_mode : 2; 85 unsigned int inter_sad : 2; 86 unsigned int intra_sad : 2; 87 unsigned int adaptive_search : 1; 88 /** \brief indicate if future or/and past MV in mv_predictor buffer is valid. 89 * 0: MV predictor disabled 90 * 1: MV predictor enabled for past reference 91 * 2: MV predictor enabled for future reference 92 * 3: MV predictor enabled for both past and future references 93 **/ 94 unsigned int mv_predictor_ctrl : 3; 95 unsigned int mb_qp : 1; 96 unsigned int ft_enable : 1; 97 unsigned int reserved1 : 13; 98 99 unsigned int ref_width : 8; 100 unsigned int ref_height : 8; 101 unsigned int search_window : 3; 102 unsigned int reserved2 : 13; 103 104 /** \brief MVOutput. When set to 1, MV output is NOT provided */ 105 unsigned int disable_mv_output : 1; 106 /** \brief StatisticsOutput. When set to 1, Statistics output is NOT provided. */ 107 unsigned int disable_statistics_output : 1; 108 unsigned int reserved3 : 30; 109 110} VAStatsStatisticsParameter16x16Intel; 111 112/** \brief VAStatsMotionVectorBufferTypeIntel. Motion vector buffer layout. 113 * Motion vector output is per 4x4 block. For each 4x4 block there is a pair of past and future 114 * reference MVs as defined in VAMotionVector. Depending on Subblock partition, 115 * for the shape that is not 4x4, the MV is replicated so each 4x4 block has a pair of MVs. 116 * If only past reference is used, future MV should be ignored, and vice versa. 117 * The 16x16 block is in raster scan order, within the 16x16 block, each 4x4 block MV is ordered as below in memory. 118 * The buffer size shall be greater than or equal to the number of 16x16 blocks multiplied by (sizeof(VAMotionVector) * 16). 119 * 120 * 16x16 Block 121 * ----------------------------------------- 122 * | 1 | 2 | 5 | 6 | 123 * ----------------------------------------- 124 * | 3 | 4 | 7 | 8 | 125 * ----------------------------------------- 126 * | 9 | 10 | 13 | 14 | 127 * ----------------------------------------- 128 * | 11 | 12 | 15 | 16 | 129 * ----------------------------------------- 130 * 131 **/ 132 133/** \brief VAStatsStatisticsBufferTypeIntel. Statistics buffer layout. 134 * Statistics output is per 16x16 block. Data structure per 16x16 block is defined below. 135 * The 16x16 block is in raster scan order. The buffer size shall be greater than or equal to 136 * the number of 16x16 blocks multiplied by sizeof(VAStatsStatistics16x16Intel). 137 **/ 138typedef struct _VAStatsStatistics16x16Intel 139{ 140 /** \brief past reference */ 141 unsigned int best_inter_distortion0 : 16; 142 unsigned int inter_mode0 : 16; 143 144 /** \brief future reference */ 145 unsigned int best_inter_distortion1 : 16; 146 unsigned int inter_mode1 : 16; 147 148 unsigned int best_intra_distortion : 16; 149 unsigned int intra_mode : 16; 150 151 unsigned int num_non_zero_coef : 16; 152 unsigned int reserved : 16; 153 154 unsigned int sum_coef; 155 156 unsigned int variance; 157 unsigned int pixel_average; 158} VAStatsStatistics16x16Intel; 159 160#ifdef __cplusplus 161} 162#endif 163 164#endif /* VA_INTEL_STATISTICS_H */ 165