1 /*
2  * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3  * Copyright (c) Imagination Technologies Limited, UK
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial portions
15  * of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  *
25  * Authors:
26  *    Edward Lin <edward.lin@intel.com>
27  *
28  */
29 
30 #ifndef _TNG_HOSTAIR_H_
31 #define _TNG_HOSTAIR_H_
32 
33 #include "img_types.h"
34 #include "tng_hostdefs.h"
35 #include "tng_hostcode.h"
36 
37 IMG_UINT32 tng_fill_slice_map(context_ENC_p ctx, IMG_INT32 i32SlotNum, IMG_UINT32 ui32StreamIndex);
38 void tng_air_set_input_control(context_ENC_p ctx, IMG_UINT8 ui8StreamID);
39 void tng_air_set_output_control(context_ENC_p ctx, IMG_UINT8 ui8StreamID);
40 VAStatus tng_air_buf_create(context_ENC_p ctx);
41 void tng_air_buf_free(context_ENC_p ctx);
42 
43 
44 typedef struct
45 {
46     IMG_UINT32 ui32SAD_Intra_MBInfo;		//!< SATD/SAD for best Intra candidate (24-bit unsigned value) plus 8 bit field containing MB info
47     IMG_UINT32 ui32SAD_Inter_MBInfo;		//!< SATD/SAD for best Inter candidate (24-bit unsigned value) plus 8 bit field containing MB info
48     IMG_UINT32 ui32SAD_Direct_MBInfo;	//!< SATD/SAD for best Direct candidate (24-bit unsigned value) plus 8 bit field containing MB info
49     IMG_UINT32 ui32Reserved;
50 } IMG_BEST_MULTIPASS_MB_PARAMS, *P_IMG_BEST_MULTIPASS_MB_PARAMS;
51 
52 typedef struct
53 {
54     IMG_UINT16  ui16MV4_0_X;       //!< MV4_0_X (this is also MV8_0_X if block size is 8x8, or MV16_X if block size is 16x16)
55     IMG_UINT16  ui16MV4_0_Y;       //!< MV4_0_Y (this is also MV8_0_Y if block size is 8x8, or MV16_Y if block size is 16x16)
56     IMG_UINT16  ui16MV4_1_X;       //!< MV4_1_X
57     IMG_UINT16  ui16MV4_1_Y;       //!< MV4_1_Y
58     IMG_UINT16  ui16MV4_2_X;       //!< MV4_2_X
59     IMG_UINT16  ui16MV4_2_Y;       //!< MV4_2_Y
60     IMG_UINT16  ui16MV4_3_X;       //!< MV4_3_X
61     IMG_UINT16  ui16MV4_3_Y;       //!< MV4_3_Y
62 
63     IMG_UINT16  ui16MV4_4_X;       //!< MV4_4_X (this is also MV8_1_X if block size is 8x8, or 2nd MV if block size is 8x16)
64     IMG_UINT16  ui16MV4_4_Y;       //!< MV4_4_Y (this is also MV8_1_Y if block size is 8x8, or 2nd MV if block size is 8x16)
65     IMG_UINT16  ui16MV4_5_X;       //!< MV4_5_X
66     IMG_UINT16  ui16MV4_5_Y;       //!< MV4_5_Y
67     IMG_UINT16  ui16MV4_6_X;       //!< MV4_6_X
68     IMG_UINT16  ui16MV4_6_Y;       //!< MV4_6_Y
69     IMG_UINT16  ui16MV4_7_X;       //!< MV4_7_X
70     IMG_UINT16  ui16MV4_7_Y;       //!< MV4_7_Y
71 
72     IMG_UINT16  ui16MV4_8_X;       //!< MV4_8_X (this is also MV8_2_X if block size is 8x8, or 2nd MV if block size is 16x8)
73     IMG_UINT16  ui16MV4_8_Y;       //!< MV4_8_Y (this is also MV8_2_Y if block size is 8x8, or 2nd MV if block size is 16x8)
74     IMG_UINT16  ui16MV4_9_X;       //!< MV4_9_X
75     IMG_UINT16  ui16MV4_9_Y;       //!< MV4_9_Y
76     IMG_UINT16  ui16MV4_10_X;     //!< MV4_10_X
77     IMG_UINT16  ui16MV4_10_Y;     //!< MV4_10_Y
78     IMG_UINT16  ui16MV4_11_X;     //!< MV4_11_X
79     IMG_UINT16  ui16MV4_11_Y;     //!< MV4_11_Y
80 
81     IMG_UINT16  ui16MV4_12_X;       //!< MV4_12_X (this is also MV8_3_X if block size is 8x8)
82     IMG_UINT16  ui16MV4_12_Y;       //!< MV4_12_Y (this is also MV8_3_Y if block size is 8x8)
83     IMG_UINT16  ui16MV4_13_X;       //!< MV4_13_X
84     IMG_UINT16  ui16MV4_13_Y;       //!< MV4_13_Y
85     IMG_UINT16  ui16MV4_14_X;       //!< MV4_14_X
86     IMG_UINT16  ui16MV4_14_Y;       //!< MV4_14_Y
87     IMG_UINT16  ui16MV4_15_X;       //!< MV4_15_X
88     IMG_UINT16  ui16MV4_15_Y;       //!< MV4_15_Y
89 } IMG_BEST_MULTIPASS_MB_PARAMS_IPMV, *P_IMG_BEST_MULTIPASS_MB_PARAMS_IPMV;
90 
91 /*!
92 *****************************************************************************
93 * @details
94 * @brief      Bit fields for IMG_BEST_MULTIPASS_MB_PARAMS structure
95 ****************************************************************************/
96 #define     IMG_BEST_MULTIPASS_SAD_SHIFT					(0)
97 #define     IMG_BEST_MULTIPASS_SAD_MASK						(0xFFFFFF)
98 #define     IMG_BEST_MULTIPASS_MB_TYPE_SHIFT				(24)
99 #define     IMG_BEST_MULTIPASS_MB_TYPE_MASK					(0x03 << IMG_BEST_MULTIPASS_MB_TYPE_SHIFT)
100 #define     IMG_BEST_MULTIPASS_INTRA_BLOCK_SIZE_SHIFT		(26)
101 #define     IMG_BEST_MULTIPASS_INTRA_BLOCK_SIZE_MASK		(0x03 << IMG_BEST_MULTIPASS_INTRA_BLOCK_SIZE_SHIFT)
102 #define     IMG_BEST_MULTIPASS_TOPLEFT_SKIPDIRECT_SHIFT		(28)
103 #define     IMG_BEST_MULTIPASS_TOPLEFT_SKIPDIRECT_MASK		(0x01 << IMG_BEST_MULTIPASS_TOPLEFT_SKIPDIRECT_SHIFT)
104 #define     IMG_BEST_MULTIPASS_TOPRIGHT_SKIPDIRECT_SHIFT	(29)
105 #define     IMG_BEST_MULTIPASS_TOPRIGHT_SKIPDIRECT_MASK		(0x01 << IMG_BEST_MULTIPASS_TOPRIGHT_SKIPDIRECT_SHIFT)
106 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_SKIPDIRECT_SHIFT	(30)
107 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_SKIPDIRECT_MASK	(0x01 << IMG_BEST_MULTIPASS_BOTTOMLEFT_SKIPDIRECT_SHIFT)
108 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_SKIPDIRECT_SHIFT	(31)
109 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_SKIPDIRECT_MASK	(0x01 << IMG_BEST_MULTIPASS_BOTTOMRIGHT_SKIPDIRECT_SHIFT)
110 
111 #define     IMG_BEST_MULTIPASS_TOPLEFT_CODING_SHIFT			(24)
112 #define     IMG_BEST_MULTIPASS_TOPLEFT_CODING_MASK			(0x01 << IMG_BEST_MULTIPASS_TOPLEFT_CODING_SHIFT)
113 #define     IMG_BEST_MULTIPASS_TOPRIGHT_CODING_SHIFT		(25)
114 #define     IMG_BEST_MULTIPASS_TOPRIGHT_CODING_MASK			(0x01 << IMG_BEST_MULTIPASS_TOPRIGHT_CODING_SHIFT)
115 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_CODING_SHIFT		(26)
116 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_CODING_MASK		(0x01 << IMG_BEST_MULTIPASS_BOTTOMLEFT_CODING_SHIFT)
117 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_CODING_SHIFT		(27)
118 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_CODING_MASK		(0x01 << IMG_BEST_MULTIPASS_BOTTOMRIGHT_CODING_SHIFT)
119 #define     IMG_BEST_MULTIPASS_IS_16x16_BEST_SHIFT			(28)
120 #define     IMG_BEST_MULTIPASS_IS_16x16_BEST_MASK			(0x01 << IMG_BEST_MULTIPASS_IS_16x16_BEST_SHIFT)
121 #define     IMG_BEST_MULTIPASS_IS_16x8_BEST_SHIFT			(29)
122 #define     IMG_BEST_MULTIPASS_IS_16x8_BEST_MASK			(0x01 << IMG_BEST_MULTIPASS_IS_16x8_BEST_SHIFT)
123 #define     IMG_BEST_MULTIPASS_IS_8x16_BEST_SHIFT			(30)
124 #define     IMG_BEST_MULTIPASS_IS_8x16_BEST_MASK			(0x01 << IMG_BEST_MULTIPASS_IS_8x16_BEST_SHIFT)
125 // Final bit reserved
126 
127 #define     IMG_BEST_MULTIPASS_TOPLEFT_BEST_INTER_CAND_SHIFT		(24)
128 #define     IMG_BEST_MULTIPASS_TOPLEFT_BEST_INTER_CAND_MASK			(0x03 << IMG_BEST_MULTIPASS_TOPLEFT_BEST_INTER_CAND_SHIFT)
129 #define     IMG_BEST_MULTIPASS_TOPRIGHT_BEST_INTER_CAND_SHIFT		(26)
130 #define     IMG_BEST_MULTIPASS_TOPRIGHT_BEST_INTER_CAND_MASK		(0x03 << IMG_BEST_MULTIPASS_TOPRIGHT_BEST_INTER_CAND_SHIFT)
131 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_BEST_INTER_CAND_SHIFT		(28)
132 #define     IMG_BEST_MULTIPASS_BOTTOMLEFT_BEST_INTER_CAND_MASK		(0x03 << IMG_BEST_MULTIPASS_BOTTOMLEFT_BEST_INTER_CAND_SHIFT)
133 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_BEST_INTER_CAND_SHIFT	(30)
134 #define     IMG_BEST_MULTIPASS_BOTTOMRIGHT_BEST_INTER_CAND_MASK		(0x03 << IMG_BEST_MULTIPASS_BOTTOMRIGHT_BEST_INTER_CAND_SHIFT)
135 
136 
137 #endif //_TNG_HOSTBIAS_H_
138