xref: /OK3568_Linux_fs/external/linux-rga/docs/Rockchip_Developer_Guide_RGA_EN.md (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# RGA IM2D API Instruction
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunID: RK-KF-YF-403
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunRelease Version: V2.2.2
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunRelease Date: 2023-06-28
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunSecurity Level: □Top-Secret   □Secret   □Internal   ■Public
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun**DISCLAIMER**
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunTHIS DOCUMENT IS PROVIDED “AS IS”. ROCKCHIP ELECTRONICS CO., LTD.(“ROCKCHIP”)DOES NOT PROVIDE ANY WARRANTY OF ANY KIND, EXPRESSED, IMPLIED OR OTHERWISE, WITH RESPECT TO THE ACCURACY, RELIABILITY, COMPLETENESS,MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE OR NON-INFRINGEMENT OF ANY REPRESENTATION, INFORMATION AND CONTENT IN THIS DOCUMENT. THIS DOCUMENT IS FOR REFERENCE ONLY. THIS DOCUMENT MAY BE UPDATED OR CHANGED WITHOUT ANY NOTICE AT ANY TIME DUE TO THE UPGRADES OF THE PRODUCT OR ANY OTHER REASONS.
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun**Trademark Statement**
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun"Rockchip", "瑞芯微", "瑞芯" shall be Rockchip’s registered trademarks and owned by Rockchip. All the other trademarks or registered trademarks mentioned in this document shall be owned by their respective owners.
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun**All rights reserved. ©2022. Rockchip Electronics Co., Ltd.**
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunBeyond the scope of fair use, neither any entity nor individual shall extract, copy, or distribute this document in any form in whole or in part without the written approval of Rockchip.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunRockchip Electronics Co., Ltd.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunNo.18 Building, A District, No.89, software Boulevard Fuzhou, Fujian,PRC
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunWebsite:     [www.rock-chips.com](http://www.rock-chips.com)
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunCustomer service Tel:  +86-4007-700-590
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunCustomer service Fax:  +86-591-83951833
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunCustomer service e-Mail:  [fae@rock-chips.com](mailto:fae@rock-chips.com)
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun---
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun**Intended Audience**
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunThis document (this guide) is mainly intended for:
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun- Technical support engineers
42*4882a593Smuzhiyun- Software development engineers
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun**Revision History**
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun| **Date**   | **Version** | **Author**           | **Revision Description**                                                 |
47*4882a593Smuzhiyun| ---------- | -------- | ------------------ | ------------------------------------------------------------ |
48*4882a593Smuzhiyun| 2020/06/24 | 1.0.0    | Chen Cheng, Li Huang | Initial version.                                                     |
49*4882a593Smuzhiyun| 2020/10/16 | 1.0.1    | Chen Cheng, Li Huang, Yu Qiaowei | Update part of the APIs.                                                 |
50*4882a593Smuzhiyun| 2021/12/07 | 2.0.0    | Chen Cheng, Li Huang, Yu Qiaowei | Add RGA3 related support.                                             |
51*4882a593Smuzhiyun| 2022/01/20 | 2.1.0    | Chen Cheng, Li Huang, Yu Qiaowei | - Update im2d api description.<br/>- Updated hardware index description and alignment restrictions.<br/>- Add data structure description. |
52*4882a593Smuzhiyun| 2022/01/20 | 2.1.1 | Chen Cheng, Li Huang, Yu Qiaowei | Supplemental formatting support/alignment instructions. |
53*4882a593Smuzhiyun| 2022/09/15 | 2.2.0 | Chen Cheng, Li Huang, Yu Qiaowei | - Supplementary default value description<br/>- New array api<br/>- New task api<br/>- New rectangle border drawing api |
54*4882a593Smuzhiyun| 2023/02/09 | 2.2.1 | Yu Qiaowei | Format document. |
55*4882a593Smuzhiyun| 2022/06/28 | 2.2.2 | Yu Qiaowei | - Add chip RK3562 introduction<br/>- Improve the precautions for grayscale images |
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun---
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun**Contents**
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun[TOC]
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun---
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun## Introductions
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunRGA (Raster Graphic Acceleration Unit) is an independent 2D hardware accelerator that can be used to speed up point/line drawing, perform image resizing, rotation, bitBlt, alpha blending and other common 2D graphics operations.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun### Design Index
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun<table>
74*4882a593Smuzhiyun   <tr>
75*4882a593Smuzhiyun      <td rowspan="2">Version</td>
76*4882a593Smuzhiyun      <td rowspan="2">Codename</td>
77*4882a593Smuzhiyun      <td rowspan="2">Chip</td>
78*4882a593Smuzhiyun      <td rowspan="1" colspan="2">Source</td>
79*4882a593Smuzhiyun      <td rowspan="1" colspan="2">Destination</td>
80*4882a593Smuzhiyun      <td rowspan="2">Function</td>
81*4882a593Smuzhiyun      <td rowspan="2">Pixels/Cycle</td>
82*4882a593Smuzhiyun   </tr>
83*4882a593Smuzhiyun   <tr>
84*4882a593Smuzhiyun       <td>min</td>
85*4882a593Smuzhiyun       <td>max</td>
86*4882a593Smuzhiyun       <td>min</td>
87*4882a593Smuzhiyun       <td>max</td>
88*4882a593Smuzhiyun   </tr>
89*4882a593Smuzhiyun   <tr>
90*4882a593Smuzhiyun      <td rowspan="4">RGA1</td>
91*4882a593Smuzhiyun      <td>Pagani</td>
92*4882a593Smuzhiyun      <td>RK3066</td>
93*4882a593Smuzhiyun      <td rowspan="4">2x2</td>
94*4882a593Smuzhiyun      <td rowspan="4">8192x8192</td>
95*4882a593Smuzhiyun      <td rowspan="4">2x2</td>
96*4882a593Smuzhiyun      <td rowspan="4">2048x2048</td>
97*4882a593Smuzhiyun      <td rowspan="4">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/2~8 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>ROP<br/>IOMMU(32bit)</td>
98*4882a593Smuzhiyun      <td rowspan="4">1</td>
99*4882a593Smuzhiyun   </tr>
100*4882a593Smuzhiyun   <tr>
101*4882a593Smuzhiyun      <td>Jaguar Plus</td>
102*4882a593Smuzhiyun      <td>RK3188</td>
103*4882a593Smuzhiyun   </tr>
104*4882a593Smuzhiyun   <tr>
105*4882a593Smuzhiyun      <td>Beetles</td>
106*4882a593Smuzhiyun      <td>RK2926/2928</td>
107*4882a593Smuzhiyun   </tr>
108*4882a593Smuzhiyun   <tr>
109*4882a593Smuzhiyun      <td>Beetles Plus</td>
110*4882a593Smuzhiyun      <td>RK3026/3028</td>
111*4882a593Smuzhiyun   </tr>
112*4882a593Smuzhiyun   <tr>
113*4882a593Smuzhiyun      <td rowspan="2">RGA1_plus</td>
114*4882a593Smuzhiyun      <td>Audi</td>
115*4882a593Smuzhiyun      <td>RK3128</td>
116*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
117*4882a593Smuzhiyun      <td rowspan="2">8192x8192</td>
118*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
119*4882a593Smuzhiyun      <td rowspan="2">2048x2048</td>
120*4882a593Smuzhiyun      <td rowspan="2">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/2~8 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>Color palette<br/>IOMMU(32bit)</td>
121*4882a593Smuzhiyun      <td rowspan="2">1</td>
122*4882a593Smuzhiyun   </tr>
123*4882a593Smuzhiyun   <tr>
124*4882a593Smuzhiyun      <td>Granite</td>
125*4882a593Smuzhiyun      <td>Sofia 3gr</td>
126*4882a593Smuzhiyun   </tr>
127*4882a593Smuzhiyun   <tr>
128*4882a593Smuzhiyun      <td rowspan="2">RGA2</td>
129*4882a593Smuzhiyun      <td>Lincoln</td>
130*4882a593Smuzhiyun      <td>RK3288/3288w</td>
131*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
132*4882a593Smuzhiyun      <td rowspan="2">8192x8192</td>
133*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
134*4882a593Smuzhiyun      <td rowspan="2">4096x4096</td>
135*4882a593Smuzhiyun      <td rowspan="2">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/16~16 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>Color palette<br/>ROP<br/>IOMMU(32bit)</td>
136*4882a593Smuzhiyun      <td rowspan="2">2</td>
137*4882a593Smuzhiyun   </tr>
138*4882a593Smuzhiyun   <tr>
139*4882a593Smuzhiyun      <td>Capricorn</td>
140*4882a593Smuzhiyun      <td>RK3190</td>
141*4882a593Smuzhiyun   </tr>
142*4882a593Smuzhiyun   <tr>
143*4882a593Smuzhiyun      <td rowspan="2">RGA2-Lite0</td>
144*4882a593Smuzhiyun      <td>Maybach</td>
145*4882a593Smuzhiyun      <td>RK3368</td>
146*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
147*4882a593Smuzhiyun      <td rowspan="2">8192x8192</td>
148*4882a593Smuzhiyun      <td rowspan="2">2x2</td>
149*4882a593Smuzhiyun      <td rowspan="2">4096x4096</td>
150*4882a593Smuzhiyun      <td rowspan="2">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/8~8 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>Color palette<br/>ROP<br/>IOMMU(32bit)</td>
151*4882a593Smuzhiyun      <td rowspan="2">2</td>
152*4882a593Smuzhiyun   </tr>
153*4882a593Smuzhiyun   <tr>
154*4882a593Smuzhiyun      <td>BMW</td>
155*4882a593Smuzhiyun      <td>RK3366</td>
156*4882a593Smuzhiyun   </tr>
157*4882a593Smuzhiyun   <tr>
158*4882a593Smuzhiyun      <td rowspan="4">RGA2-Lite1</td>
159*4882a593Smuzhiyun      <td>Benz</td>
160*4882a593Smuzhiyun      <td>RK3228</td>
161*4882a593Smuzhiyun      <td rowspan="4">2x2</td>
162*4882a593Smuzhiyun      <td rowspan="4">8192x8192</td>
163*4882a593Smuzhiyun      <td rowspan="4">2x2</td>
164*4882a593Smuzhiyun      <td rowspan="4">4096x4096</td>
165*4882a593Smuzhiyun      <td rowspan="4">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/8~8 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>Color palette<br/>IOMMU(32bit)</td>
166*4882a593Smuzhiyun      <td rowspan="4">2</td>
167*4882a593Smuzhiyun   </tr>
168*4882a593Smuzhiyun   <tr>
169*4882a593Smuzhiyun      <td>Infiniti</td>
170*4882a593Smuzhiyun      <td>RK3228H</td>
171*4882a593Smuzhiyun   </tr>
172*4882a593Smuzhiyun   <tr>
173*4882a593Smuzhiyun      <td>Gemini</td>
174*4882a593Smuzhiyun      <td>RK3326</td>
175*4882a593Smuzhiyun   </tr>
176*4882a593Smuzhiyun   <tr>
177*4882a593Smuzhiyun      <td>Lion</td>
178*4882a593Smuzhiyun      <td>RK1808</td>
179*4882a593Smuzhiyun   </tr>
180*4882a593Smuzhiyun   <tr>
181*4882a593Smuzhiyun      <td rowspan="8">RGA2-Enhance</td>
182*4882a593Smuzhiyun      <td>Mclaren</td>
183*4882a593Smuzhiyun      <td>RK3399</td>
184*4882a593Smuzhiyun      <td rowspan="8">2x2</td>
185*4882a593Smuzhiyun      <td rowspan="8">8192x8192</td>
186*4882a593Smuzhiyun      <td rowspan="8">2x2</td>
187*4882a593Smuzhiyun      <td rowspan="8">4096x4096</td>
188*4882a593Smuzhiyun      <td rowspan="8">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/16~16 scale<br/>Alpha blend<br/>Color key<br/>Color fill<br/>Color palette<br/>ROP(NA for 1108/1109)<br/>NN quantize(NA for 3399/1108)<br/>osd(only 1106/1103)<br/>IOMMU(32bit, RK3528/RK3562 is 40bit,NA for RV1106/1103)</td>
189*4882a593Smuzhiyun      <td rowspan="8">2</td>
190*4882a593Smuzhiyun   </tr>
191*4882a593Smuzhiyun   <tr>
192*4882a593Smuzhiyun      <td>Mercury</td>
193*4882a593Smuzhiyun      <td>RK1108</td>
194*4882a593Smuzhiyun   </tr>
195*4882a593Smuzhiyun   <tr>
196*4882a593Smuzhiyun      <td>Puma</td>
197*4882a593Smuzhiyun      <td>RV1126/RV1109</td>
198*4882a593Smuzhiyun   </tr>
199*4882a593Smuzhiyun   <tr>
200*4882a593Smuzhiyun      <td>skylarkV2</td>
201*4882a593Smuzhiyun      <td>RK3566/RK3568</td>
202*4882a593Smuzhiyun   </tr>
203*4882a593Smuzhiyun   <tr>
204*4882a593Smuzhiyun      <td>Orion</td>
205*4882a593Smuzhiyun      <td>RK3588</td>
206*4882a593Smuzhiyun   </tr>
207*4882a593Smuzhiyun   <tr>
208*4882a593Smuzhiyun      <td>Otter</td>
209*4882a593Smuzhiyun      <td>RV1106/1103</td>
210*4882a593Smuzhiyun   </tr>
211*4882a593Smuzhiyun   <tr>
212*4882a593Smuzhiyun      <td>Bull</td>
213*4882a593Smuzhiyun      <td>RK3528</td>
214*4882a593Smuzhiyun   </tr>
215*4882a593Smuzhiyun   <tr>
216*4882a593Smuzhiyun      <td>Snipe</td>
217*4882a593Smuzhiyun      <td>RK3562</td>
218*4882a593Smuzhiyun   </tr>
219*4882a593Smuzhiyun   <tr>
220*4882a593Smuzhiyun      <td rowspan="1">RGA3</td>
221*4882a593Smuzhiyun      <td>Orion</td>
222*4882a593Smuzhiyun      <td>RK3588</td>
223*4882a593Smuzhiyun      <td rowspan="1">68x2</td>
224*4882a593Smuzhiyun      <td rowspan="1">8176x8176</td>
225*4882a593Smuzhiyun      <td rowspan="1">68x2</td>
226*4882a593Smuzhiyun      <td rowspan="1">8128x8128</td>
227*4882a593Smuzhiyun      <td rowspan="4">90/180/270 Rotate<br/>X/Y Mirror<br/>Crop<br/>1/8~8 scale<br/>Alpha blend<br/>Color key<br/>FBC<br/>IOMMU(40bit)</td>
228*4882a593Smuzhiyun      <td rowspan="1">3 (by pass)<br/>2 (scale)</td>
229*4882a593Smuzhiyun   </tr>
230*4882a593Smuzhiyun</table>
231*4882a593Smuzhiyun
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun> Note:
235*4882a593Smuzhiyun>
236*4882a593Smuzhiyun> 1). The capabilities of Pixels/cycle are theoretical data, and the actual operating performance is related to bandwidth, hardware frequency, etc. The list data is for reference only.
237*4882a593Smuzhiyun>
238*4882a593Smuzhiyun> 2). In addition to the minimum input resolution limit, the x, y, width, and height parameters of the actual operation rectangle that can be set for each channel must be greater than or equal to 2.
239*4882a593Smuzhiyun>
240*4882a593Smuzhiyun> 3). The addressing capability of RGA is related to the number of bits of IOMMU. For example, the actual physical addressing capability of RGA equipped with 32bit IOMMU only supports 0~4G memory space.
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun### Image Format Supported
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun- Pixel Format conversion, BT.601/BT.709/BT.2020(only RGA3)
248*4882a593Smuzhiyun- Dither operation
249*4882a593Smuzhiyun
250*4882a593Smuzhiyun<table>
251*4882a593Smuzhiyun   <tr>
252*4882a593Smuzhiyun      <td>Version</td>
253*4882a593Smuzhiyun      <td>Codename</td>
254*4882a593Smuzhiyun      <td>Chip</td>
255*4882a593Smuzhiyun      <td>Input Data Format</td>
256*4882a593Smuzhiyun      <td>Output Data Format</td>
257*4882a593Smuzhiyun   </tr>
258*4882a593Smuzhiyun   <tr>
259*4882a593Smuzhiyun      <td rowspan="4">RGA1</td>
260*4882a593Smuzhiyun      <td>Pagani</td>
261*4882a593Smuzhiyun      <td>RK3066</td>
262*4882a593Smuzhiyun      <td rowspan="4"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_BPP1<br/>RK_FORMAT_BPP2<br/>RK_FORMAT_BPP4<br/>RK_FORMAT_BPP8
263*4882a593Smuzhiyun      </td>
264*4882a593Smuzhiyun      <td rowspan="4">
265*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP (only for Blur/sharpness)<br/>RK_FORMAT_YCrCbr_420_SP (only for Blur/sharpness)<br/>RK_FORMAT_YCbCr_422_SP (only for Blur/sharpness)<br/>RK_FORMAT_YCrCbr_422_SP (only for Blur/sharpness)<br/>RK_FORMAT_YCbCr_420_P (only for Blur/sharpness)<br/>RK_FORMAT_YCrCbr_420_P (only for Blur/sharpness)<br/>RK_FORMAT_YCbCr_422_P (only for Blur/sharpness)<br/>RK_FORMAT_YCrCbr_422_P (only for Blur/sharpness)
266*4882a593Smuzhiyun      </td>
267*4882a593Smuzhiyun   </tr>
268*4882a593Smuzhiyun   <tr>
269*4882a593Smuzhiyun      <td>Jaguar Plus</td>
270*4882a593Smuzhiyun      <td>RK3188</td>
271*4882a593Smuzhiyun   </tr>
272*4882a593Smuzhiyun   <tr>
273*4882a593Smuzhiyun      <td>Beetles</td>
274*4882a593Smuzhiyun      <td>RK2926/2928</td>
275*4882a593Smuzhiyun   </tr>
276*4882a593Smuzhiyun   <tr>
277*4882a593Smuzhiyun      <td>Beetles Plus</td>
278*4882a593Smuzhiyun      <td>RK3026/3028</td>
279*4882a593Smuzhiyun   </tr>
280*4882a593Smuzhiyun   <tr>
281*4882a593Smuzhiyun      <td rowspan="2">RGA1_plus</td>
282*4882a593Smuzhiyun      <td>Audi</td>
283*4882a593Smuzhiyun      <td>RK3128</td>
284*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_BPP1<br/>RK_FORMAT_BPP2<br/>RK_FORMAT_BPP4<br/>RK_FORMAT_BPP8
285*4882a593Smuzhiyun      </td>
286*4882a593Smuzhiyun      <td rowspan="2">
287*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCrCbr_420_SP (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCbCr_422_SP (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCrCbr_422_SP (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCbCr_420_P (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCrCbr_420_P (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCbCr_422_P (only for normal Bitblt without alpha)<br/>RK_FORMAT_YCrCbr_422_P (only for normal Bitblt without alpha)
288*4882a593Smuzhiyun      </td>
289*4882a593Smuzhiyun   </tr>
290*4882a593Smuzhiyun   <tr>
291*4882a593Smuzhiyun      <td>Granite</td>
292*4882a593Smuzhiyun      <td>Sofia 3gr</td>
293*4882a593Smuzhiyun   </tr>
294*4882a593Smuzhiyun   <tr>
295*4882a593Smuzhiyun      <td rowspan="2">RGA2</td>
296*4882a593Smuzhiyun      <td>Lincoln</td>
297*4882a593Smuzhiyun      <td>RK3288/3288w</td>
298*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_BPP1 (only for color palette)<br/>RK_FORMAT_BPP2 (only for color palette)<br/>RK_FORMAT_BPP4 (only for color palette)<br/>RK_FORMAT_BPP8 (only for color palette)
299*4882a593Smuzhiyun      </td>
300*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P
301*4882a593Smuzhiyun      </td>
302*4882a593Smuzhiyun   </tr>
303*4882a593Smuzhiyun   <tr>
304*4882a593Smuzhiyun      <td>Capricorn</td>
305*4882a593Smuzhiyun      <td>RK3190</td>
306*4882a593Smuzhiyun   </tr>
307*4882a593Smuzhiyun   <tr>
308*4882a593Smuzhiyun      <td rowspan="2">RGA2-Lite0</td>
309*4882a593Smuzhiyun      <td>Maybach</td>
310*4882a593Smuzhiyun      <td>RK3368</td>
311*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_BPP1 (only for color palette)<br/>RK_FORMAT_BPP2 (only for color palette)<br/>RK_FORMAT_BPP4 (only for color palette)<br/>RK_FORMAT_BPP8 (only for color palette)
312*4882a593Smuzhiyun      </td>
313*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P
314*4882a593Smuzhiyun      </td>
315*4882a593Smuzhiyun   </tr>
316*4882a593Smuzhiyun   <tr>
317*4882a593Smuzhiyun      <td>BMW</td>
318*4882a593Smuzhiyun      <td>RK3366</td>
319*4882a593Smuzhiyun   </tr>
320*4882a593Smuzhiyun   <tr>
321*4882a593Smuzhiyun      <td rowspan="4">RGA2-Lite1</td>
322*4882a593Smuzhiyun      <td>Benz</td>
323*4882a593Smuzhiyun      <td>RK3228</td>
324*4882a593Smuzhiyun      <td rowspan="4"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B<br/>RK_FORMAT_BPP1 (only for color palette)<br/>RK_FORMAT_BPP2 (only for color palette)<br/>RK_FORMAT_BPP4 (only for color palette)<br/>RK_FORMAT_BPP8 (only for color palette)
325*4882a593Smuzhiyun      </td>
326*4882a593Smuzhiyun      <td rowspan="4"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P
327*4882a593Smuzhiyun      </td>
328*4882a593Smuzhiyun   </tr>
329*4882a593Smuzhiyun   <tr>
330*4882a593Smuzhiyun      <td>Infiniti</td>
331*4882a593Smuzhiyun      <td>RK3228H</td>
332*4882a593Smuzhiyun   </tr>
333*4882a593Smuzhiyun   <tr>
334*4882a593Smuzhiyun      <td>Gemini</td>
335*4882a593Smuzhiyun      <td>RK3326</td>
336*4882a593Smuzhiyun   </tr>
337*4882a593Smuzhiyun   <tr>
338*4882a593Smuzhiyun      <td>Lion</td>
339*4882a593Smuzhiyun      <td>RK1808</td>
340*4882a593Smuzhiyun   </tr>
341*4882a593Smuzhiyun   <tr>
342*4882a593Smuzhiyun      <td rowspan="6">RGA2-Enhance</td>
343*4882a593Smuzhiyun      <td>Mclaren</td>
344*4882a593Smuzhiyun      <td>RK3399</td>
345*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B<br/>RK_FORMAT_BPP1 (only for color palette)<br/>RK_FORMAT_BPP2 (only for color palette)<br/>RK_FORMAT_BPP4 (only for color palette)<br/>RK_FORMAT_BPP8 (only for color palette)
346*4882a593Smuzhiyun      </td>
347*4882a593Smuzhiyun      <td rowspan="2"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YUYV_420<br/>RK_FORMAT_YVYU_420<br/>RK_FORMAT_UYVY_420<br/>RK_FORMAT_VYUY_420
348*4882a593Smuzhiyun      </td>
349*4882a593Smuzhiyun   </tr>
350*4882a593Smuzhiyun   <tr>
351*4882a593Smuzhiyun      <td>Mercury</td>
352*4882a593Smuzhiyun      <td>RK1108</td>
353*4882a593Smuzhiyun   </tr>
354*4882a593Smuzhiyun   <tr>
355*4882a593Smuzhiyun      <td>Puma</td>
356*4882a593Smuzhiyun      <td>RV1126/ RV1109</td>
357*4882a593Smuzhiyun      <td rowspan="4"> RK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YCbCr_400<br/>RK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B<br/>RK_FORMAT_BPP1 (only for color palette)<br/>RK_FORMAT_BPP2 (only for color palette)<br/>RK_FORMAT_BPP4 (only for color palette)<br/>RK_FORMAT_BPP8 (only for color palette)
358*4882a593Smuzhiyun      </td>
359*4882a593Smuzhiyun      <td rowspan="4">
360*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YUYV_420<br/>RK_FORMAT_YVYU_420<br/>RK_FORMAT_UYVY_420<br/>RK_FORMAT_VYUY_420<br/>RK_FORMAT_YCbCr_400<br/>RK_FORMAT_Y4
361*4882a593Smuzhiyun   	  </td>
362*4882a593Smuzhiyun   </tr>
363*4882a593Smuzhiyun   <tr>
364*4882a593Smuzhiyun      <td>skylarkV2</td>
365*4882a593Smuzhiyun      <td>RK3566/RK3568</td>
366*4882a593Smuzhiyun   </tr>
367*4882a593Smuzhiyun   <tr>
368*4882a593Smuzhiyun   <td>Orion</td>
369*4882a593Smuzhiyun      <td>RK3588</td>
370*4882a593Smuzhiyun   </tr>
371*4882a593Smuzhiyun   <tr>
372*4882a593Smuzhiyun   <td>Otter</td>
373*4882a593Smuzhiyun      <td>RV1106/1103</td>
374*4882a593Smuzhiyun   </tr>
375*4882a593Smuzhiyun   <tr>
376*4882a593Smuzhiyun      <td rowspan="1">RGA3</td>
377*4882a593Smuzhiyun      <td>Orion</td>
378*4882a593Smuzhiyun      <td>RK3588</td>
379*4882a593Smuzhiyun      <td rowspan="1">
380*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B
381*4882a593Smuzhiyun      </td>
382*4882a593Smuzhiyun      <td rowspan="1">
383*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565<br>RK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B
384*4882a593Smuzhiyun      </td>
385*4882a593Smuzhiyun   </tr>
386*4882a593Smuzhiyun</table>
387*4882a593Smuzhiyun
388*4882a593Smuzhiyun
389*4882a593Smuzhiyun> Note:
390*4882a593Smuzhiyun>
391*4882a593Smuzhiyun> 1). The "RK_FORMAT_YCbCr_400" format means that the YUV format only takes the Y channel, and is often used in 256 (2 to the 8th power) grayscale images. Here, it should be noted that since the YUV format exists in the RGB/YUV color space conversion, you need to pay attention to the color space configuration , for example, a full 256-level grayscale image needs to be configured as full range during conversion.
392*4882a593Smuzhiyun>
393*4882a593Smuzhiyun> 2). The "RK_FORMAT_Y4" format means that the YUV format only takes the Y channel and dithers to 4 bits. It is often used in 16 (2 to the 4th power) grayscale images. The precautions involved in the configuration of the color space conversion are the same as “RK_FORMAT_YCbCr_400”.
394*4882a593Smuzhiyun
395*4882a593Smuzhiyun
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun### Image Format Alignment Instructions
398*4882a593Smuzhiyun
399*4882a593Smuzhiyun<table>
400*4882a593Smuzhiyun    <tr>
401*4882a593Smuzhiyun        <td>Version</td>
402*4882a593Smuzhiyun        <td>Byte_stride</td>
403*4882a593Smuzhiyun        <td>Format</td>
404*4882a593Smuzhiyun        <td>Alignment</td>
405*4882a593Smuzhiyun    </tr>
406*4882a593Smuzhiyun	<tr>
407*4882a593Smuzhiyun        <td rowspan="4">RGA1<br/>RGA1_Plus</td>
408*4882a593Smuzhiyun        <td rowspan="4">4</td>
409*4882a593Smuzhiyun        <td>
410*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888
411*4882a593Smuzhiyun        </td>
412*4882a593Smuzhiyun        <td>width stride does not require alignment</td>
413*4882a593Smuzhiyun    </tr>
414*4882a593Smuzhiyun    <tr>
415*4882a593Smuzhiyun        <td>
416*4882a593SmuzhiyunRK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565
417*4882a593Smuzhiyun        </td>
418*4882a593Smuzhiyun        <td>width stride must be 2-aligned</td>
419*4882a593Smuzhiyun    </tr>
420*4882a593Smuzhiyun    <tr>
421*4882a593Smuzhiyun        <td>
422*4882a593SmuzhiyunRK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888
423*4882a593Smuzhiyun        </td>
424*4882a593Smuzhiyun        <td>width stride must be 4-aligned</td>
425*4882a593Smuzhiyun    </tr>
426*4882a593Smuzhiyun    <tr>
427*4882a593Smuzhiyun        <td>
428*4882a593SmuzhiyunRK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P
429*4882a593Smuzhiyun        </td>
430*4882a593Smuzhiyun        <td>width stride must be 4-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
431*4882a593Smuzhiyun    </tr>
432*4882a593Smuzhiyun    <tr>
433*4882a593Smuzhiyun        <td rowspan="6">RGA2<br/>RGA2_Lite0<br/>RGA2_Lite1<br/>RGA2_Enhance</td>
434*4882a593Smuzhiyun        <td rowspan="6">4</td>
435*4882a593Smuzhiyun        <td>
436*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888
437*4882a593Smuzhiyun        </td>
438*4882a593Smuzhiyun        <td>width stride does not require alignment</td>
439*4882a593Smuzhiyun    </tr>
440*4882a593Smuzhiyun    <tr>
441*4882a593Smuzhiyun        <td>
442*4882a593SmuzhiyunRK_FORMAT_RGBA_4444<br/>RK_FORMAT_BGRA_4444<br/>RK_FORMAT_ARGB_4444<br/>RK_FORMAT_ABGR_4444<br/>RK_FORMAT_RGBA_5551<br/>RK_FORMAT_BGRA_5551<br/>RK_FORMAT_ARGB_5551<br/>RK_FORMAT_ABGR_5551<br/>RK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565
443*4882a593Smuzhiyun        </td>
444*4882a593Smuzhiyun        <td>width stride must be 2-aligned</td>
445*4882a593Smuzhiyun    </tr>
446*4882a593Smuzhiyun    <tr>
447*4882a593Smuzhiyun    	<td>
448*4882a593SmuzhiyunRK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422<br/>RK_FORMAT_YUYV_420<br/>RK_FORMAT_YVYU_420<br/>RK_FORMAT_UYVY_420<br/>RK_FORMAT_VYUY_420
449*4882a593Smuzhiyun        </td>
450*4882a593Smuzhiyun        <td>width stride must be 2-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
451*4882a593Smuzhiyun    </tr>
452*4882a593Smuzhiyun    <tr>
453*4882a593Smuzhiyun        <td>
454*4882a593SmuzhiyunRK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888
455*4882a593Smuzhiyun        </td>
456*4882a593Smuzhiyun        <td>width stride must be 4-aligned</td>
457*4882a593Smuzhiyun    </tr>
458*4882a593Smuzhiyun    <tr>
459*4882a593Smuzhiyun        <td>
460*4882a593SmuzhiyunRK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP<br/>RK_FORMAT_YCbCr_420_P<br/>RK_FORMAT_YCrCbr_420_P<br/>RK_FORMAT_YCbCr_422_P<br/>RK_FORMAT_YCrCbr_422_P<br/>RK_FORMAT_YCbCr_400<br/>RK_FORMAT_Y4
461*4882a593Smuzhiyun        </td>
462*4882a593Smuzhiyun        <td>width stride must be 4-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
463*4882a593Smuzhiyun    </tr>
464*4882a593Smuzhiyun    <tr>
465*4882a593Smuzhiyun        <td>
466*4882a593SmuzhiyunRK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B
467*4882a593Smuzhiyun        </td>
468*4882a593Smuzhiyun        <td>width stride must be 16-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
469*4882a593Smuzhiyun    </tr>
470*4882a593Smuzhiyun	<tr>
471*4882a593Smuzhiyun		<td rowspan="8">RGA3</td>
472*4882a593Smuzhiyun        <td rowspan="8">16</td>
473*4882a593Smuzhiyun        <td>
474*4882a593SmuzhiyunRK_FORMAT_RGBA_8888<br/>RK_FORMAT_BGRA_8888<br/>RK_FORMAT_ARGB_8888<br/>RK_FORMAT_ABGR_8888<br/>RK_FORMAT_RGBX_8888<br/>RK_FORMAT_BGRX_8888<br/>RK_FORMAT_XRGB_8888<br/>RK_FORMAT_XBGR_8888
475*4882a593Smuzhiyun        </td>
476*4882a593Smuzhiyun        <td>width stride must be 4-aligned</td>
477*4882a593Smuzhiyun    </tr>
478*4882a593Smuzhiyun    <tr>
479*4882a593Smuzhiyun        <td>
480*4882a593SmuzhiyunRK_FORMAT_RGB_565<br/>RK_FORMAT_BGR_565
481*4882a593Smuzhiyun        </td>
482*4882a593Smuzhiyun        <td>width stride must be 8-aligned</td>
483*4882a593Smuzhiyun    </tr>
484*4882a593Smuzhiyun    <tr>
485*4882a593Smuzhiyun    	<td>
486*4882a593SmuzhiyunRK_FORMAT_YUYV_422<br/>RK_FORMAT_YVYU_422<br/>RK_FORMAT_UYVY_422<br/>RK_FORMAT_VYUY_422
487*4882a593Smuzhiyun        </td>
488*4882a593Smuzhiyun        <td>width stride must be 8-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
489*4882a593Smuzhiyun    </tr>
490*4882a593Smuzhiyun    <tr>
491*4882a593Smuzhiyun        <td>
492*4882a593SmuzhiyunRK_FORMAT_RGB_888<br/>RK_FORMAT_BGR_888
493*4882a593Smuzhiyun        </td>
494*4882a593Smuzhiyun        <td>width stride must be 16-aligned</td>
495*4882a593Smuzhiyun    </tr>
496*4882a593Smuzhiyun	<tr>
497*4882a593Smuzhiyun        <td>
498*4882a593SmuzhiyunRK_FORMAT_YCbCr_420_SP<br/>RK_FORMAT_YCrCbr_420_SP<br/>RK_FORMAT_YCbCr_422_SP<br/>RK_FORMAT_YCrCbr_422_SP
499*4882a593Smuzhiyun        </td>
500*4882a593Smuzhiyun        <td>width stride must be 16-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
501*4882a593Smuzhiyun	</tr>
502*4882a593Smuzhiyun    <tr>
503*4882a593Smuzhiyun        <td>
504*4882a593SmuzhiyunRK_FORMAT_YCbCr_420_SP_10B<br/>RK_FORMAT_YCrCb_420_SP_10B<br/>RK_FORMAT_YCbCr_422_SP_10B<br/>RK_FORMAT_YCrCb_422_SP_10B
505*4882a593Smuzhiyun        </td>
506*4882a593Smuzhiyun        <td>width stride must be 64-aligned,x_offset、y_offset、width、height、height stride must be 2-aligned</td>
507*4882a593Smuzhiyun    </tr>
508*4882a593Smuzhiyun    <tr>
509*4882a593Smuzhiyun        <td>FBC mode</td>
510*4882a593Smuzhiyun        <td>In addition to the format alignment requirements above,width stride、height stride must be 16-aligned</td>
511*4882a593Smuzhiyun    </tr>
512*4882a593Smuzhiyun    <tr>
513*4882a593Smuzhiyun        <td>TILE8*8 mode</td>
514*4882a593Smuzhiyun        <td>In addition to the format alignment requirements above,width、height must be 8-aligned,input channel width stride、height stride must be 16-aligned。</td>
515*4882a593Smuzhiyun    </tr>
516*4882a593Smuzhiyun</table>
517*4882a593Smuzhiyun
518*4882a593Smuzhiyun
519*4882a593Smuzhiyun> Note:
520*4882a593Smuzhiyun>
521*4882a593Smuzhiyun> 1). Alignment requirement formula: lcm(bpp,byte_stride * 8) / pixel_stride.
522*4882a593Smuzhiyun>
523*4882a593Smuzhiyun> 2). When loaded with multiple versions of hardware, chip platform constraints according to the most strict alignment requirements.
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun
526*4882a593Smuzhiyun
527*4882a593Smuzhiyun---
528*4882a593Smuzhiyun
529*4882a593Smuzhiyun## Version Description
530*4882a593Smuzhiyun
531*4882a593SmuzhiyunRGA's support library librga.so updates the version number according to certain rules, indicating the submission of new features, compatibility, and bug fixes, and provides several ways to query the version number, so that developers can clearly determine whether the current library version is suitable for the current development environment when using librga.so. Detailed version update logs can be found in **CHANGLOG.md** in the root directory of source code.
532*4882a593Smuzhiyun
533*4882a593Smuzhiyun### librga API Version Description
534*4882a593Smuzhiyun
535*4882a593Smuzhiyun#### Version Number Format and Update Rule
536*4882a593Smuzhiyun
537*4882a593Smuzhiyun##### Version Number Format
538*4882a593Smuzhiyun
539*4882a593Smuzhiyun```
540*4882a593Smuzhiyunmajor.minor.revision_[build]
541*4882a593Smuzhiyun```
542*4882a593Smuzhiyun
543*4882a593Smuzhiyunexample:
544*4882a593Smuzhiyun
545*4882a593Smuzhiyun> 1.0.0_[0]
546*4882a593Smuzhiyun
547*4882a593Smuzhiyun
548*4882a593Smuzhiyun
549*4882a593Smuzhiyun##### Update Rule
550*4882a593Smuzhiyun
551*4882a593Smuzhiyun| Name     | Rule                                                   |
552*4882a593Smuzhiyun| -------- | ------------------------------------------------------ |
553*4882a593Smuzhiyun| major    | Major version number, when submitting a version that is not backward compatible.                     |
554*4882a593Smuzhiyun| minor    | Minor version number, when the functional API with backward compatibility is added.                  |
555*4882a593Smuzhiyun| revision | Revision version number, when submitting backward compatible feature additions or fatal bug fixes. |
556*4882a593Smuzhiyun| build    | Compile version number, when backward compatibility issue is fixed.                     |
557*4882a593Smuzhiyun
558*4882a593Smuzhiyun
559*4882a593Smuzhiyun
560*4882a593Smuzhiyun#### Version Number Query
561*4882a593Smuzhiyun
562*4882a593Smuzhiyun##### Query by Strings
563*4882a593Smuzhiyun
564*4882a593SmuzhiyunTake Android R 64bit as example:
565*4882a593Smuzhiyun
566*4882a593Smuzhiyun```shell
567*4882a593Smuzhiyun:/# strings vendor/lib64/librga.so |grep rga_api |grep version
568*4882a593Smuzhiyunrga_api version 1.0.0_[0]
569*4882a593Smuzhiyun```
570*4882a593Smuzhiyun
571*4882a593Smuzhiyun
572*4882a593Smuzhiyun
573*4882a593Smuzhiyun##### Log Print
574*4882a593Smuzhiyun
575*4882a593SmuzhiyunVersion number is printed when each process first calls RGA API.
576*4882a593Smuzhiyun
577*4882a593Smuzhiyun```
578*4882a593Smuzhiyunrockchiprga: rga_api version 1.0.0_[0]
579*4882a593Smuzhiyun```
580*4882a593Smuzhiyun
581*4882a593Smuzhiyun
582*4882a593Smuzhiyun
583*4882a593Smuzhiyun##### Query by API
584*4882a593Smuzhiyun
585*4882a593SmuzhiyunCall the following API to query the code version number, compilation version number, and RGA hardware version information. For details, see **API Description**.
586*4882a593Smuzhiyun
587*4882a593Smuzhiyun```
588*4882a593Smuzhiyunquerystring(RGA_VERSION);
589*4882a593Smuzhiyun```
590*4882a593Smuzhiyun
591*4882a593Smuzhiyun> String format is as follows:
592*4882a593Smuzhiyun>
593*4882a593Smuzhiyun> RGA_api version       : v1.0.0_[0]
594*4882a593Smuzhiyun> RGA version               : RGA_2_Enhance
595*4882a593Smuzhiyun
596*4882a593Smuzhiyun
597*4882a593Smuzhiyun
598*4882a593Smuzhiyun##### Query by Property
599*4882a593Smuzhiyun
600*4882a593SmuzhiyunThis method is supported only by Android system, and the property takes effect only after an existing process calls RGA.
601*4882a593Smuzhiyun
602*4882a593Smuzhiyun```shell
603*4882a593Smuzhiyun:/# getprop |grep rga
604*4882a593Smuzhiyun[vendor.rga_api.version]: [1.0.0_[0]]
605*4882a593Smuzhiyun```
606*4882a593Smuzhiyun
607*4882a593Smuzhiyun
608*4882a593Smuzhiyun
609*4882a593Smuzhiyun### Driver Version Description
610*4882a593Smuzhiyun
611*4882a593Smuzhiyunlibrga calls the RGA hardware based on the driver, it must be ensured that the driver version is within the supported range of the used librga library.
612*4882a593Smuzhiyun
613*4882a593Smuzhiyun#### Version Number Format and Update Rule
614*4882a593Smuzhiyun
615*4882a593Smuzhiyun##### Version Number Format
616*4882a593Smuzhiyun
617*4882a593Smuzhiyun```
618*4882a593Smuzhiyun<driver_name>: v major.minor.revision
619*4882a593Smuzhiyun```
620*4882a593Smuzhiyun
621*4882a593Smuzhiyunexample:
622*4882a593Smuzhiyun
623*4882a593Smuzhiyun> RGA2 Device Driver: v2.1.0
624*4882a593Smuzhiyun>
625*4882a593Smuzhiyun> RGA multicore Device Driver: v1.2.23
626*4882a593Smuzhiyun
627*4882a593Smuzhiyun
628*4882a593Smuzhiyun
629*4882a593Smuzhiyun##### Update Rule
630*4882a593Smuzhiyun
631*4882a593Smuzhiyun| Name     | Rule                                                         |
632*4882a593Smuzhiyun| -------- | ------------------------------------------------------------ |
633*4882a593Smuzhiyun| major    | Major version number, when submitting a version that is not backward compatible. |
634*4882a593Smuzhiyun| minor    | Minor version number, when the functional API with backward compatibility is added. |
635*4882a593Smuzhiyun| revision | Revision version number, when submitting backward compatible feature additions or fatal bug fixes. |
636*4882a593Smuzhiyun
637*4882a593Smuzhiyun
638*4882a593Smuzhiyun
639*4882a593Smuzhiyun#### Version Number Query
640*4882a593Smuzhiyun
641*4882a593Smuzhiyun##### Boot log query:
642*4882a593Smuzhiyun
643*4882a593SmuzhiyunUse the following command to query the RGA driver initialization log after booting. Some early drivers do not print the version number, and this method is only applicable to some drivers.
644*4882a593Smuzhiyun
645*4882a593Smuzhiyun```
646*4882a593Smuzhiyun dmesg |grep rga
647*4882a593Smuzhiyun```
648*4882a593Smuzhiyun
649*4882a593Smuzhiyunexample:
650*4882a593Smuzhiyun
651*4882a593Smuzhiyun> [    2.382393] rga3_core0 fdb60000.rga: Adding to iommu group 2
652*4882a593Smuzhiyun> [    2.382651] rga: rga3_core0, irq = 33, match scheduler
653*4882a593Smuzhiyun> [    2.383058] rga: rga3_core0 hardware loaded successfully, hw_version:3.0.76831.
654*4882a593Smuzhiyun> [    2.383121] rga: rga3_core0 probe successfully
655*4882a593Smuzhiyun> [    2.383687] rga3_core1 fdb70000.rga: Adding to iommu group 3
656*4882a593Smuzhiyun> [    2.383917] rga: rga3_core1, irq = 34, match scheduler
657*4882a593Smuzhiyun> [    2.384313] rga: rga3_core1 hardware loaded successfully, hw_version:3.0.76831.
658*4882a593Smuzhiyun> [    2.384412] rga: rga3_core1 probe successfully
659*4882a593Smuzhiyun> [    2.384893] rga: rga2, irq = 35, match scheduler
660*4882a593Smuzhiyun> [    2.385238] rga: rga2 hardware loaded successfully, hw_version:3.2.63318.
661*4882a593Smuzhiyun> [    2.385257] rga: rga2 probe successfully
662*4882a593Smuzhiyun> [    2.385455] rga_iommu: IOMMU binding successfully, default mapping core[0x1]
663*4882a593Smuzhiyun> [    2.385586] rga: Module initialized. v1.2.23
664*4882a593Smuzhiyun
665*4882a593SmuzhiyunAmong them, “v1.2.23” is the driver version number.
666*4882a593Smuzhiyun
667*4882a593Smuzhiyun
668*4882a593Smuzhiyun
669*4882a593Smuzhiyun##### debug node query
670*4882a593Smuzhiyun
671*4882a593SmuzhiyunThe version number can be queried through the driver debugging node. If there is no following node, it means that the driver version that does not support query is currently running.
672*4882a593Smuzhiyun
673*4882a593Smuzhiyun- Use the kernel with the CONFIG_ROCKCHIP_RGA_DEBUG_FS compile config enabled by default.
674*4882a593Smuzhiyun
675*4882a593Smuzhiyun```shell
676*4882a593Smuzhiyuncat /sys/kernel/debug/rkrga/driver_version
677*4882a593Smuzhiyun```
678*4882a593Smuzhiyun
679*4882a593Smuzhiyun- Use the kernel with the CONFIG_ROCKCHIP_RGA_PROC_FS compile config enabled.
680*4882a593Smuzhiyun
681*4882a593Smuzhiyun```shell
682*4882a593Smuzhiyuncat /proc/rkrga/driver_version
683*4882a593Smuzhiyun```
684*4882a593Smuzhiyun
685*4882a593Smuzhiyunexample:
686*4882a593Smuzhiyun
687*4882a593Smuzhiyun> cat /sys/kernel/debug/rkrga/driver_version
688*4882a593Smuzhiyun> RGA multicore Device Driver: v1.2.23
689*4882a593Smuzhiyun
690*4882a593SmuzhiyunHere "RGA multicore Device Driver" means that the driver name is RGA multicore Device Driver, and "v1.2.23" means that the version is 1.2.23, which means that the current driver is the RGA multicore Device Driver(usually referred to as multi_rga driver) of version 1.2.23  .
691*4882a593Smuzhiyun
692*4882a593Smuzhiyun> cat /sys/kernel/debug/rkrga/driver_version
693*4882a593Smuzhiyun> RGA2 Device Driver: v2.1.0
694*4882a593Smuzhiyun
695*4882a593SmuzhiyunHere "RGA2 Device Driver" means that the driver name is RGA2 Device Driver, and "v2.1.0" means that the version number is 2.1.0, which means that the current driver is the RGA2 Device Driver (usually referred to as rga2 driver) of version 2.1.0.
696*4882a593Smuzhiyun
697*4882a593Smuzhiyun
698*4882a593Smuzhiyun
699*4882a593Smuzhiyun### Correspondence between versions
700*4882a593Smuzhiyun
701*4882a593SmuzhiyunWhen using RGA, you need to confirm that the current operating environment can work normally. The following table shows the correspondence between commonly used librga and driver versions.
702*4882a593Smuzhiyun
703*4882a593Smuzhiyun| librga version    | driver version                                               | hardware         |
704*4882a593Smuzhiyun| ----------------- | ------------------------------------------------------------ | ---------------- |
705*4882a593Smuzhiyun| no version number | Drivers in the SDK                                           | RGA1、RGA2       |
706*4882a593Smuzhiyun| 1.0.0 ~ 1.3.2     | RGA Device Driver(kernel - 4.4 and above)<br/>RGA2 Device Driver(no version number or v2.1.0) | RGA1、RGA2       |
707*4882a593Smuzhiyun| > 1.4.0           | RGA multicore Device Driver(v1.2.0and above)               | RGA2、RGA3       |
708*4882a593Smuzhiyun| > 1.9.0           | RGA Device Driver(kernel-4.4 and above)<br/>RGA2 Device Driver(no version number or v2.1.0)<br/>RGA multicore Device Driver(v1.2.0and above) | RGA1、RGA2、RGA3 |
709*4882a593Smuzhiyun
710*4882a593Smuzhiyun
711*4882a593Smuzhiyun
712*4882a593Smuzhiyun---
713*4882a593Smuzhiyun
714*4882a593Smuzhiyun## API Description
715*4882a593Smuzhiyun
716*4882a593SmuzhiyunRGA library librga.so realizes 2D graphics operations  through the image buffer structure rga_info configuration. In order to obtain a better development experience, the common 2D image operation API is further encapsulated. The new API mainly contains the following features:
717*4882a593Smuzhiyun- API definitions refer to common 2D graphics API definitions in opencv/matlab, reducing the learning cost of secondary development.
718*4882a593Smuzhiyun- To eliminate compatibility problems caused by RGA hardware version differences, RGA query is added. Query mainly includes version information, large resolution and image format support.
719*4882a593Smuzhiyun- Add improcess API for 2D image compound operations. Compound operations are performed by passing in a set of predefined usage.
720*4882a593Smuzhiyun- Before performing image operation, the input and output image buffers need to be processed. The wrapbuffer_T API is called to pass the input and output image information to  rga_buffer_t, which contains information such as resolution and image format.
721*4882a593Smuzhiyun- It supports to bind the image composite operation that cannot be completed in a single time as an RGA image task, and submit it to the driver and execute it one by one.
722*4882a593Smuzhiyun
723*4882a593Smuzhiyun
724*4882a593Smuzhiyun
725*4882a593Smuzhiyun### Overview
726*4882a593Smuzhiyun
727*4882a593SmuzhiyunThe software support library provides the following API, asynchronous mode only supports C++ implementation.
728*4882a593Smuzhiyun
729*4882a593Smuzhiyun- **querystring**: Query information about the RGA hardware version and supported functions of chip platform, return a string.
730*4882a593Smuzhiyun- **imcheckHeader**:   Verify the difference between the currently used header file version and the librga version.
731*4882a593Smuzhiyun- **importbuffer_T**: Import external buffer into RGA driver to achieve hardware fast access to discontinuous physical addresses (dma_fd, virtual address).
732*4882a593Smuzhiyun- **releasebuffer_handle**: Remove reference and map of the external buffer from inside the RGA driver.
733*4882a593Smuzhiyun- **wrapbuffer_handle** Quickly encapsulate the image buffer structure (rga_buffer_t).
734*4882a593Smuzhiyun- **imbeginJob**:Create an RGA image processing job.
735*4882a593Smuzhiyun- **imendJob**: Submit and execute RGA image processing job.
736*4882a593Smuzhiyun- **imcancelJob**: Cancel and delete the RGA image processing job.
737*4882a593Smuzhiyun- **imcopy**: Call RGA for fast image copy.
738*4882a593Smuzhiyun- **imcopyTask**: Added fast image copy operation to RGA image job.
739*4882a593Smuzhiyun- **imresize**: Call RGA for fast image resize.
740*4882a593Smuzhiyun- **imresizeTask**: Added fast image resize operation to RGA image job.
741*4882a593Smuzhiyun- **impyramind**: Call RGA for fast image pyramid.
742*4882a593Smuzhiyun- **imcrop**: Call RGA for fast image cropping.
743*4882a593Smuzhiyun- **imcropTask**: Added fast image cropping operation to RGA image job.
744*4882a593Smuzhiyun- **imtranslate**: Call RGA for fast image translation.
745*4882a593Smuzhiyun- **imtranslateTask**: Added fast image translation operation to RGA image job.
746*4882a593Smuzhiyun- **imcvtcolor**: Call RGA for fast image format conversion.
747*4882a593Smuzhiyun- **imcvtcolorTask**: Added fast image format conversion operation to RGA image job.
748*4882a593Smuzhiyun- **imrotate**: Call RGA for fast image rotation.
749*4882a593Smuzhiyun- **imrotateTask**: Added fast image rotation operation to RGA image job.
750*4882a593Smuzhiyun- **imflip**: Call RGA for fast image flipping.
751*4882a593Smuzhiyun- **imflipTask**: Added fast image flipping operation to RGA image job.
752*4882a593Smuzhiyun- **imblend**: Call RGA for double channel fast image blending.
753*4882a593Smuzhiyun- **imblendTask**: Added double channel fast image blending operation to RGA image job.
754*4882a593Smuzhiyun- **imcomposite**: Call RGA for three-channel fast image  composite.
755*4882a593Smuzhiyun- **imcompositeTask**: Added three-channel fast image composite operation to RGA image job.
756*4882a593Smuzhiyun- **imcolorkey**: Call RGA for fast image color key.
757*4882a593Smuzhiyun- **imcolorkeyTask**: Added fast image color key operation to RGA image job.
758*4882a593Smuzhiyun- **imosd**: Call RGA for fast  image OSD.
759*4882a593Smuzhiyun- **imosdTask**:Added fast image OSD operation to RGA image job.
760*4882a593Smuzhiyun- **imquantize**: Call RGA for fast image operation point preprocessing (quantization).
761*4882a593Smuzhiyun- **imquantizeTask**: Added fast image operation point preprocessing (quantization) operation to RGA image job.
762*4882a593Smuzhiyun- **imrop**: Call RGA for fast image ROP.
763*4882a593Smuzhiyun- **imropTask**: Added fast image ROP operation to RGA image job.
764*4882a593Smuzhiyun- **imfill**: Call RGA for fast image filling.
765*4882a593Smuzhiyun- **imfillArray**: Call RGA to implement multiple groups of fast image filling.
766*4882a593Smuzhiyun- **imfillTask**: Added fast image filling operation to RGA image job.
767*4882a593Smuzhiyun- **imfillTaskArray**: Added multiple groups of fast image filling operation to RGA image job.
768*4882a593Smuzhiyun- **imrectangle**: Call RGA for fast drawing operation of equidistant rectangle border.
769*4882a593Smuzhiyun- **imrectangleArray**: Call RGA for multiple groups of fast drawing operation of equidistant rectangle border.
770*4882a593Smuzhiyun- **imrectangleTask**: Added fast drawing operation of equidistant rectangle border operation to RGA image job.
771*4882a593Smuzhiyun- **imrectangleTaskArray**: Added multiple groups of fast drawing operation of equidistant rectangle border operation to RGA image job.
772*4882a593Smuzhiyun- **immakeBorder**: Call RGA for fast drawing operation of the border.
773*4882a593Smuzhiyun- **immosaic**: call RGA for fast mosaic masking.
774*4882a593Smuzhiyun- **immosaicArray**: call RGA for fast multiple groups of mosaic masking.
775*4882a593Smuzhiyun- **immosaicTask**:Added fast mosaic masking operation to RGA image job.
776*4882a593Smuzhiyun- **immosaicTaskArray**:Added fast multiple groups of mosaic masking operation to RGA image job.
777*4882a593Smuzhiyun- **improcess**: Call RGA for fast image compound processing.
778*4882a593Smuzhiyun- **improcessTask**: Added fast image compound processing operation to RGA image job.
779*4882a593Smuzhiyun- **imcheck**: Verify whether the parameters are valid and whether the current hardware supports the operation.
780*4882a593Smuzhiyun- **imsync**: Synchronize task completion status in asynchronous mode.
781*4882a593Smuzhiyun- **imconfig**: Add default configuration to current thread context.
782*4882a593Smuzhiyun
783*4882a593Smuzhiyun
784*4882a593Smuzhiyun
785*4882a593Smuzhiyun### Obtain RGA Version and Support Information
786*4882a593Smuzhiyun
787*4882a593Smuzhiyun#### querystring
788*4882a593Smuzhiyun
789*4882a593Smuzhiyun```C++
790*4882a593Smuzhiyunconst char* querystring(int name);
791*4882a593Smuzhiyun```
792*4882a593Smuzhiyun
793*4882a593Smuzhiyun> Query RGA basic information and resolution format.
794*4882a593Smuzhiyun
795*4882a593Smuzhiyun| **Parameters** | **Description**                                              |
796*4882a593Smuzhiyun| -------------- | ------------------------------------------------------------ |
797*4882a593Smuzhiyun| name           | RGA_VENDOR                 - vendor information<br/>RGA_VERSION                 - RGA version<br/>RGA_MAX_INPUT            - max input resolution<br/>RGA_MAX_OUTPUT        - max output resolution<br/>RGA_BYTE_STRIDE          - stride alignment requirements<br/>RGA_SCALE_LIMIT           - scale limit<br/>RGA_INPUT_FORMAT     - input formats supported<br/>RGA_OUTPUT_FORMAT - output formats supported<br/>RGA_EXPECTED               - expected performance<br/>RGA_ALL                           - print all information |
798*4882a593Smuzhiyun
799*4882a593Smuzhiyun **Returns** a string describing properties of RGA.
800*4882a593Smuzhiyun
801*4882a593Smuzhiyun
802*4882a593Smuzhiyun
803*4882a593Smuzhiyun### header version check
804*4882a593Smuzhiyun
805*4882a593Smuzhiyun#### imcheckHeader
806*4882a593Smuzhiyun
807*4882a593Smuzhiyun```C++
808*4882a593SmuzhiyunIM_API IM_STATUS imcheckHeader(im_api_version_t header_version = RGA_CURRENT_API_HEADER_VERSION);
809*4882a593Smuzhiyun```
810*4882a593Smuzhiyun
811*4882a593Smuzhiyun> Verify the difference between the currently used header file version and the librga version.
812*4882a593Smuzhiyun
813*4882a593Smuzhiyun| **Parameters** | **Description**                                              |
814*4882a593Smuzhiyun| -------------- | ------------------------------------------------------------ |
815*4882a593Smuzhiyun| header_version | Header file version, usually use the macro RGA_CURRENT_API_HEADER_VERSION. |
816*4882a593Smuzhiyun
817*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
818*4882a593Smuzhiyun
819*4882a593Smuzhiyun
820*4882a593Smuzhiyun
821*4882a593Smuzhiyun### Image Buffer Preprocessing
822*4882a593Smuzhiyun
823*4882a593Smuzhiyun#### importbuffer_T
824*4882a593Smuzhiyun
825*4882a593Smuzhiyun> For external memory that requires RGA processing, you can use importbuffer_T to map physical address of buffer to RGA driver and obtain the corresponding address of buffer, facilitating the subsequent stable and fast RGA call to complete the work.
826*4882a593Smuzhiyun
827*4882a593Smuzhiyun| **Parameters(T)**    | Data Type       | Description                                                  |
828*4882a593Smuzhiyun| -------------------- | --------------- | ------------------------------------------------------------ |
829*4882a593Smuzhiyun| virtual address      | void *          | image buffer virtual address                                          |
830*4882a593Smuzhiyun| physical address     | uint64_t        | contiguous physical address of image buffer                                     |
831*4882a593Smuzhiyun| fd                   | int             | image buffer DMA file descriptor                                    |
832*4882a593Smuzhiyun| GraphicBuffer handle | buffer_handle_t | image buffer handle, containing buffer address, file descriptor, resolution and format |
833*4882a593Smuzhiyun| GraphicBuffer        | GraphicBuffer   | android graphic buffer                                       |
834*4882a593Smuzhiyun| AHardwareBuffer      | AHardwareBuffer | chunks of memory that can be accessed by various hardware components in the system. https://developer.android.com/ndk/reference/group/a-hardware-buffer |
835*4882a593Smuzhiyun
836*4882a593Smuzhiyun> Performance varies when different buffer types call RGA, and the performance order is shown below:
837*4882a593Smuzhiyun>
838*4882a593Smuzhiyun> physical address > fd > virtual address
839*4882a593Smuzhiyun>
840*4882a593Smuzhiyun> The recommended buffer type is fd.
841*4882a593Smuzhiyun
842*4882a593Smuzhiyun```c++
843*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_fd(int fd, int size);
844*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_virtualaddr(void *va, int size);
845*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_physicaladdr(uint64_t pa, int size);
846*4882a593Smuzhiyun```
847*4882a593Smuzhiyun
848*4882a593Smuzhiyun| Parameter | **Description**                |
849*4882a593Smuzhiyun| --------- | ------------------------------ |
850*4882a593Smuzhiyun| fd/va/pa  | **[required]** external buffer |
851*4882a593Smuzhiyun| size      | **[required]** memory size     |
852*4882a593Smuzhiyun
853*4882a593Smuzhiyun```c++
854*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_fd(int fd, int width, int height, int format);
855*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_virtualaddr(void *va, int width, int height, int format);
856*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_physicaladdr(uint64_t pa, int width, int height, int format);
857*4882a593Smuzhiyun```
858*4882a593Smuzhiyun
859*4882a593Smuzhiyun| Parameter | **Description**                                        |
860*4882a593Smuzhiyun| --------- | ------------------------------------------------------ |
861*4882a593Smuzhiyun| fd/va/pa  | **[required]** external buffer                         |
862*4882a593Smuzhiyun| width     | **[required]** pixel width stride of the image buffer  |
863*4882a593Smuzhiyun| height    | **[required]** pixel height stride of the image buffer |
864*4882a593Smuzhiyun| format    | **[required]** pixel format of the image buffer        |
865*4882a593Smuzhiyun
866*4882a593Smuzhiyun```c++
867*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_fd(int fd, im_handle_param_t *param);
868*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_virtualaddr(void *va, im_handle_param_t *param);
869*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_physicaladdr(uint64_t pa, im_handle_param_t *param);
870*4882a593Smuzhiyun```
871*4882a593Smuzhiyun
872*4882a593Smuzhiyun| Parameter | **Description**                            |
873*4882a593Smuzhiyun| --------- | ------------------------------------------ |
874*4882a593Smuzhiyun| fd/va/pa  | **[required]** external buffer             |
875*4882a593Smuzhiyun| param     | **[required]** configure buffer parameters |
876*4882a593Smuzhiyun
877*4882a593Smuzhiyun```c++
878*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_GraphicBuffer_handle(buffer_handle_t hnd);
879*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_GraphicBuffer(sp<GraphicBuffer> buf);
880*4882a593SmuzhiyunIM_API rga_buffer_handle_t importbuffer_AHardwareBuffer(AHardwareBuffer *buf);
881*4882a593Smuzhiyun```
882*4882a593Smuzhiyun
883*4882a593Smuzhiyun| Parameter | **Description**                |
884*4882a593Smuzhiyun| --------- | ------------------------------ |
885*4882a593Smuzhiyun| hnd/buf   | **[required]** external buffer |
886*4882a593Smuzhiyun
887*4882a593Smuzhiyun**Returns** rga_buffer_handle_t to describe the memory handle.
888*4882a593Smuzhiyun
889*4882a593Smuzhiyun
890*4882a593Smuzhiyun
891*4882a593Smuzhiyun#### releasebuffer_handle
892*4882a593Smuzhiyun
893*4882a593Smuzhiyun> After finishing calling RGA using external memory, you need to call releasebuffer_handle through memory handle to remove the mapping and binding between buffer and RGA driver, and release the resource inside RGA driver.
894*4882a593Smuzhiyun
895*4882a593Smuzhiyun```c++
896*4882a593SmuzhiyunIM_API IM_STATUS releasebuffer_handle(rga_buffer_handle_t handle);
897*4882a593Smuzhiyun```
898*4882a593Smuzhiyun
899*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
900*4882a593Smuzhiyun
901*4882a593Smuzhiyun
902*4882a593Smuzhiyun
903*4882a593Smuzhiyun#### wrapbuffer_handle
904*4882a593Smuzhiyun
905*4882a593Smuzhiyun> In IM2D library API parameters, input image and output image should support multiple types, which mainly include memory, image format, image width and height. Before performing corresponding image operation, you need to call wrapbuffer_handle to convert the input and output image parameters into rga_buffer_t structure as the input parameter of user API.
906*4882a593Smuzhiyun
907*4882a593Smuzhiyun```C++
908*4882a593Smuzhiyunrga_buffer_t wrapbuffer_handle(rga_buffer_handle_t handle,
909*4882a593Smuzhiyun                               int width,
910*4882a593Smuzhiyun                               int height,
911*4882a593Smuzhiyun                               int format,
912*4882a593Smuzhiyun                               int wstride = width,
913*4882a593Smuzhiyun                               int hstride = height);
914*4882a593Smuzhiyun```
915*4882a593Smuzhiyun| Parameter | **Description**                                              |
916*4882a593Smuzhiyun| --------- | ------------------------------------------------------------ |
917*4882a593Smuzhiyun| handle    | **[required]** RGA buffer handle                             |
918*4882a593Smuzhiyun| width     | **[required]** pixel width of the image that needs to be processed |
919*4882a593Smuzhiyun| height    | **[required]** pixel height of the image that needs to be processed |
920*4882a593Smuzhiyun| format    | **[required]** pixel format                                  |
921*4882a593Smuzhiyun| wtride    | **[optional]** pixel width stride of the image               |
922*4882a593Smuzhiyun| hstride   | **[optional]** pixel width stride of the image               |
923*4882a593Smuzhiyun
924*4882a593Smuzhiyun **Returns** a rga_buffer_t to desribe image information.
925*4882a593Smuzhiyun
926*4882a593Smuzhiyun
927*4882a593Smuzhiyun
928*4882a593Smuzhiyun### Image processing job create
929*4882a593Smuzhiyun
930*4882a593Smuzhiyun#### imbeginJob
931*4882a593Smuzhiyun
932*4882a593Smuzhiyun```c++
933*4882a593SmuzhiyunIM_API im_job_handle_t imbeginJob(uint64_t flags = 0);
934*4882a593Smuzhiyun```
935*4882a593Smuzhiyun
936*4882a593Smuzhiyun> Create an RGA image processing job, which will return a job handle, job_handle can be used to add/remove RGA image operations, submit/execute the job.
937*4882a593Smuzhiyun
938*4882a593Smuzhiyun| Parameter | **Description**          |
939*4882a593Smuzhiyun| --------- | ------------------------ |
940*4882a593Smuzhiyun| flags     | **[optional]** job flags |
941*4882a593Smuzhiyun
942*4882a593Smuzhiyun**Returns** im_job_handle_t to describe the job handle.
943*4882a593Smuzhiyun
944*4882a593Smuzhiyun
945*4882a593Smuzhiyun
946*4882a593Smuzhiyun### Image processing job submit
947*4882a593Smuzhiyun
948*4882a593Smuzhiyun#### imendJob
949*4882a593Smuzhiyun
950*4882a593Smuzhiyun```c++
951*4882a593SmuzhiyunIM_API IM_STATUS imendJob(im_job_handle_t job_handle,
952*4882a593Smuzhiyun                          int sync_mode = IM_SYNC,
953*4882a593Smuzhiyun                          int acquire_fence_fd = 0,
954*4882a593Smuzhiyun                          int *release_fence_fd = NULL);
955*4882a593Smuzhiyun```
956*4882a593Smuzhiyun
957*4882a593Smuzhiyun> Submit and execute RGA image processing job. When the job is complete, the currently completed RGA image processing job resource is deleted.
958*4882a593Smuzhiyun
959*4882a593Smuzhiyun| Parameter        | **Description**                                              |
960*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
961*4882a593Smuzhiyun| job_handle       | **[required]** job handle                                    |
962*4882a593Smuzhiyun| sync_mode        | **[optional]** wait until operation complete                 |
963*4882a593Smuzhiyun| acquire_fence_fd | **[optional]** Used in async mode, run the job after waiting foracquire_fence signal |
964*4882a593Smuzhiyun| release_fence_fd | **[optional]** Used in async mode, as a parameter of imsync() |
965*4882a593Smuzhiyun
966*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
967*4882a593Smuzhiyun
968*4882a593Smuzhiyun
969*4882a593Smuzhiyun
970*4882a593Smuzhiyun### Image processing job cancel
971*4882a593Smuzhiyun
972*4882a593Smuzhiyun#### imcancelJob
973*4882a593Smuzhiyun
974*4882a593Smuzhiyun```c++
975*4882a593SmuzhiyunIM_API IM_STATUS imcancelJob(im_job_handle_t job_handle);
976*4882a593Smuzhiyun```
977*4882a593Smuzhiyun
978*4882a593Smuzhiyun> cancel and delete RGA image processing job.
979*4882a593Smuzhiyun
980*4882a593Smuzhiyun| Parameter  | **Description**           |
981*4882a593Smuzhiyun| ---------- | ------------------------- |
982*4882a593Smuzhiyun| job_handle | **[required]** job handle |
983*4882a593Smuzhiyun
984*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
985*4882a593Smuzhiyun
986*4882a593Smuzhiyun
987*4882a593Smuzhiyun
988*4882a593Smuzhiyun### Image Copy
989*4882a593Smuzhiyun
990*4882a593Smuzhiyun#### imcopy
991*4882a593Smuzhiyun
992*4882a593Smuzhiyun```C++
993*4882a593SmuzhiyunIM_STATUS imcopy(const rga_buffer_t src,
994*4882a593Smuzhiyun                 rga_buffer_t dst,
995*4882a593Smuzhiyun                 int sync = 1),
996*4882a593Smuzhiyun                 int *release_fence_fd = NULL);
997*4882a593Smuzhiyun```
998*4882a593Smuzhiyun
999*4882a593Smuzhiyun> Copy the image, RGA basic operation. Its function is similar to memcpy.
1000*4882a593Smuzhiyun
1001*4882a593Smuzhiyun| Parameter        | **Description**                                              |
1002*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1003*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1004*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1005*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1006*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1007*4882a593Smuzhiyun
1008*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1009*4882a593Smuzhiyun
1010*4882a593Smuzhiyun
1011*4882a593Smuzhiyun
1012*4882a593Smuzhiyun#### imcopyTask
1013*4882a593Smuzhiyun
1014*4882a593Smuzhiyun```C++
1015*4882a593SmuzhiyunIM_API IM_STATUS imcopyTask(im_job_handle_t job_handle,
1016*4882a593Smuzhiyun                            const rga_buffer_t src,
1017*4882a593Smuzhiyun                            rga_buffer_t dst);
1018*4882a593Smuzhiyun```
1019*4882a593Smuzhiyun
1020*4882a593Smuzhiyun> Add an image copy operation to the specified job through job_handle. The configuration parameters are the same as imcopy.
1021*4882a593Smuzhiyun
1022*4882a593Smuzhiyun| Parameter  | **Description**             |
1023*4882a593Smuzhiyun| ---------- | --------------------------- |
1024*4882a593Smuzhiyun| job_handle | **[required]** job handle   |
1025*4882a593Smuzhiyun| src        | **[required]** input image  |
1026*4882a593Smuzhiyun| dst        | **[required]** output image |
1027*4882a593Smuzhiyun
1028*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1029*4882a593Smuzhiyun
1030*4882a593Smuzhiyun
1031*4882a593Smuzhiyun
1032*4882a593Smuzhiyun### Image Resizing and Image Pyramid
1033*4882a593Smuzhiyun
1034*4882a593Smuzhiyun#### imresize
1035*4882a593Smuzhiyun
1036*4882a593Smuzhiyun```C++
1037*4882a593SmuzhiyunIM_STATUS
1038*4882a593Smuzhiyunimresize(const rga_buffer_t src,
1039*4882a593Smuzhiyun         rga_buffer_t dst,
1040*4882a593Smuzhiyun         double fx = 0,
1041*4882a593Smuzhiyun         double fy = 0,
1042*4882a593Smuzhiyun         int interpolation = INTER_LINEAR,
1043*4882a593Smuzhiyun         int sync = 1,
1044*4882a593Smuzhiyun         int *release_fence_fd = NULL);
1045*4882a593Smuzhiyun```
1046*4882a593Smuzhiyun
1047*4882a593Smuzhiyun> According to different scenario, you can choose to configure dst to describe the output image size of resizing, or configure the scale factor fx/fy to resize at a specified ratio. When dst and fx/fy are configured at the same time, the calculated result of fx/fy is used as the output image size.
1048*4882a593Smuzhiyun>
1049*4882a593Smuzhiyun> Only hardware version RGA1/RGA1 plus supports interpolation configuration.
1050*4882a593Smuzhiyun>
1051*4882a593Smuzhiyun> Note: When resizing with fx/fy, format such as YUV that requires width and height alignment will force downward alignment to meet the requirements. Using this feature may affect the expected resizing effect.
1052*4882a593Smuzhiyun
1053*4882a593Smuzhiyun| Parameters       | Description                                                  |
1054*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1055*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1056*4882a593Smuzhiyun| dst              | **[required]** output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src. |
1057*4882a593Smuzhiyun| fx               | **[optional]** scale factor along the horizontal axis; when it equals 0, it is computed as:<br/>fx = (double) dst.width / src.width |
1058*4882a593Smuzhiyun| fy               | **[optional]** scale factor along the vertical axis; when it equals 0, it is computed as:<br/>fy = (double) dst.height / src.height |
1059*4882a593Smuzhiyun| interpolation    | **[optional]** interpolation method:<br/>INTER_NEAREST - a nearest-neighbor interpolation<br/>INTER_LINEAR - a bilinear interpolation (used by default)<br/>INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood |
1060*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1061*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1062*4882a593Smuzhiyun
1063*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1064*4882a593Smuzhiyun
1065*4882a593Smuzhiyun
1066*4882a593Smuzhiyun
1067*4882a593Smuzhiyun#### impyramid
1068*4882a593Smuzhiyun
1069*4882a593Smuzhiyun```C++
1070*4882a593SmuzhiyunIM_STATUS impyramid (const rga_buffer_t src,
1071*4882a593Smuzhiyun                     rga_buffer_t dst,
1072*4882a593Smuzhiyun                     IM_SCALE direction)
1073*4882a593Smuzhiyun```
1074*4882a593Smuzhiyun
1075*4882a593Smuzhiyun> Pyramid scaling. Scale by 1/2 or twice, depending on the direction width and height.
1076*4882a593Smuzhiyun
1077*4882a593Smuzhiyun| Parameters       | Description                                                  |
1078*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1079*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1080*4882a593Smuzhiyun| dst              | **[required]** output image;                                 |
1081*4882a593Smuzhiyun| direction        | **[required]** scale mode<br/>IM_UP_SCALE  ——  up scale <br/>IM_DOWN_SCALE —— down scale |
1082*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1083*4882a593Smuzhiyun
1084*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1085*4882a593Smuzhiyun
1086*4882a593Smuzhiyun
1087*4882a593Smuzhiyun
1088*4882a593Smuzhiyun#### imresizeTask
1089*4882a593Smuzhiyun
1090*4882a593Smuzhiyun```C++
1091*4882a593SmuzhiyunIM_API IM_STATUS imresizeTask(im_job_handle_t job_handle,
1092*4882a593Smuzhiyun                              const rga_buffer_t src,
1093*4882a593Smuzhiyun                              rga_buffer_t dst,
1094*4882a593Smuzhiyun                              double fx = 0,
1095*4882a593Smuzhiyun                              double fy = 0,
1096*4882a593Smuzhiyun                              int interpolation = 0);
1097*4882a593Smuzhiyun```
1098*4882a593Smuzhiyun
1099*4882a593Smuzhiyun> Add an image resize operation to the specified job through job_handle. The configuration parameters are the same as imresize.
1100*4882a593Smuzhiyun
1101*4882a593Smuzhiyun| Parameters    | Description                                                  |
1102*4882a593Smuzhiyun| ------------- | ------------------------------------------------------------ |
1103*4882a593Smuzhiyun| job_handle    | **[required]** job handle                                    |
1104*4882a593Smuzhiyun| src           | **[required]** input image                                   |
1105*4882a593Smuzhiyun| dst           | **[required]** output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src. |
1106*4882a593Smuzhiyun| fx            | **[optional]** scale factor along the horizontal axis; when it equals 0, it is computed as:<br/>fx = (double) dst.width / src.width |
1107*4882a593Smuzhiyun| fy            | **[optional]** scale factor along the vertical axis; when it equals 0, it is computed as:<br/>fy = (double) dst.height / src.height |
1108*4882a593Smuzhiyun| interpolation | **[optional]** interpolation method:<br/>INTER_NEAREST - a nearest-neighbor interpolation<br/>INTER_LINEAR - a bilinear interpolation (used by default)<br/>INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood |
1109*4882a593Smuzhiyun
1110*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1111*4882a593Smuzhiyun
1112*4882a593Smuzhiyun
1113*4882a593Smuzhiyun
1114*4882a593Smuzhiyun### Image Cropping
1115*4882a593Smuzhiyun
1116*4882a593Smuzhiyun#### imcrop
1117*4882a593Smuzhiyun
1118*4882a593Smuzhiyun```C++
1119*4882a593SmuzhiyunIM_STATUS imcrop(const rga_buffer_t src,
1120*4882a593Smuzhiyun                 rga_buffer_t dst,
1121*4882a593Smuzhiyun                 im_rect rect,
1122*4882a593Smuzhiyun                 int sync = 1,
1123*4882a593Smuzhiyun                 int *release_fence_fd = NULL);
1124*4882a593Smuzhiyun```
1125*4882a593Smuzhiyun
1126*4882a593Smuzhiyun> Perform image clipping by specifying the size of the region.
1127*4882a593Smuzhiyun
1128*4882a593Smuzhiyun| Parameter        | Description                                                  |
1129*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1130*4882a593Smuzhiyun| src              | **[required] **input image                                   |
1131*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1132*4882a593Smuzhiyun| rect             | **[required]** crop region<br/>x - upper-left x coordinate<br/>y - upper-left y coordinate<br/>width - region width<br/>height - region height |
1133*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1134*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1135*4882a593Smuzhiyun
1136*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1137*4882a593Smuzhiyun
1138*4882a593Smuzhiyun
1139*4882a593Smuzhiyun
1140*4882a593Smuzhiyun#### imcropTask
1141*4882a593Smuzhiyun
1142*4882a593Smuzhiyun```C++
1143*4882a593SmuzhiyunIM_API IM_STATUS imcropTask(im_job_handle_t job_handle,
1144*4882a593Smuzhiyun                            const rga_buffer_t src,
1145*4882a593Smuzhiyun                            rga_buffer_t dst,
1146*4882a593Smuzhiyun                            im_rect rect);
1147*4882a593Smuzhiyun```
1148*4882a593Smuzhiyun
1149*4882a593Smuzhiyun> Add an image crop operation to the specified job through job_handle. The configuration parameters are the same as imcrop.
1150*4882a593Smuzhiyun
1151*4882a593Smuzhiyun| Parameter  | Description                                                  |
1152*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1153*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1154*4882a593Smuzhiyun| src        | **[required] **input image                                   |
1155*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1156*4882a593Smuzhiyun| rect       | **[required]** crop region<br/>x - upper-left x coordinate<br/>y - upper-left y coordinate<br/>width - region width<br/>height - region height |
1157*4882a593Smuzhiyun
1158*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1159*4882a593Smuzhiyun
1160*4882a593Smuzhiyun
1161*4882a593Smuzhiyun
1162*4882a593Smuzhiyun### Image Translation
1163*4882a593Smuzhiyun
1164*4882a593Smuzhiyun#### imtranslate
1165*4882a593Smuzhiyun
1166*4882a593Smuzhiyun```C++
1167*4882a593SmuzhiyunIM_STATUS imtranslate(const rga_buffer_t src,
1168*4882a593Smuzhiyun                      rga_buffer_t dst,
1169*4882a593Smuzhiyun                      int x,
1170*4882a593Smuzhiyun                      int y,
1171*4882a593Smuzhiyun                      int sync = 1,
1172*4882a593Smuzhiyun                      int *release_fence_fd = NULL);
1173*4882a593Smuzhiyun```
1174*4882a593Smuzhiyun
1175*4882a593Smuzhiyun> Image translation. Move to (x, y) position, the width and height of src and dst must be the same, the excess part will be clipped.
1176*4882a593Smuzhiyun
1177*4882a593Smuzhiyun| Parameter        | Description                                                  |
1178*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1179*4882a593Smuzhiyun| src              | **[required]**input image                                    |
1180*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1181*4882a593Smuzhiyun| x                | **[optional]** horizontal translation                        |
1182*4882a593Smuzhiyun| y                | **[optional]** vertical translation                          |
1183*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1184*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1185*4882a593Smuzhiyun
1186*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1187*4882a593Smuzhiyun
1188*4882a593Smuzhiyun
1189*4882a593Smuzhiyun
1190*4882a593Smuzhiyun#### imtranslateTask
1191*4882a593Smuzhiyun
1192*4882a593Smuzhiyun```C++
1193*4882a593SmuzhiyunIM_API IM_STATUS imtranslateTask(im_job_handle_t job_handle,
1194*4882a593Smuzhiyun                                 const rga_buffer_t src,
1195*4882a593Smuzhiyun                                 rga_buffer_t dst,
1196*4882a593Smuzhiyun                                 int x,
1197*4882a593Smuzhiyun                                 int y);
1198*4882a593Smuzhiyun```
1199*4882a593Smuzhiyun
1200*4882a593Smuzhiyun> Add an image translation operation to the specified job through job_handle. The configuration parameters are the same as imtranslate.
1201*4882a593Smuzhiyun
1202*4882a593Smuzhiyun| Parameter  | Description                           |
1203*4882a593Smuzhiyun| ---------- | ------------------------------------- |
1204*4882a593Smuzhiyun| job_handle | **[required]** job handle             |
1205*4882a593Smuzhiyun| src        | **[required]**input image             |
1206*4882a593Smuzhiyun| dst        | **[required]** output image           |
1207*4882a593Smuzhiyun| x          | **[required]** horizontal translation |
1208*4882a593Smuzhiyun| y          | **[required]** vertical translation   |
1209*4882a593Smuzhiyun
1210*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1211*4882a593Smuzhiyun
1212*4882a593Smuzhiyun
1213*4882a593Smuzhiyun
1214*4882a593Smuzhiyun### Image Format Conversion
1215*4882a593Smuzhiyun
1216*4882a593Smuzhiyun#### imcvtcolor
1217*4882a593Smuzhiyun
1218*4882a593Smuzhiyun```C++
1219*4882a593SmuzhiyunIM_STATUS imcvtcolor(rga_buffer_t src,
1220*4882a593Smuzhiyun                     rga_buffer_t dst,
1221*4882a593Smuzhiyun                     int sfmt,
1222*4882a593Smuzhiyun                     int dfmt,
1223*4882a593Smuzhiyun                     int mode = IM_COLOR_SPACE_DEFAULT,
1224*4882a593Smuzhiyun                     int sync = 1,
1225*4882a593Smuzhiyun                     int *release_fence_fd = NULL);
1226*4882a593Smuzhiyun```
1227*4882a593Smuzhiyun
1228*4882a593Smuzhiyun> Image format conversion,specific format support varies according to soc, please refer to the **Image Format Supported** section.
1229*4882a593Smuzhiyun>
1230*4882a593Smuzhiyun> The format can be set by rga_buffer_t, or configure the input image and output image formats respectively by sfmt/dfmt. When it comes to YUV/RGB color gamut conversion, you can configure the converted color gamut through mode, and the conversion is performed according to the BT.601 limit range by default.
1231*4882a593Smuzhiyun
1232*4882a593Smuzhiyun| parameter        | Description                                                  |
1233*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1234*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1235*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1236*4882a593Smuzhiyun| sfmt             | **[optional]** source image format                           |
1237*4882a593Smuzhiyun| dfmt             | **[optional]** destination image format                      |
1238*4882a593Smuzhiyun| Mode             | **[optional]** color space mode:<br/>IM_YUV_TO_RGB_BT601_LIMIT<br/>IM_YUV_TO_RGB_BT601_FULL<br/>IM_YUV_TO_RGB_BT709_LIMIT<br/>IM_RGB_TO_YUV_BT601_LIMIT<br/>IM_RGB_TO_YUV_BT601_FULL<br/>IM_RGB_TO_YUV_BT709_LIMIT |
1239*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1240*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1241*4882a593Smuzhiyun
1242*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1243*4882a593Smuzhiyun
1244*4882a593Smuzhiyun
1245*4882a593Smuzhiyun
1246*4882a593Smuzhiyun#### imcvtcolorTask
1247*4882a593Smuzhiyun
1248*4882a593Smuzhiyun```C++
1249*4882a593SmuzhiyunIM_API IM_STATUS imcvtcolorTask(im_job_handle_t job_handle,
1250*4882a593Smuzhiyun                                rga_buffer_t src,
1251*4882a593Smuzhiyun                                rga_buffer_t dst,
1252*4882a593Smuzhiyun                                int sfmt,
1253*4882a593Smuzhiyun                                int dfmt,
1254*4882a593Smuzhiyun                                int mode = IM_COLOR_SPACE_DEFAULT);
1255*4882a593Smuzhiyun```
1256*4882a593Smuzhiyun
1257*4882a593Smuzhiyun> Add an image format conversion operation to the specified job through job_handle. The configuration parameters are the same as imcvtcolor.
1258*4882a593Smuzhiyun
1259*4882a593Smuzhiyun| parameter  | Description                                                  |
1260*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1261*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1262*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1263*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1264*4882a593Smuzhiyun| sfmt       | **[optional]** source image format                           |
1265*4882a593Smuzhiyun| dfmt       | **[optional]** destination image format                      |
1266*4882a593Smuzhiyun| Mode       | **[optional]** color space mode:<br/>IM_YUV_TO_RGB_BT601_LIMIT<br/>IM_YUV_TO_RGB_BT601_FULL<br/>IM_YUV_TO_RGB_BT709_LIMIT<br/>IM_RGB_TO_YUV_BT601_LIMIT<br/>IM_RGB_TO_YUV_BT601_FULL<br/>IM_RGB_TO_YUV_BT709_LIMIT |
1267*4882a593Smuzhiyun
1268*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1269*4882a593Smuzhiyun
1270*4882a593Smuzhiyun
1271*4882a593Smuzhiyun
1272*4882a593Smuzhiyun### Image Rotation
1273*4882a593Smuzhiyun
1274*4882a593Smuzhiyun#### imrotate
1275*4882a593Smuzhiyun
1276*4882a593Smuzhiyun```c++
1277*4882a593SmuzhiyunIM_STATUS imrotate(const rga_buffer_t src,
1278*4882a593Smuzhiyun                   rga_buffer_t dst,
1279*4882a593Smuzhiyun                   int rotation,
1280*4882a593Smuzhiyun                   int sync = 1,
1281*4882a593Smuzhiyun                   int *release_fence_fd = NULL);
1282*4882a593Smuzhiyun```
1283*4882a593Smuzhiyun
1284*4882a593Smuzhiyun
1285*4882a593Smuzhiyun>  Support image rotation 90,180,270 degrees.
1286*4882a593Smuzhiyun
1287*4882a593Smuzhiyun| Parameter        | Description                                                  |
1288*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1289*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1290*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1291*4882a593Smuzhiyun| rotation         | **[required]** rotation angle:<br/>0<br/>IM_HAL_TRANSFORM_ROT_90<br/>IM_HAL_TRANSFORM_ROT_180<br/>IM_HAL_TRANSFORM_ROT_270 |
1292*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1293*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1294*4882a593Smuzhiyun
1295*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1296*4882a593Smuzhiyun
1297*4882a593Smuzhiyun
1298*4882a593Smuzhiyun
1299*4882a593Smuzhiyun#### imrotateTask
1300*4882a593Smuzhiyun
1301*4882a593Smuzhiyun```c++
1302*4882a593SmuzhiyunIM_API IM_STATUS imrotateTask(im_job_handle_t job_handle,
1303*4882a593Smuzhiyun                              const rga_buffer_t src,
1304*4882a593Smuzhiyun                              rga_buffer_t dst,
1305*4882a593Smuzhiyun                              int rotation);
1306*4882a593Smuzhiyun```
1307*4882a593Smuzhiyun
1308*4882a593Smuzhiyun>Add an image rotation operation to the specified job through job_handle. The configuration parameters are the same as imrotate.
1309*4882a593Smuzhiyun
1310*4882a593Smuzhiyun| Parameter  | Description                                                  |
1311*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1312*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1313*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1314*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1315*4882a593Smuzhiyun| rotation   | **[required]** rotation angle:<br/>IM_HAL_TRANSFORM_ROT_90<br/>IM_HAL_TRANSFORM_ROT_180<br/>IM_HAL_TRANSFORM_ROT_270 |
1316*4882a593Smuzhiyun
1317*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1318*4882a593Smuzhiyun
1319*4882a593Smuzhiyun
1320*4882a593Smuzhiyun
1321*4882a593Smuzhiyun### Image Mirror Flip
1322*4882a593Smuzhiyun
1323*4882a593Smuzhiyun#### imfilp
1324*4882a593Smuzhiyun
1325*4882a593Smuzhiyun```c++
1326*4882a593SmuzhiyunIM_STATUS imflip (const rga_buffer_t src,
1327*4882a593Smuzhiyun                  rga_buffer_t dst,
1328*4882a593Smuzhiyun                  int mode,
1329*4882a593Smuzhiyun                  int sync = 1,
1330*4882a593Smuzhiyun                  int *release_fence_fd = NULL);
1331*4882a593Smuzhiyun```
1332*4882a593Smuzhiyun
1333*4882a593Smuzhiyun> Support image to do horizontal, vertical mirror flip.
1334*4882a593Smuzhiyun
1335*4882a593Smuzhiyun| Parameter        | Description                                                  |
1336*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1337*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1338*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1339*4882a593Smuzhiyun| mode             | **[optional]** flip mode:<br/>0<br/>IM_HAL_TRANSFORM_FLIP_H<br/>IM_HAL_TRANSFORM_FLIP_V<br/> |
1340*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1341*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1342*4882a593Smuzhiyun
1343*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1344*4882a593Smuzhiyun
1345*4882a593Smuzhiyun
1346*4882a593Smuzhiyun
1347*4882a593Smuzhiyun#### imflipTask
1348*4882a593Smuzhiyun
1349*4882a593Smuzhiyun```c++
1350*4882a593SmuzhiyunIM_API IM_STATUS imflipTask(im_job_handle_t job_handle,
1351*4882a593Smuzhiyun                            const rga_buffer_t src,
1352*4882a593Smuzhiyun                            rga_buffer_t dst,
1353*4882a593Smuzhiyun                            int mode);
1354*4882a593Smuzhiyun```
1355*4882a593Smuzhiyun
1356*4882a593Smuzhiyun> Add an image flip operation to the specified job through job_handle. The configuration parameters are the same as imflip.
1357*4882a593Smuzhiyun
1358*4882a593Smuzhiyun| Parameter  | Description                                                  |
1359*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1360*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1361*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1362*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1363*4882a593Smuzhiyun| mode       | **[required]** flip mode:<br/>IM_HAL_TRANSFORM_FLIP_H_V<br/>IM_HAL_TRANSFORM_FLIP_H<br/>IM_HAL_TRANSFORM_FLIP_V |
1364*4882a593Smuzhiyun
1365*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1366*4882a593Smuzhiyun
1367*4882a593Smuzhiyun
1368*4882a593Smuzhiyun
1369*4882a593Smuzhiyun### Image Blending
1370*4882a593Smuzhiyun
1371*4882a593Smuzhiyun#### imblend/imcomposite
1372*4882a593Smuzhiyun
1373*4882a593Smuzhiyun```c++
1374*4882a593SmuzhiyunIM_STATUS imblend(const rga_buffer_t srcA,
1375*4882a593Smuzhiyun                  rga_buffer_t dst,
1376*4882a593Smuzhiyun                  int mode = IM_ALPHA_BLEND_SRC_OVER,
1377*4882a593Smuzhiyun                  int sync = 1,
1378*4882a593Smuzhiyun                  int *release_fence_fd = NULL);
1379*4882a593Smuzhiyun```
1380*4882a593Smuzhiyun
1381*4882a593Smuzhiyun> RGA uses A+B -> B image two-channel blending mode to perform Alpha superposition for foreground image (srcA channel) and background image (dst channel) according to the configured blending model, and output the blending result to dst channel. When no mode is configured, it is set to src-over mode by default.
1382*4882a593Smuzhiyun
1383*4882a593Smuzhiyun```c++
1384*4882a593SmuzhiyunIM_STATUS imcomposite(const rga_buffer_t srcA,
1385*4882a593Smuzhiyun                      const rga_buffer_t srcB,
1386*4882a593Smuzhiyun                      rga_buffer_t dst,
1387*4882a593Smuzhiyun                      int mode = IM_ALPHA_BLEND_SRC_OVER,
1388*4882a593Smuzhiyun                      int sync = 1,
1389*4882a593Smuzhiyun                      int *release_fence_fd = NULL);
1390*4882a593Smuzhiyun```
1391*4882a593Smuzhiyun
1392*4882a593Smuzhiyun> RGA uses A+B -> C image three-channel blending mode to perform Alpha superposition for foreground image (srcA channel) and background image (srcB channel) according to the configured blending model, and output the blending result to dst channel.
1393*4882a593Smuzhiyun
1394*4882a593Smuzhiyunmode in the two image blending modes can be configured with different **Porter-Duff blending model**:
1395*4882a593Smuzhiyun
1396*4882a593Smuzhiyun> Before describing the Porter-Duff blending model, give the following definitions:
1397*4882a593Smuzhiyun>
1398*4882a593Smuzhiyun> - S -**Marks the source image in two blended images**,namely the foreground image, short for source.
1399*4882a593Smuzhiyun> - D -**Marks the destination image in two blended images**,namely the background image, short for destination.
1400*4882a593Smuzhiyun> - R -**Marks the result of two images blending**,short for result.
1401*4882a593Smuzhiyun> - c -**Marks the color of the pixel**,the RGB part of RGBA, which describes the color of the image itself, short for color.(**Note**,Color values (RGB) in the Porter-Duff  blending model are all left-multiplied results, that is, the product of original color and transparency. If the color values are not left-multiplied, pre-multiplied operations(Xc = Xc * Xa) are required.)
1402*4882a593Smuzhiyun> - a -**Marks the Alpha of the pixel**,Namely the A part of RGBA, describe the transparency of the image itself, short for Alpha.
1403*4882a593Smuzhiyun> - f -**Marks factors acting on C or A**,short for factor.
1404*4882a593Smuzhiyun>
1405*4882a593Smuzhiyun> The core formula of Porter-Duff blending model is as follows:
1406*4882a593Smuzhiyun>
1407*4882a593Smuzhiyun> Rc = Sc * Sf + Dc * Df;
1408*4882a593Smuzhiyun>
1409*4882a593Smuzhiyun> that is: result color = source color * source factor + destination color * destination factor.
1410*4882a593Smuzhiyun>
1411*4882a593Smuzhiyun> Ra = Sa * Sf + Da * Df;
1412*4882a593Smuzhiyun>
1413*4882a593Smuzhiyun> that is: result Alpha = source Alpha * source factor + destination Alpha * destination factor.
1414*4882a593Smuzhiyun
1415*4882a593SmuzhiyunRGA supports following blending models:
1416*4882a593Smuzhiyun
1417*4882a593Smuzhiyun> SRC:
1418*4882a593Smuzhiyun>
1419*4882a593Smuzhiyun> ​		Sf = 1, Df = 0;
1420*4882a593Smuzhiyun>
1421*4882a593Smuzhiyun> ​		[Rc,Ra] = [Sc,Sa];
1422*4882a593Smuzhiyun>
1423*4882a593Smuzhiyun> DST:
1424*4882a593Smuzhiyun>
1425*4882a593Smuzhiyun> ​		Sf = 0, Df = 1;
1426*4882a593Smuzhiyun>
1427*4882a593Smuzhiyun> ​		[Rc,Ra] = [Dc,Da];
1428*4882a593Smuzhiyun>
1429*4882a593Smuzhiyun> SRC_OVER:
1430*4882a593Smuzhiyun>
1431*4882a593Smuzhiyun> ​		Sf = 1, Df = (1 - Sa);
1432*4882a593Smuzhiyun>
1433*4882a593Smuzhiyun> ​		[Rc,Ra] = [ Sc + (1 - Sa) * Dc, Sa + (1 - Sa) * Da ];
1434*4882a593Smuzhiyun>
1435*4882a593Smuzhiyun> DST_OVER:
1436*4882a593Smuzhiyun>
1437*4882a593Smuzhiyun> ​		Sf = (1 - Da) , Df = 1;
1438*4882a593Smuzhiyun>
1439*4882a593Smuzhiyun> ​		[Rc,Ra] = [ Sc * (1 - Da)  + Dc, Sa * (1 - Da) + Da ] ;
1440*4882a593Smuzhiyun
1441*4882a593Smuzhiyun【Note】Image blending model does not support the YUV format image blending, the YUV format is not support in dst image of imblend , the YUV format is not support in srcB image of imcomposite.
1442*4882a593Smuzhiyun
1443*4882a593Smuzhiyun| Parameter        | Description                                                  |
1444*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1445*4882a593Smuzhiyun| srcA             | **[required]** input image A                                 |
1446*4882a593Smuzhiyun| srcB             | **[required]** input image B                                 |
1447*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1448*4882a593Smuzhiyun| mode             | **[optional]** blending mode:<br/>IM_ALPHA_BLEND_SRC —— SRC mode<br/>IM_ALPHA_BLEND_DST —— DST mode  <br/>IM_ALPHA_BLEND_SRC_OVER —— SRC OVER mode<br/>IM_ALPHA_BLEND_DST_OVER —— DST OVER mode<br />IM_ALPHA_BLEND_PRE_MUL —— Enable premultipling. When premultipling is required, this identifier must be processed with other mode identifiers, then assign to mode |
1449*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1450*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1451*4882a593Smuzhiyun
1452*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1453*4882a593Smuzhiyun
1454*4882a593Smuzhiyun
1455*4882a593Smuzhiyun
1456*4882a593Smuzhiyun#### imblendTask/imcompositeTask
1457*4882a593Smuzhiyun
1458*4882a593Smuzhiyun```c++
1459*4882a593SmuzhiyunIM_API IM_STATUS imblendTask(im_job_handle_t job_handle,
1460*4882a593Smuzhiyun                             const rga_buffer_t fg_image,
1461*4882a593Smuzhiyun                             rga_buffer_t bg_image,
1462*4882a593Smuzhiyun                             int mode = IM_ALPHA_BLEND_SRC_OVER);
1463*4882a593Smuzhiyun```
1464*4882a593Smuzhiyun
1465*4882a593Smuzhiyun> Add an A+B -> B image two-channel blending operation to the specified job through job_handle. The configuration parameters are the same as imblend. When no mode is configured, it is set to src-over mode by default.
1466*4882a593Smuzhiyun
1467*4882a593Smuzhiyun```c++
1468*4882a593SmuzhiyunIM_API IM_STATUS imcompositeTask(im_job_handle_t job_handle,
1469*4882a593Smuzhiyun                                 const rga_buffer_t fg_image,
1470*4882a593Smuzhiyun                                 const rga_buffer_t bg_image,
1471*4882a593Smuzhiyun                                 rga_buffer_t output_image,
1472*4882a593Smuzhiyun                                 int mode = IM_ALPHA_BLEND_SRC_OVER);
1473*4882a593Smuzhiyun```
1474*4882a593Smuzhiyun
1475*4882a593Smuzhiyun> Add an A+B -> C image three-channel blending operation to the specified job through job_handle. The configuration parameters are the same as imcomposite.
1476*4882a593Smuzhiyun
1477*4882a593Smuzhiyun【Note】Image blending model does not support the YUV format image blending, the YUV format is not support in dst image of imblend , the YUV format is not support in srcB image of imcomposite.
1478*4882a593Smuzhiyun
1479*4882a593Smuzhiyun| Parameter    | Description                                                  |
1480*4882a593Smuzhiyun| ------------ | ------------------------------------------------------------ |
1481*4882a593Smuzhiyun| job_handle   | **[required]** job handle                                    |
1482*4882a593Smuzhiyun| fg_image     | **[required]** foreground image                              |
1483*4882a593Smuzhiyun| bg_image     | **[required]** background image, when A+B->B it is also the output destination image. |
1484*4882a593Smuzhiyun| output_image | **[required]** output destination image.                     |
1485*4882a593Smuzhiyun| mode         | **[optional]** blending mode:<br/>IM_ALPHA_BLEND_SRC —— SRC mode<br/>IM_ALPHA_BLEND_DST —— DST mode  <br/>IM_ALPHA_BLEND_SRC_OVER —— SRC OVER mode<br/>IM_ALPHA_BLEND_DST_OVER —— DST OVER mode<br />IM_ALPHA_BLEND_PRE_MUL —— Enable premultipling. When premultipling is required, this identifier must be processed with other mode identifiers, then assign to mode |
1486*4882a593Smuzhiyun
1487*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1488*4882a593Smuzhiyun
1489*4882a593Smuzhiyun
1490*4882a593Smuzhiyun
1491*4882a593Smuzhiyun### Color Key
1492*4882a593Smuzhiyun
1493*4882a593Smuzhiyun#### imcolorkey
1494*4882a593Smuzhiyun
1495*4882a593Smuzhiyun```C++
1496*4882a593SmuzhiyunIM_STATUS imcolorkey(const rga_buffer_t src,
1497*4882a593Smuzhiyun                     rga_buffer_t dst,
1498*4882a593Smuzhiyun                     im_colorkey_range range,
1499*4882a593Smuzhiyun                     int mode = IM_ALPHA_COLORKEY_NORMAL,
1500*4882a593Smuzhiyun                     int sync = 1,
1501*4882a593Smuzhiyun                     int *release_fence_fd = NULL);
1502*4882a593Smuzhiyun```
1503*4882a593Smuzhiyun
1504*4882a593Smuzhiyun> Color Key is to preprocesses the source image, zeros the alpha component of pixels that meet the Color Key filtering conditions, wherein the Color Key filtering conditions are non-transparent color values, and performs the alpha blending mode between the preprocessed source image and the destination image.
1505*4882a593Smuzhiyun>
1506*4882a593Smuzhiyun> This mode only supports the Color Key operation on the source image (src) region of the image for the set Color range, and overlays on the destination image (dst) region.
1507*4882a593Smuzhiyun
1508*4882a593Smuzhiyun> IM_ALPHA_COLORKEY_NORMAL is the normal mode, that is, the colors in the set color range are used as the filtering condition. The Alpha components of pixels in this color range are set zero; IM_ALPHA_COLORKEY_INVERTED is inverted. When no mode is configured, it is set to IM_ALPHA_COLORKEY_NORMAL mode by default.
1509*4882a593Smuzhiyun
1510*4882a593Smuzhiyun| **Parameters** | **Range**        | **Description**                           |
1511*4882a593Smuzhiyun| -------------- | ---------------- | ----------------------------------------- |
1512*4882a593Smuzhiyun| max            | 0x0 ~ 0xFFFFFFFF | The max color range to cancel/scratch, arranged as ABGR |
1513*4882a593Smuzhiyun| min            | 0x0 ~ 0xFFFFFFFF | The min color range to cancel/scratch, arranged as ABGR |
1514*4882a593Smuzhiyun
1515*4882a593Smuzhiyun| parameter        | Description                                                  |
1516*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1517*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1518*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1519*4882a593Smuzhiyun| range            | **[required]** Target color range<br/>typedef struct im_colorkey_range {<br/>    int max;<br/>    int min;<br/>} im_colorkey_value; |
1520*4882a593Smuzhiyun| Mode             | **[required]** Color Key mode:<br/>IM_ALPHA_COLORKEY_NORMAL<br/>IM_ALPHA_COLORKEY_INVERTED |
1521*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1522*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1523*4882a593Smuzhiyun
1524*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1525*4882a593Smuzhiyun
1526*4882a593Smuzhiyun
1527*4882a593Smuzhiyun
1528*4882a593Smuzhiyun#### imcolorkeyTask
1529*4882a593Smuzhiyun
1530*4882a593Smuzhiyun```C++
1531*4882a593SmuzhiyunIM_API IM_STATUS imcolorkeyTask(im_job_handle_t job_handle,
1532*4882a593Smuzhiyun                                const rga_buffer_t fg_image,
1533*4882a593Smuzhiyun                                rga_buffer_t bg_image,
1534*4882a593Smuzhiyun                                im_colorkey_range range,
1535*4882a593Smuzhiyun                                int mode = IM_ALPHA_COLORKEY_NORMAL);
1536*4882a593Smuzhiyun```
1537*4882a593Smuzhiyun
1538*4882a593Smuzhiyun> Add an image Color Key operation to the specified job through job_handle. The configuration parameters are the same as imcolorkey.
1539*4882a593Smuzhiyun
1540*4882a593Smuzhiyun| **Parameters** | **Range**        | **Description**                                         |
1541*4882a593Smuzhiyun| -------------- | ---------------- | ------------------------------------------------------- |
1542*4882a593Smuzhiyun| max            | 0x0 ~ 0xFFFFFFFF | The max color range to cancel/scratch, arranged as ABGR |
1543*4882a593Smuzhiyun| min            | 0x0 ~ 0xFFFFFFFF | The min color range to cancel/scratch, arranged as ABGR |
1544*4882a593Smuzhiyun
1545*4882a593Smuzhiyun| parameter  | Description                                                  |
1546*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1547*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1548*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1549*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1550*4882a593Smuzhiyun| range      | **[required]** Target color range<br/>typedef struct im_colorkey_range {<br/>    int max;<br/>    int min;<br/>} im_colorkey_value; |
1551*4882a593Smuzhiyun| Mode       | **[required]** Color Key mode:<br/>IM_ALPHA_COLORKEY_NORMAL<br/>IM_ALPHA_COLORKEY_INVERTED |
1552*4882a593Smuzhiyun
1553*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1554*4882a593Smuzhiyun
1555*4882a593Smuzhiyun
1556*4882a593Smuzhiyun
1557*4882a593Smuzhiyun### OSD
1558*4882a593Smuzhiyun
1559*4882a593Smuzhiyun#### imosd
1560*4882a593Smuzhiyun
1561*4882a593Smuzhiyun```c++
1562*4882a593SmuzhiyunIM_API IM_STATUS imosd(const rga_buffer_t osd,
1563*4882a593Smuzhiyun                       const rga_buffer_t bg_image,
1564*4882a593Smuzhiyun                       const im_rect osd_rect,
1565*4882a593Smuzhiyun                       im_osd_t *osd_config,
1566*4882a593Smuzhiyun                       int sync = 1,
1567*4882a593Smuzhiyun                       int *release_fence_fd = NULL);
1568*4882a593Smuzhiyun```
1569*4882a593Smuzhiyun
1570*4882a593Smuzhiyun> OSD (On-Screen-Display), can superimpose text information on video pictures, and perform brightness statistics and automatic color inversion functions for fonts.
1571*4882a593Smuzhiyun
1572*4882a593Smuzhiyun| parameter        | Description                                                  |
1573*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1574*4882a593Smuzhiyun| OSD              | **[required]** osd block image                               |
1575*4882a593Smuzhiyun| bg_image         | **[required]** output image                                  |
1576*4882a593Smuzhiyun| osd_rect         | **[required]** image region to OSD                           |
1577*4882a593Smuzhiyun| osd_config       | **[required]** OSD function config                           |
1578*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1579*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1580*4882a593Smuzhiyun
1581*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1582*4882a593Smuzhiyun
1583*4882a593Smuzhiyun
1584*4882a593Smuzhiyun
1585*4882a593Smuzhiyun#### imosdTask
1586*4882a593Smuzhiyun
1587*4882a593Smuzhiyun```c++
1588*4882a593SmuzhiyunIM_API IM_STATUS imosdTask(im_job_handle_t job_handle,
1589*4882a593Smuzhiyun                           const rga_buffer_t osd,
1590*4882a593Smuzhiyun                           const rga_buffer_t bg_image,
1591*4882a593Smuzhiyun                           const im_rect osd_rect,
1592*4882a593Smuzhiyun                           im_osd_t *osd_config);
1593*4882a593Smuzhiyun```
1594*4882a593Smuzhiyun
1595*4882a593Smuzhiyun> Add an OSD operation to the specified job through job_handle. The configuration parameters are the same as imosd.
1596*4882a593Smuzhiyun
1597*4882a593Smuzhiyun| parameter  | Description                        |
1598*4882a593Smuzhiyun| ---------- | ---------------------------------- |
1599*4882a593Smuzhiyun| job_handle | **[required]** job handle          |
1600*4882a593Smuzhiyun| OSD        | **[required]** osd block image     |
1601*4882a593Smuzhiyun| dst        | **[required]** output image        |
1602*4882a593Smuzhiyun| osd_rect   | **[required]** image region to OSD |
1603*4882a593Smuzhiyun| osd_config | **[required]** OSD function config |
1604*4882a593Smuzhiyun
1605*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS  on success or else negative error code.
1606*4882a593Smuzhiyun
1607*4882a593Smuzhiyun
1608*4882a593Smuzhiyun
1609*4882a593Smuzhiyun### Pre-processing of NN Operation Points (Quantization)
1610*4882a593Smuzhiyun
1611*4882a593Smuzhiyun#### imquantize
1612*4882a593Smuzhiyun
1613*4882a593Smuzhiyun```c++
1614*4882a593SmuzhiyunIM_STATUS imquantize(const rga_buffer_t src,
1615*4882a593Smuzhiyun                     rga_buffer_t dst,
1616*4882a593Smuzhiyun                     rga_nn_t nn_info,
1617*4882a593Smuzhiyun                     int sync = 1,
1618*4882a593Smuzhiyun                     int *release_fence_fd = NULL);
1619*4882a593Smuzhiyun```
1620*4882a593Smuzhiyun
1621*4882a593Smuzhiyun> Currently supported only on RV1126 / RV1109. NN operation point pre-processing, three channels of RGB of image can be separately configured with offset and scale.
1622*4882a593Smuzhiyun
1623*4882a593SmuzhiyunFormula:
1624*4882a593Smuzhiyun
1625*4882a593Smuzhiyun```
1626*4882a593Smuzhiyundst = 【(src + offset) * scale 】
1627*4882a593Smuzhiyun```
1628*4882a593Smuzhiyun
1629*4882a593SmuzhiyunParameters range:
1630*4882a593Smuzhiyun
1631*4882a593Smuzhiyun| **Parameters** | **Range**  | **Description**                                              |
1632*4882a593Smuzhiyun| -------------- | ---------- | ------------------------------------------------------------ |
1633*4882a593Smuzhiyun| **scale**      | 0 ~ 3.99   | 10bit,From left to right, the highest 2 bits indicate the integer part and the lowest 8 bits indicate the decimal part |
1634*4882a593Smuzhiyun| **offset**     | -255 ~ 255 | 9bit,From left to right, the high indicates the sign bit, and the low indicates the offset from 0 to 255       |
1635*4882a593Smuzhiyun
1636*4882a593Smuzhiyun| Parameter        | Description                                                  |
1637*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1638*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1639*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1640*4882a593Smuzhiyun| nn_info          | **[required]** rga_nn_t struct configures the offset and scale of the three RGB channels respectively<br />typedef struct rga_nn { <br/>  int nn_flag;<br/>  int scale_r;<br/>  int scale_g;<br/>  int scale_b;<br/>  int offset_r;<br/>  int offset_g;<br/>  int offset_b;<br/>} rga_nn_t; |
1641*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1642*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1643*4882a593Smuzhiyun
1644*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1645*4882a593Smuzhiyun
1646*4882a593Smuzhiyun
1647*4882a593Smuzhiyun
1648*4882a593Smuzhiyun#### imquantizeTask
1649*4882a593Smuzhiyun
1650*4882a593Smuzhiyun```c++
1651*4882a593SmuzhiyunIM_API IM_STATUS imquantizeTask(im_job_handle_t job_handle,
1652*4882a593Smuzhiyun                                const rga_buffer_t src,
1653*4882a593Smuzhiyun                                rga_buffer_t dst,
1654*4882a593Smuzhiyun                                im_nn_t nn_info);
1655*4882a593Smuzhiyun```
1656*4882a593Smuzhiyun
1657*4882a593Smuzhiyun> Add an image quantization conversion operation to the specified job through job_handle. The configuration parameters are the same as imquantize.
1658*4882a593Smuzhiyun
1659*4882a593Smuzhiyun| parameter  | Description                                                  |
1660*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1661*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1662*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1663*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1664*4882a593Smuzhiyun| nn_info    | **[required]** rga_nn_t结构体对RGB三个通道offset及scale进行单独配置<br />typedef struct rga_nn { <br/>  int nn_flag;<br/>  int scale_r;<br/>  int scale_g;<br/>  int scale_b;<br/>  int offset_r;<br/>  int offset_g;<br/>  int offset_b;<br/>} rga_nn_t; |
1665*4882a593Smuzhiyun
1666*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1667*4882a593Smuzhiyun
1668*4882a593Smuzhiyun
1669*4882a593Smuzhiyun
1670*4882a593Smuzhiyun### Image ROP
1671*4882a593Smuzhiyun
1672*4882a593Smuzhiyun#### imrop
1673*4882a593Smuzhiyun
1674*4882a593Smuzhiyun```C++
1675*4882a593SmuzhiyunIM_STATUS imrop(const rga_buffer_t src,
1676*4882a593Smuzhiyun                rga_buffer_t dst,
1677*4882a593Smuzhiyun                int rop_code,
1678*4882a593Smuzhiyun                int sync = 1,
1679*4882a593Smuzhiyun                int *release_fence_fd = NULL);
1680*4882a593Smuzhiyun```
1681*4882a593Smuzhiyun
1682*4882a593Smuzhiyun> Perform ROP, and, or, not operations on two images
1683*4882a593Smuzhiyun
1684*4882a593Smuzhiyun| Parameter        | Description                                                  |
1685*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1686*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1687*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1688*4882a593Smuzhiyun| rop_code         | **[required]** rop code mode <br /><br/> IM_ROP_AND : dst = dst **AND** src;<br/> IM_ROP_OR : dst = dst **OR** src <br/> IM_ROP_NOT_DST : dst = **NOT** dst<br/> IM_ROP_NOT_SRC : dst = **NOT** src<br/> IM_ROP_XOR : dst = dst **XOR** src<br/> IM_ROP_NOT_XOR : dst = **NOT** (dst **XOR** src)<br/> |
1689*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1690*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1691*4882a593Smuzhiyun
1692*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code
1693*4882a593Smuzhiyun
1694*4882a593Smuzhiyun
1695*4882a593Smuzhiyun
1696*4882a593Smuzhiyun#### imropTask
1697*4882a593Smuzhiyun
1698*4882a593Smuzhiyun```C++
1699*4882a593SmuzhiyunIM_API IM_STATUS imropTask(im_job_handle_t job_handle,
1700*4882a593Smuzhiyun                           const rga_buffer_t src,
1701*4882a593Smuzhiyun                           rga_buffer_t dst,
1702*4882a593Smuzhiyun                           int rop_code);
1703*4882a593Smuzhiyun```
1704*4882a593Smuzhiyun
1705*4882a593Smuzhiyun> Add an image ROP conversion operation to the specified job through job_handle. The configuration parameters are the same as imrop.
1706*4882a593Smuzhiyun
1707*4882a593Smuzhiyun| parameter  | Description                                                  |
1708*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1709*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1710*4882a593Smuzhiyun| src        | **[required]** input image                                   |
1711*4882a593Smuzhiyun| dst        | **[required]** output image                                  |
1712*4882a593Smuzhiyun| rop_code   | **[required]** rop code mode <br /><br/> IM_ROP_AND : dst = dst **AND** src;<br/> IM_ROP_OR : dst = dst **OR** src <br/> IM_ROP_NOT_DST : dst = **NOT** dst<br/> IM_ROP_NOT_SRC : dst = **NOT** src<br/> IM_ROP_XOR : dst = dst **XOR** src<br/> IM_ROP_NOT_XOR : dst = **NOT** (dst **XOR** src) |
1713*4882a593Smuzhiyun
1714*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1715*4882a593Smuzhiyun
1716*4882a593Smuzhiyun
1717*4882a593Smuzhiyun
1718*4882a593Smuzhiyun### Image Color Filling
1719*4882a593Smuzhiyun
1720*4882a593Smuzhiyun#### imfill
1721*4882a593Smuzhiyun
1722*4882a593Smuzhiyun```C++
1723*4882a593SmuzhiyunIM_STATUS imfill(rga_buffer_t buf,
1724*4882a593Smuzhiyun                 im_rect rect,
1725*4882a593Smuzhiyun                 int color = 0x00000000,
1726*4882a593Smuzhiyun                 int sync = 1);
1727*4882a593Smuzhiyun```
1728*4882a593Smuzhiyun
1729*4882a593Smuzhiyun> Color fills the specified area rect of the image.
1730*4882a593Smuzhiyun>
1731*4882a593Smuzhiyun> Color parameters from high to low are respectively R,G,B,A. For example, red: color = 0xff000000.
1732*4882a593Smuzhiyun
1733*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1734*4882a593Smuzhiyun
1735*4882a593Smuzhiyun| Parameter        | Description                                                  |
1736*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1737*4882a593Smuzhiyun| src              | **[required]** input image                                   |
1738*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
1739*4882a593Smuzhiyun| rect             | **[required]** image region to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1740*4882a593Smuzhiyun| color            | **[required]** fill with color, default=0x00000000           |
1741*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1742*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1743*4882a593Smuzhiyun
1744*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1745*4882a593Smuzhiyun
1746*4882a593Smuzhiyun
1747*4882a593Smuzhiyun
1748*4882a593Smuzhiyun#### imfillArray
1749*4882a593Smuzhiyun
1750*4882a593Smuzhiyun```C++
1751*4882a593SmuzhiyunIM_API IM_STATUS imfillArray(rga_buffer_t dst,
1752*4882a593Smuzhiyun                             im_rect *rect_array,
1753*4882a593Smuzhiyun                             int array_size,
1754*4882a593Smuzhiyun                             uint32_t color,
1755*4882a593Smuzhiyun                             int sync = 1,
1756*4882a593Smuzhiyun                             int *release_fence_fd = NULL);
1757*4882a593Smuzhiyun```
1758*4882a593Smuzhiyun
1759*4882a593Smuzhiyun> Color fills multiple areas of the image one by one.
1760*4882a593Smuzhiyun>
1761*4882a593Smuzhiyun> Color parameters from high to low are respectively R,G,B,A. For example, red: color = 0xff000000.
1762*4882a593Smuzhiyun
1763*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1764*4882a593Smuzhiyun
1765*4882a593Smuzhiyun| Parameter        | Description                                                  |
1766*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1767*4882a593Smuzhiyun| dst              | **[required]** target image                                  |
1768*4882a593Smuzhiyun| rect_array       | **[required]** image region array_ptr to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1769*4882a593Smuzhiyun| array_size       | **[required]** size of region arrays.                        |
1770*4882a593Smuzhiyun| color            | **[required]** fill with color                               |
1771*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1772*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1773*4882a593Smuzhiyun
1774*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1775*4882a593Smuzhiyun
1776*4882a593Smuzhiyun
1777*4882a593Smuzhiyun
1778*4882a593Smuzhiyun#### imfillTask
1779*4882a593Smuzhiyun
1780*4882a593Smuzhiyun```C++
1781*4882a593SmuzhiyunIM_API IM_STATUS imfillTask(im_job_handle_t job_handle,
1782*4882a593Smuzhiyun                            rga_buffer_t dst,
1783*4882a593Smuzhiyun                            im_rect rect,
1784*4882a593Smuzhiyun                            uint32_t color);
1785*4882a593Smuzhiyun```
1786*4882a593Smuzhiyun
1787*4882a593Smuzhiyun> Add an image color fill operation to the specified job through job_handle. The configuration parameters are the same as imfill.
1788*4882a593Smuzhiyun
1789*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1790*4882a593Smuzhiyun
1791*4882a593Smuzhiyun| Parameter  | Description                                                  |
1792*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1793*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1794*4882a593Smuzhiyun| dst        | **[required]** target image                                  |
1795*4882a593Smuzhiyun| rect       | **[required]** image region to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1796*4882a593Smuzhiyun| color      | **[required]** fill with color                               |
1797*4882a593Smuzhiyun
1798*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1799*4882a593Smuzhiyun
1800*4882a593Smuzhiyun
1801*4882a593Smuzhiyun
1802*4882a593Smuzhiyun#### imfillTaskArray
1803*4882a593Smuzhiyun
1804*4882a593Smuzhiyun```C++
1805*4882a593SmuzhiyunIM_API IM_STATUS imfillTaskArray(im_job_handle_t job_handle,
1806*4882a593Smuzhiyun                                 rga_buffer_t dst,
1807*4882a593Smuzhiyun                                 im_rect *rect_array,
1808*4882a593Smuzhiyun                                 int array_size,
1809*4882a593Smuzhiyun                                 uint32_t color);
1810*4882a593Smuzhiyun```
1811*4882a593Smuzhiyun
1812*4882a593Smuzhiyun> Add an image color fill multiple areas operation to the specified job through job_handle. The configuration parameters are the same as imfillArray.
1813*4882a593Smuzhiyun
1814*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1815*4882a593Smuzhiyun
1816*4882a593Smuzhiyun| Parameter  | Description                                                  |
1817*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1818*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1819*4882a593Smuzhiyun| dst        | **[required]** target image                                  |
1820*4882a593Smuzhiyun| rect_array | **[required]** image region array_ptr to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1821*4882a593Smuzhiyun| array_size | **[required]** size of region arrays.                        |
1822*4882a593Smuzhiyun| color      | **[required]** fill with color                               |
1823*4882a593Smuzhiyun
1824*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1825*4882a593Smuzhiyun
1826*4882a593Smuzhiyun
1827*4882a593Smuzhiyun
1828*4882a593Smuzhiyun#### imrectangle
1829*4882a593Smuzhiyun
1830*4882a593Smuzhiyun```C++
1831*4882a593SmuzhiyunIM_API IM_STATUS imrectangle(rga_buffer_t dst,
1832*4882a593Smuzhiyun                             im_rect rect,
1833*4882a593Smuzhiyun                             uint32_t color,
1834*4882a593Smuzhiyun                             int thickness,
1835*4882a593Smuzhiyun                             int sync = 1,
1836*4882a593Smuzhiyun                             int *release_fence_fd = NULL);
1837*4882a593Smuzhiyun```
1838*4882a593Smuzhiyun
1839*4882a593Smuzhiyun> Draw a border with a thickness of "thickness" to the specified area rect of the image (described as the outer diameter of the border) according to the specified color by "color", and fill a solid rectangle when the thickness is negative.
1840*4882a593Smuzhiyun>
1841*4882a593Smuzhiyun> Color parameters from high to low are respectively R,G,B,A. For example, red: color = 0xff000000.
1842*4882a593Smuzhiyun
1843*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1844*4882a593Smuzhiyun
1845*4882a593Smuzhiyun| Parameter        | Description                                                  |
1846*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1847*4882a593Smuzhiyun| dst              | **[required]** target image                                  |
1848*4882a593Smuzhiyun| rect             | **[required]** image region to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1849*4882a593Smuzhiyun| color            | **[required]** fill with color                               |
1850*4882a593Smuzhiyun| thickness        | **[required]** Thickness of lines that make up the rectangle.<br/>Negative values, like -1, mean that the function has to draw a filled rectangle. |
1851*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1852*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1853*4882a593Smuzhiyun
1854*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1855*4882a593Smuzhiyun
1856*4882a593Smuzhiyun
1857*4882a593Smuzhiyun
1858*4882a593Smuzhiyun#### imrectangleArray
1859*4882a593Smuzhiyun
1860*4882a593Smuzhiyun```C++
1861*4882a593SmuzhiyunIM_API IM_STATUS imrectangleArray(rga_buffer_t dst,
1862*4882a593Smuzhiyun                                  im_rect *rect_array,
1863*4882a593Smuzhiyun                                  int array_size,
1864*4882a593Smuzhiyun                                  uint32_t color,
1865*4882a593Smuzhiyun                                  int thickness,
1866*4882a593Smuzhiyun                                  int sync = 1,
1867*4882a593Smuzhiyun                                  int *release_fence_fd = NULL);
1868*4882a593Smuzhiyun```
1869*4882a593Smuzhiyun
1870*4882a593Smuzhiyun> Draw multiple border with a thickness of "thickness" to the specified area rect of the image (described as the outer diameter of the border) according to the specified color by "color", and fill a solid rectangle when the thickness is negative.
1871*4882a593Smuzhiyun>
1872*4882a593Smuzhiyun> Color parameters from high to low are respectively R,G,B,A. For example, red: color = 0xff000000.
1873*4882a593Smuzhiyun
1874*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1875*4882a593Smuzhiyun
1876*4882a593Smuzhiyun| Parameter        | Description                                                  |
1877*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1878*4882a593Smuzhiyun| dst              | **[required]** target image                                  |
1879*4882a593Smuzhiyun| rect_array       | **[required]** image region array_ptr to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1880*4882a593Smuzhiyun| array_size       | **[required]** size of region arrays.                        |
1881*4882a593Smuzhiyun| color            | **[required]** fill with color                               |
1882*4882a593Smuzhiyun| thickness        | **[required]** Thickness of lines that make up the rectangle.<br/>Negative values, like -1, mean that the function has to draw a filled rectangle. |
1883*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1884*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
1885*4882a593Smuzhiyun
1886*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1887*4882a593Smuzhiyun
1888*4882a593Smuzhiyun
1889*4882a593Smuzhiyun
1890*4882a593Smuzhiyun#### imrectangleTask
1891*4882a593Smuzhiyun
1892*4882a593Smuzhiyun```C++
1893*4882a593SmuzhiyunIM_API IM_STATUS imrectangleTask(im_job_handle_t job_handle,
1894*4882a593Smuzhiyun                                 rga_buffer_t dst,
1895*4882a593Smuzhiyun                                 im_rect rect,
1896*4882a593Smuzhiyun                                 uint32_t color,
1897*4882a593Smuzhiyun                                 int thickness);
1898*4882a593Smuzhiyun```
1899*4882a593Smuzhiyun
1900*4882a593Smuzhiyun> Add an Draw border operation to the specified job through job_handle. The configuration parameters are the same as imrectangle.
1901*4882a593Smuzhiyun
1902*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1903*4882a593Smuzhiyun
1904*4882a593Smuzhiyun| Parameter  | Description                                                  |
1905*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1906*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1907*4882a593Smuzhiyun| dst        | **[required]** target image                                  |
1908*4882a593Smuzhiyun| rect       | **[required]** image region to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1909*4882a593Smuzhiyun| color      | **[required]** fill with color                               |
1910*4882a593Smuzhiyun| thickness  | **[required]** Thickness of lines that make up the rectangle.<br/>Negative values, like -1, mean that the function has to draw a filled rectangle. |
1911*4882a593Smuzhiyun
1912*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1913*4882a593Smuzhiyun
1914*4882a593Smuzhiyun
1915*4882a593Smuzhiyun
1916*4882a593Smuzhiyun#### imrectangleTaskArray
1917*4882a593Smuzhiyun
1918*4882a593Smuzhiyun```C++
1919*4882a593SmuzhiyunIM_API IM_STATUS imrectangleTaskArray(im_job_handle_t job_handle,
1920*4882a593Smuzhiyun                                      rga_buffer_t dst,
1921*4882a593Smuzhiyun                                      im_rect *rect_array,
1922*4882a593Smuzhiyun                                      int array_size,
1923*4882a593Smuzhiyun                                      uint32_t color,
1924*4882a593Smuzhiyun                                      int thickness);
1925*4882a593Smuzhiyun```
1926*4882a593Smuzhiyun
1927*4882a593Smuzhiyun> Add an Draw multiple border operation to the specified job through job_handle. The configuration parameters are the same as imrectangleArray.
1928*4882a593Smuzhiyun
1929*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1930*4882a593Smuzhiyun
1931*4882a593Smuzhiyun| Parameter  | Description                                                  |
1932*4882a593Smuzhiyun| ---------- | ------------------------------------------------------------ |
1933*4882a593Smuzhiyun| job_handle | **[required]** job handle                                    |
1934*4882a593Smuzhiyun| dst        | **[required]** target image                                  |
1935*4882a593Smuzhiyun| rect_array | **[required]** image region array_ptr to fill specified color<br/>width and height of rect must be greater than or equal to 2 |
1936*4882a593Smuzhiyun| array_size | **[required]** size of region arrays.                        |
1937*4882a593Smuzhiyun| color      | **[required]** fill with color                               |
1938*4882a593Smuzhiyun| thickness  | **[required]** Thickness of lines that make up the rectangle.<br/>Negative values, like -1, mean that the function has to draw a filled rectangle. |
1939*4882a593Smuzhiyun
1940*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1941*4882a593Smuzhiyun
1942*4882a593Smuzhiyun
1943*4882a593Smuzhiyun
1944*4882a593Smuzhiyun#### immakeBorder
1945*4882a593Smuzhiyun
1946*4882a593Smuzhiyun```C++
1947*4882a593SmuzhiyunIM_API IM_STATUS immakeBorder(rga_buffer_t src,
1948*4882a593Smuzhiyun                              rga_buffer_t dst,
1949*4882a593Smuzhiyun                              int top,
1950*4882a593Smuzhiyun                              int bottom,
1951*4882a593Smuzhiyun                              int left,
1952*4882a593Smuzhiyun                              int right,
1953*4882a593Smuzhiyun                              int border_type,
1954*4882a593Smuzhiyun                              int value = 0,
1955*4882a593Smuzhiyun                              int sync = 1,
1956*4882a593Smuzhiyun                              int acquir_fence_fd = -1,
1957*4882a593Smuzhiyun                              int *release_fence_fd = NULL);
1958*4882a593Smuzhiyun```
1959*4882a593Smuzhiyun
1960*4882a593Smuzhiyun> According to the configured top/bottom/left/right pixels, draw a border to the input image and output it to the output target image buffer.
1961*4882a593Smuzhiyun
1962*4882a593Smuzhiyun【 Note 】 The width and height of the rect must be greater than or equal to 2
1963*4882a593Smuzhiyun
1964*4882a593Smuzhiyun| Parameter        | Description                                                  |
1965*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1966*4882a593Smuzhiyun| src              | **[required]** input source image                            |
1967*4882a593Smuzhiyun| dst              | **[required]** output target image                           |
1968*4882a593Smuzhiyun| top              | **[required]** number of top pixels                          |
1969*4882a593Smuzhiyun| bottom           | **[required]** number of bottom pixels                       |
1970*4882a593Smuzhiyun| left             | **[required]** number of left pixels                         |
1971*4882a593Smuzhiyun| right            | **[required] **number of right pixels                        |
1972*4882a593Smuzhiyun| border_type      | **[required]** Border type<br/>IM_BORDER_CONSTANT // iiiiii abcdefgh iiiiiii with some specified value 'i' <br/>IM_BORDER_REFLECT     //fedcba abcdefgh hgfedcb<br/>IM_BORDER_WRAP         //cdefgh abcdefgh abcdefg |
1973*4882a593Smuzhiyun| value            | **[optional]** the pixel value at which the border is filled |
1974*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
1975*4882a593Smuzhiyun| acquire_fence_fd | **[required]** used in async mode, run the job after waiting foracquire_fence signal |
1976*4882a593Smuzhiyun| release_fence_fd | **[required]** used in async mode, as a parameter of imsync() |
1977*4882a593Smuzhiyun
1978*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
1979*4882a593Smuzhiyun
1980*4882a593Smuzhiyun
1981*4882a593Smuzhiyun
1982*4882a593Smuzhiyun### Image Mosaic
1983*4882a593Smuzhiyun
1984*4882a593Smuzhiyun#### immosaic
1985*4882a593Smuzhiyun
1986*4882a593Smuzhiyun```c++
1987*4882a593SmuzhiyunIM_API IM_STATUS immosaic(const rga_buffer_t image,
1988*4882a593Smuzhiyun                          im_rect rect,
1989*4882a593Smuzhiyun                          int mosaic_mode,
1990*4882a593Smuzhiyun                          int sync = 1,
1991*4882a593Smuzhiyun                          int *release_fence_fd = NULL);
1992*4882a593Smuzhiyun```
1993*4882a593Smuzhiyun
1994*4882a593Smuzhiyun> Mosaic masking the specified area of the image.
1995*4882a593Smuzhiyun
1996*4882a593Smuzhiyun| Parameter        | Description                                                  |
1997*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
1998*4882a593Smuzhiyun| image            | **[required]** souce image                                   |
1999*4882a593Smuzhiyun| rect             | **[required]** image region to mosaic                        |
2000*4882a593Smuzhiyun| mosaic_mode      | **[required]** set mosaic mode<br />    IM_MOSAIC_8<br/>    IM_MOSAIC_16<br/>    IM_MOSAIC_32<br/>    IM_MOSAIC_64<br/>    IM_MOSAIC_128 |
2001*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
2002*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
2003*4882a593Smuzhiyun
2004*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2005*4882a593Smuzhiyun
2006*4882a593Smuzhiyun
2007*4882a593Smuzhiyun
2008*4882a593Smuzhiyun#### immosaicArray
2009*4882a593Smuzhiyun
2010*4882a593Smuzhiyun```c++
2011*4882a593SmuzhiyunIM_API IM_STATUS immosaicArray(const rga_buffer_t image,
2012*4882a593Smuzhiyun                               im_rect *rect_array,
2013*4882a593Smuzhiyun                               int array_size,
2014*4882a593Smuzhiyun                               int mosaic_mode,
2015*4882a593Smuzhiyun                               int sync = 1,
2016*4882a593Smuzhiyun                               int *release_fence_fd = NULL);
2017*4882a593Smuzhiyun```
2018*4882a593Smuzhiyun
2019*4882a593Smuzhiyun> Mosaic masking the specified multiple area of the image.
2020*4882a593Smuzhiyun
2021*4882a593Smuzhiyun| Parameter        | Description                                                  |
2022*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
2023*4882a593Smuzhiyun| image            | **[required]** target image                                  |
2024*4882a593Smuzhiyun| rect_array       | **[required]** image region array_ptr to mosaic              |
2025*4882a593Smuzhiyun| array_size       | **[required]** size of region arrays.                        |
2026*4882a593Smuzhiyun| mosaic_mode      | **[required]** set mosaic mode<br />    IM_MOSAIC_8<br/>    IM_MOSAIC_16<br/>    IM_MOSAIC_32<br/>    IM_MOSAIC_64<br/>    IM_MOSAIC_128 |
2027*4882a593Smuzhiyun| sync             | **[optional]** wait until operation complete                 |
2028*4882a593Smuzhiyun| release_fence_fd | **[optional]**Used in async mode, as a parameter of imsync() |
2029*4882a593Smuzhiyun
2030*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2031*4882a593Smuzhiyun
2032*4882a593Smuzhiyun
2033*4882a593Smuzhiyun
2034*4882a593Smuzhiyun#### immosaicTask
2035*4882a593Smuzhiyun
2036*4882a593Smuzhiyun```c++
2037*4882a593SmuzhiyunIM_API IM_STATUS immosaicTask(im_job_handle_t job_handle,
2038*4882a593Smuzhiyun                              const rga_buffer_t image,
2039*4882a593Smuzhiyun                              im_rect rect,
2040*4882a593Smuzhiyun                              int mosaic_mode);
2041*4882a593Smuzhiyun```
2042*4882a593Smuzhiyun
2043*4882a593Smuzhiyun> Add an image mosaic masking operation to the specified job through job_handle. The configuration parameters are the same as immosaic.
2044*4882a593Smuzhiyun
2045*4882a593Smuzhiyun| Parameter   | Description                                                  |
2046*4882a593Smuzhiyun| ----------- | ------------------------------------------------------------ |
2047*4882a593Smuzhiyun| job_handle  | **[required]** job handle                                    |
2048*4882a593Smuzhiyun| image       | **[required]** target image                                  |
2049*4882a593Smuzhiyun| rect        | **[required]** image region to mosaic                        |
2050*4882a593Smuzhiyun| mosaic_mode | **[required]** set mosaic mode<br />    IM_MOSAIC_8<br/>    IM_MOSAIC_16<br/>    IM_MOSAIC_32<br/>    IM_MOSAIC_64<br/>    IM_MOSAIC_128 |
2051*4882a593Smuzhiyun
2052*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2053*4882a593Smuzhiyun
2054*4882a593Smuzhiyun
2055*4882a593Smuzhiyun
2056*4882a593Smuzhiyun#### immosaicTaskArray
2057*4882a593Smuzhiyun
2058*4882a593Smuzhiyun```c++
2059*4882a593SmuzhiyunIM_API IM_STATUS immosaicTaskArray(im_job_handle_t job_handle,
2060*4882a593Smuzhiyun                                   const rga_buffer_t image,
2061*4882a593Smuzhiyun                                   im_rect *rect_array,
2062*4882a593Smuzhiyun                                   int array_size,
2063*4882a593Smuzhiyun                                   int mosaic_mode);
2064*4882a593Smuzhiyun```
2065*4882a593Smuzhiyun
2066*4882a593Smuzhiyun> Add multiple image mosaic masking operation to the specified job through job_handle. The configuration parameters are the same as immosaicArray.
2067*4882a593Smuzhiyun
2068*4882a593Smuzhiyun| Parameter   | Description                                                  |
2069*4882a593Smuzhiyun| ----------- | ------------------------------------------------------------ |
2070*4882a593Smuzhiyun| job_handle  | **[required]** job handle                                    |
2071*4882a593Smuzhiyun| image       | **[required]** target image                                  |
2072*4882a593Smuzhiyun| rect_array  | **[required]** image region array_ptr to mosaic              |
2073*4882a593Smuzhiyun| array_size  | **[required]** size of region arrays.                        |
2074*4882a593Smuzhiyun| mosaic_mode | **[required]** set mosaic mode<br />    IM_MOSAIC_8<br/>    IM_MOSAIC_16<br/>    IM_MOSAIC_32<br/>    IM_MOSAIC_64<br/>    IM_MOSAIC_128 |
2075*4882a593Smuzhiyun
2076*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2077*4882a593Smuzhiyun
2078*4882a593Smuzhiyun
2079*4882a593Smuzhiyun
2080*4882a593Smuzhiyun### Image Process
2081*4882a593Smuzhiyun
2082*4882a593Smuzhiyun#### improcess
2083*4882a593Smuzhiyun
2084*4882a593Smuzhiyun```C++
2085*4882a593SmuzhiyunIM_STATUS improcess(rga_buffer_t src,
2086*4882a593Smuzhiyun                    rga_buffer_t dst,
2087*4882a593Smuzhiyun                    rga_buffer_t pat,
2088*4882a593Smuzhiyun                    im_rect srect,
2089*4882a593Smuzhiyun                    im_rect drect,
2090*4882a593Smuzhiyun                    im_rect prect,
2091*4882a593Smuzhiyun                    int acquire_fence_fd,
2092*4882a593Smuzhiyun                    int *release_fence_fd,
2093*4882a593Smuzhiyun                    im_opt_t *opt,
2094*4882a593Smuzhiyun                    int usage);
2095*4882a593Smuzhiyun```
2096*4882a593Smuzhiyun
2097*4882a593Smuzhiyun> RGA image compound operation. Other APIs are developed based on this API, improcess can achieve more complex compound operations.
2098*4882a593Smuzhiyun>
2099*4882a593Smuzhiyun> Image processes are configured by usage.
2100*4882a593Smuzhiyun
2101*4882a593Smuzhiyunusage definitions:
2102*4882a593Smuzhiyun
2103*4882a593Smuzhiyun```c++
2104*4882a593Smuzhiyuntypedef enum {
2105*4882a593Smuzhiyun    /* Rotation */
2106*4882a593Smuzhiyun    IM_HAL_TRANSFORM_ROT_90     = 1 << 0,
2107*4882a593Smuzhiyun    IM_HAL_TRANSFORM_ROT_180    = 1 << 1,
2108*4882a593Smuzhiyun    IM_HAL_TRANSFORM_ROT_270    = 1 << 2,
2109*4882a593Smuzhiyun    IM_HAL_TRANSFORM_FLIP_H     = 1 << 3,
2110*4882a593Smuzhiyun    IM_HAL_TRANSFORM_FLIP_V     = 1 << 4,
2111*4882a593Smuzhiyun    IM_HAL_TRANSFORM_FLIP_H_V   = 1 << 5,
2112*4882a593Smuzhiyun    IM_HAL_TRANSFORM_MASK       = 0x3f,
2113*4882a593Smuzhiyun
2114*4882a593Smuzhiyun    /*
2115*4882a593Smuzhiyun     * Blend
2116*4882a593Smuzhiyun     * Additional blend usage, can be used with both source and target configs.
2117*4882a593Smuzhiyun     * If none of the below is set, the default "SRC over DST" is applied.
2118*4882a593Smuzhiyun     */
2119*4882a593Smuzhiyun    IM_ALPHA_BLEND_SRC_OVER     = 1 << 6,     /* Default, Porter-Duff "SRC over DST" */
2120*4882a593Smuzhiyun    IM_ALPHA_BLEND_SRC          = 1 << 7,     /* Porter-Duff "SRC" */
2121*4882a593Smuzhiyun    IM_ALPHA_BLEND_DST          = 1 << 8,     /* Porter-Duff "DST" */
2122*4882a593Smuzhiyun    IM_ALPHA_BLEND_SRC_IN       = 1 << 9,     /* Porter-Duff "SRC in DST" */
2123*4882a593Smuzhiyun    IM_ALPHA_BLEND_DST_IN       = 1 << 10,    /* Porter-Duff "DST in SRC" */
2124*4882a593Smuzhiyun    IM_ALPHA_BLEND_SRC_OUT      = 1 << 11,    /* Porter-Duff "SRC out DST" */
2125*4882a593Smuzhiyun    IM_ALPHA_BLEND_DST_OUT      = 1 << 12,    /* Porter-Duff "DST out SRC" */
2126*4882a593Smuzhiyun    IM_ALPHA_BLEND_DST_OVER     = 1 << 13,    /* Porter-Duff "DST over SRC" */
2127*4882a593Smuzhiyun    IM_ALPHA_BLEND_SRC_ATOP     = 1 << 14,    /* Porter-Duff "SRC ATOP" */
2128*4882a593Smuzhiyun    IM_ALPHA_BLEND_DST_ATOP     = 1 << 15,    /* Porter-Duff "DST ATOP" */
2129*4882a593Smuzhiyun    IM_ALPHA_BLEND_XOR          = 1 << 16,    /* Xor */
2130*4882a593Smuzhiyun    IM_ALPHA_BLEND_MASK         = 0x1ffc0,
2131*4882a593Smuzhiyun
2132*4882a593Smuzhiyun    IM_ALPHA_COLORKEY_NORMAL    = 1 << 17,
2133*4882a593Smuzhiyun    IM_ALPHA_COLORKEY_INVERTED  = 1 << 18,
2134*4882a593Smuzhiyun    IM_ALPHA_COLORKEY_MASK      = 0x60000,
2135*4882a593Smuzhiyun
2136*4882a593Smuzhiyun    IM_SYNC                     = 1 << 19,
2137*4882a593Smuzhiyun    IM_ASYNC                    = 1 << 26,
2138*4882a593Smuzhiyun    IM_CROP                     = 1 << 20,    /* Unused */
2139*4882a593Smuzhiyun    IM_COLOR_FILL               = 1 << 21,
2140*4882a593Smuzhiyun    IM_COLOR_PALETTE            = 1 << 22,
2141*4882a593Smuzhiyun    IM_NN_QUANTIZE              = 1 << 23,
2142*4882a593Smuzhiyun    IM_ROP                      = 1 << 24,
2143*4882a593Smuzhiyun    IM_ALPHA_BLEND_PRE_MUL      = 1 << 25,
2144*4882a593Smuzhiyun} IM_USAGE;
2145*4882a593Smuzhiyun```
2146*4882a593Smuzhiyun
2147*4882a593Smuzhiyun| Parameter        | Description                                                  |
2148*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
2149*4882a593Smuzhiyun| src              | **[required]** input imageA                                  |
2150*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
2151*4882a593Smuzhiyun| pat              | **[required]** input imageB                                  |
2152*4882a593Smuzhiyun| srect            | **[required]** src crop region                               |
2153*4882a593Smuzhiyun| drect            | **[required]** dst crop region                               |
2154*4882a593Smuzhiyun| prect            | **[required]** pat crop region                               |
2155*4882a593Smuzhiyun| acquire_fence_fd | **[required]** Used in async mode, run the job after waiting foracquire_fence signal |
2156*4882a593Smuzhiyun| release_fence_fd | **[required]** Used in async mode, as a parameter of imsync() |
2157*4882a593Smuzhiyun| opt              | **[required]** operation options<br/>typedef struct im_opt {<br/>    int color;<br/>    im_colorkey_range colorkey_range; <br/>    im_nn_t nn;<br/>    int rop_code;<br/>     <br/>    int priority;<br/>    int core;<br/>} im_opt_t; |
2158*4882a593Smuzhiyun| usage            | **[required]** image operation usage                         |
2159*4882a593Smuzhiyun
2160*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2161*4882a593Smuzhiyun
2162*4882a593Smuzhiyun
2163*4882a593Smuzhiyun
2164*4882a593Smuzhiyun#### improcessTask
2165*4882a593Smuzhiyun
2166*4882a593Smuzhiyun```C++
2167*4882a593SmuzhiyunIM_API IM_STATUS improcessTask(im_job_handle_t job_handle,
2168*4882a593Smuzhiyun                               rga_buffer_t src,
2169*4882a593Smuzhiyun                               rga_buffer_t dst,
2170*4882a593Smuzhiyun                               rga_buffer_t pat,
2171*4882a593Smuzhiyun                               im_rect srect,
2172*4882a593Smuzhiyun                               im_rect drect,
2173*4882a593Smuzhiyun                               im_rect prect,
2174*4882a593Smuzhiyun                               im_opt_t *opt_ptr,
2175*4882a593Smuzhiyun                               int usage);
2176*4882a593Smuzhiyun```
2177*4882a593Smuzhiyun
2178*4882a593Smuzhiyun> Add an image compound operation to the specified job through job_handle. The configuration parameters are the same as improcess.
2179*4882a593Smuzhiyun
2180*4882a593Smuzhiyun| Parameter        | Description                                                  |
2181*4882a593Smuzhiyun| ---------------- | ------------------------------------------------------------ |
2182*4882a593Smuzhiyun| job_handle       | **[required]** job handle                                    |
2183*4882a593Smuzhiyun| src              | **[required]** input imageA                                  |
2184*4882a593Smuzhiyun| dst              | **[required]** output image                                  |
2185*4882a593Smuzhiyun| pat              | **[required]** input imageB                                  |
2186*4882a593Smuzhiyun| srect            | **[required]** src crop region                               |
2187*4882a593Smuzhiyun| drect            | **[required]** dst crop region                               |
2188*4882a593Smuzhiyun| prect            | **[required]** pat crop region                               |
2189*4882a593Smuzhiyun| acquire_fence_fd | **[required]** Used in async mode, run the job after waiting foracquire_fence signal |
2190*4882a593Smuzhiyun| release_fence_fd | **[required]** Used in async mode, as a parameter of imsync() |
2191*4882a593Smuzhiyun| opt              | **[required]** operation options<br/>typedef struct im_opt {<br/>    int color;<br/>    im_colorkey_range colorkey_range; <br/>    im_nn_t nn;<br/>    int rop_code;<br/>     <br/>    int priority;<br/>    int core;<br/>} im_opt_t; |
2192*4882a593Smuzhiyun| usage            | **[required]** image operation usage                         |
2193*4882a593Smuzhiyun
2194*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2195*4882a593Smuzhiyun
2196*4882a593Smuzhiyun
2197*4882a593Smuzhiyun
2198*4882a593Smuzhiyun### Parameter Check
2199*4882a593Smuzhiyun
2200*4882a593Smuzhiyun#### imcheck
2201*4882a593Smuzhiyun
2202*4882a593Smuzhiyun```c++
2203*4882a593SmuzhiyunIM_API IM_STATUS imcheck(const rga_buffer_t src, const rga_buffer_t dst,
2204*4882a593Smuzhiyun                         const im_rect src_rect, const im_rect dst_rect,
2205*4882a593Smuzhiyun                         const int mode_usage);
2206*4882a593SmuzhiyunIM_API IM_STATUS imcheck_composite(const rga_buffer_t src, const rga_buffer_t dst, const rga_buffer_t pat,
2207*4882a593Smuzhiyun                                   const im_rect src_rect, const im_rect dst_rect, const im_rect pat_rect,
2208*4882a593Smuzhiyun                                   const int mode_usage);
2209*4882a593Smuzhiyun```
2210*4882a593Smuzhiyun
2211*4882a593Smuzhiyun> After RGA parameters are configured, users can use this API to verify whether the current parameters are valid and determine whether the hardware supports them based on the current hardware conditions.
2212*4882a593Smuzhiyun>
2213*4882a593Smuzhiyun> Users are advised to use this API only during development and debugging to avoid performance loss caused by multiple verification.
2214*4882a593Smuzhiyun
2215*4882a593Smuzhiyun| Parameter | Description                          |
2216*4882a593Smuzhiyun| --------- | ------------------------------------ |
2217*4882a593Smuzhiyun| src       | **[required]** input imageA          |
2218*4882a593Smuzhiyun| dst       | **[required]** output image          |
2219*4882a593Smuzhiyun| pat       | **[optional]** input imageB          |
2220*4882a593Smuzhiyun| srect     | **[required]** src crop region       |
2221*4882a593Smuzhiyun| drect     | **[required]** dst crop region       |
2222*4882a593Smuzhiyun| prect     | **[optional]** pat crop region       |
2223*4882a593Smuzhiyun| usage     | **[optional]** image operation usage |
2224*4882a593Smuzhiyun
2225*4882a593Smuzhiyun**Return** IM_STATUS_NOERROR on success or else negative error code.
2226*4882a593Smuzhiyun
2227*4882a593Smuzhiyun
2228*4882a593Smuzhiyun
2229*4882a593Smuzhiyun### Synchronous operation
2230*4882a593Smuzhiyun
2231*4882a593Smuzhiyun#### imsync
2232*4882a593Smuzhiyun
2233*4882a593Smuzhiyun```C++
2234*4882a593SmuzhiyunIM_STATUS imsync(int fence_fd);
2235*4882a593Smuzhiyun```
2236*4882a593Smuzhiyun
2237*4882a593Smuzhiyun> RGA asynchronous mode requires this API to be called, passing the returned release_fence_fd as parameter.
2238*4882a593Smuzhiyun>
2239*4882a593Smuzhiyun> Other API enable asynchronous call mode when sync is set to 0, which is equivalent to glFlush in opengl. Further calls to imsync is equivalent to glFinish.
2240*4882a593Smuzhiyun
2241*4882a593Smuzhiyun| Parameter | Description                     |
2242*4882a593Smuzhiyun| --------- | ------------------------------- |
2243*4882a593Smuzhiyun| fence_fd  | **[required]** fence_fd to wait |
2244*4882a593Smuzhiyun
2245*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code.
2246*4882a593Smuzhiyun
2247*4882a593Smuzhiyun
2248*4882a593Smuzhiyun
2249*4882a593Smuzhiyun### Thread Context Configuration
2250*4882a593Smuzhiyun
2251*4882a593Smuzhiyun#### imconfig
2252*4882a593Smuzhiyun
2253*4882a593Smuzhiyun```C++
2254*4882a593SmuzhiyunIM_STATUS  imconfig(IM_CONFIG_NAME name, uint64_t value);
2255*4882a593Smuzhiyun```
2256*4882a593Smuzhiyun
2257*4882a593Smuzhiyun> The context for the current thread is configured through  different configuration name, which will be the default configuration for the thread.
2258*4882a593Smuzhiyun>
2259*4882a593Smuzhiyun> The thread context configuration has a lower priority than the parameter configuration of the API. If no related parameters are configured for API, the local call uses the default context configuration. If related parameters are configured for API, the call uses the API parameter  configuration.
2260*4882a593Smuzhiyun
2261*4882a593Smuzhiyun| Parameter | Description                                                  |
2262*4882a593Smuzhiyun| --------- | ------------------------------------------------------------ |
2263*4882a593Smuzhiyun| name      | **[required]** context config name:<br/>IM_CONFIG_SCHEDULER_CORE —— Specify the task processing core<br/>IM_CONFIG_PRIORITY                  —— Specify the task priority<br/>IM_CHECK_CONFIG                      —— Check enable |
2264*4882a593Smuzhiyun| value     | **[required]** config value<br/>    IM_CONFIG_SCHEDULER_CORE :<br/>    IM_SCHEDULER_RGA3_CORE0<br/>    IM_SCHEDULER_RGA3_CORE1<br/>    IM_SCHEDULER_RGA2_CORE0<br/>    IM_SCHEDULER_RGA3_DEFAULT<br/>    IM_SCHEDULER_RGA2_DEFAULT<br/>IM_CONFIG_PRIORITY:<br/>    0 ~ 6<br/>IM_CHECK_CONFIG:<br/>    TRUE<br/>    FALSE |
2265*4882a593Smuzhiyun
2266*4882a593Smuzhiyun> Note:Permissions of priority and core are very high. Improper operations may cause system crash or deadlock. Therefore, users are advised to configure them only during development and debugging. Users are not advised to perform this configuration in actual product
2267*4882a593Smuzhiyun
2268*4882a593Smuzhiyun**Return** IM_STATUS_SUCCESS on success or else negative error code
2269*4882a593Smuzhiyun
2270*4882a593Smuzhiyun
2271*4882a593Smuzhiyun
2272*4882a593Smuzhiyun---
2273*4882a593Smuzhiyun
2274*4882a593Smuzhiyun## Data Structure
2275*4882a593Smuzhiyun
2276*4882a593SmuzhiyunThis section describes the data structures involved in API in detail.
2277*4882a593Smuzhiyun
2278*4882a593Smuzhiyun### Overview
2279*4882a593Smuzhiyun
2280*4882a593Smuzhiyun| Data structure      | Description              |
2281*4882a593Smuzhiyun| ------------------- | ------------------------ |
2282*4882a593Smuzhiyun| rga_buffer_t        | image buffer information       |
2283*4882a593Smuzhiyun| im_rect             | the actual operating area of the image     |
2284*4882a593Smuzhiyun| im_opt_t            | image manipulation options         |
2285*4882a593Smuzhiyun| im_job_handle_t     | RGA job handle                            |
2286*4882a593Smuzhiyun| rga_buffer_handle_t | RGA driver image buffer handle            |
2287*4882a593Smuzhiyun| im_handle_param_t   | buffer parameters of image to be imported |
2288*4882a593Smuzhiyun| im_context_t        | default context for the current thread    |
2289*4882a593Smuzhiyun| im_nn_t             | operation point preprocessing parameters  |
2290*4882a593Smuzhiyun| im_colorkey_range | Colorkey range |
2291*4882a593Smuzhiyun
2292*4882a593Smuzhiyun
2293*4882a593Smuzhiyun
2294*4882a593Smuzhiyun### Detailed Descriptions
2295*4882a593Smuzhiyun
2296*4882a593Smuzhiyun#### rga_buffer_t
2297*4882a593Smuzhiyun
2298*4882a593Smuzhiyun- **descriptions**
2299*4882a593Smuzhiyun
2300*4882a593SmuzhiyunBuffer information of image with single channel.
2301*4882a593Smuzhiyun
2302*4882a593Smuzhiyun- **path**
2303*4882a593Smuzhiyun
2304*4882a593Smuzhiyunim2d_api/im2d_type.h
2305*4882a593Smuzhiyun
2306*4882a593Smuzhiyun- **definitions**
2307*4882a593Smuzhiyun
2308*4882a593Smuzhiyun```c++
2309*4882a593Smuzhiyuntypedef struct {
2310*4882a593Smuzhiyun    void* vir_addr;                     /* virtual address */
2311*4882a593Smuzhiyun    void* phy_addr;                     /* physical address */
2312*4882a593Smuzhiyun    int fd;                             /* shared fd */
2313*4882a593Smuzhiyun    rga_buffer_handle_t handle;         /* buffer handle */
2314*4882a593Smuzhiyun
2315*4882a593Smuzhiyun    int width;                          /* width */
2316*4882a593Smuzhiyun    int height;                         /* height */
2317*4882a593Smuzhiyun    int wstride;                        /* wstride */
2318*4882a593Smuzhiyun    int hstride;                        /* hstride */
2319*4882a593Smuzhiyun    int format;                         /* format */
2320*4882a593Smuzhiyun
2321*4882a593Smuzhiyun    int color_space_mode;               /* color_space_mode */
2322*4882a593Smuzhiyun    int global_alpha;                   /* global_alpha */
2323*4882a593Smuzhiyun    int rd_mode;
2324*4882a593Smuzhiyun} rga_buffer_t;
2325*4882a593Smuzhiyun```
2326*4882a593Smuzhiyun
2327*4882a593Smuzhiyun| Parameter        | Description                                  |
2328*4882a593Smuzhiyun| ---------------- | --------------------------------------- |
2329*4882a593Smuzhiyun| vir_addr         | Virtual address of image buffer.                    |
2330*4882a593Smuzhiyun| phy_addr         | Contiguous physical address of the image buffer.    |
2331*4882a593Smuzhiyun| fd               | File descriptor of image buffer DMA.             |
2332*4882a593Smuzhiyun| handle           | Import handle corresponding to the image buffer of the RGA driver. |
2333*4882a593Smuzhiyun| width            | The width of the actual operating area of image,in pixels.  |
2334*4882a593Smuzhiyun| height           | The height of the actual operating area of image,in pixels. |
2335*4882a593Smuzhiyun| wstride          | The stride of the image width, in pixels.          |
2336*4882a593Smuzhiyun| hstride          | The stride of the image height, in pixels.          |
2337*4882a593Smuzhiyun| format           | Image format.                              |
2338*4882a593Smuzhiyun| color_space_mode | Image color space mode.                         |
2339*4882a593Smuzhiyun| global_alpha     | Global Alpha configuration.                         |
2340*4882a593Smuzhiyun| rd_mode          | The mode in which the current channel reads data.                  |
2341*4882a593Smuzhiyun
2342*4882a593Smuzhiyun- **Note**
2343*4882a593Smuzhiyun
2344*4882a593SmuzhiyunSimply selects either one of vir_addr、phy_addr、fd、handle as the description of image buffer, if multiple values are assigned, only one of them is selected as the image buffer description according to the default priority, which is as follows:handle > phy_addr > fd > vir_addr.
2345*4882a593Smuzhiyun
2346*4882a593Smuzhiyun
2347*4882a593Smuzhiyun
2348*4882a593Smuzhiyun#### im_rect
2349*4882a593Smuzhiyun
2350*4882a593Smuzhiyun- **descriptions**
2351*4882a593Smuzhiyun
2352*4882a593SmuzhiyunDescribes the actual operation area of image with single channel.
2353*4882a593Smuzhiyun
2354*4882a593Smuzhiyun- **path**
2355*4882a593Smuzhiyun
2356*4882a593Smuzhiyunim2d_api/im2d_type.h
2357*4882a593Smuzhiyun
2358*4882a593Smuzhiyun- **definitions**
2359*4882a593Smuzhiyun
2360*4882a593Smuzhiyun```c++
2361*4882a593Smuzhiyuntypedef struct {
2362*4882a593Smuzhiyun    int x;        /* upper-left x */
2363*4882a593Smuzhiyun    int y;        /* upper-left y */
2364*4882a593Smuzhiyun    int width;    /* width */
2365*4882a593Smuzhiyun    int height;   /* height */
2366*4882a593Smuzhiyun} im_rect;
2367*4882a593Smuzhiyun```
2368*4882a593Smuzhiyun
2369*4882a593Smuzhiyun| Parameters | Description                                        |
2370*4882a593Smuzhiyun| -------- | -------------------------------------------- |
2371*4882a593Smuzhiyun| x        | The starting abscissa of the actual operation area of the image, in pixels.|
2372*4882a593Smuzhiyun| y        | The starting ordinate of the actual operating area of an image, in pixels. |
2373*4882a593Smuzhiyun| width    | The width of the actual operating area of the image, in pixels.       |
2374*4882a593Smuzhiyun| height   | The height of the actual operating area of the image, in pixels.       |
2375*4882a593Smuzhiyun
2376*4882a593Smuzhiyun- **Note**
2377*4882a593Smuzhiyun
2378*4882a593SmuzhiyunThe actual operating area cannot exceed the image size, i.e(x + width)<= wstride, (y + height) <= hstride。
2379*4882a593Smuzhiyun
2380*4882a593Smuzhiyun
2381*4882a593Smuzhiyun
2382*4882a593Smuzhiyun#### im_opt_t
2383*4882a593Smuzhiyun
2384*4882a593Smuzhiyun- **description**
2385*4882a593Smuzhiyun
2386*4882a593SmuzhiyunDescribes operation options of current image.
2387*4882a593Smuzhiyun
2388*4882a593Smuzhiyun- **path**
2389*4882a593Smuzhiyun
2390*4882a593Smuzhiyunim2d_api/im2d_type.h
2391*4882a593Smuzhiyun
2392*4882a593Smuzhiyun- **definitions**
2393*4882a593Smuzhiyun
2394*4882a593Smuzhiyun```c++
2395*4882a593Smuzhiyuntypedef struct im_opt {
2396*4882a593Smuzhiyun    int color;                          /* color, used by color fill */
2397*4882a593Smuzhiyun    im_colorkey_range colorkey_range;   /* range value of color key */
2398*4882a593Smuzhiyun    im_nn_t nn;
2399*4882a593Smuzhiyun    int rop_code;
2400*4882a593Smuzhiyun
2401*4882a593Smuzhiyun    int priority;
2402*4882a593Smuzhiyun    int core;
2403*4882a593Smuzhiyun} im_opt_t;
2404*4882a593Smuzhiyun```
2405*4882a593Smuzhiyun
2406*4882a593Smuzhiyun| Parameter       | Description                       |
2407*4882a593Smuzhiyun| -------------- | -------------------------- |
2408*4882a593Smuzhiyun| color          | Image color-fill configuration.         |
2409*4882a593Smuzhiyun| colorkey_range | Colorkey range configuration.   |
2410*4882a593Smuzhiyun| nn             | Operation point preprocessing (quantization) configuration. |
2411*4882a593Smuzhiyun| rop_code       | ROP operation code configuration.    |
2412*4882a593Smuzhiyun| priority       | Current task priority configuration.       |
2413*4882a593Smuzhiyun| core           | Specify the hardware core of current task.     |
2414*4882a593Smuzhiyun
2415*4882a593Smuzhiyun- **Note**
2416*4882a593Smuzhiyun
2417*4882a593SmuzhiyunPermissions of priority and core are very high. Improper operations may cause system crash or deadlock. Therefore, users are advised to configure them only during development and debugging.Users are not advised to perform this configuration in actual product.
2418*4882a593Smuzhiyun
2419*4882a593Smuzhiyun
2420*4882a593Smuzhiyun
2421*4882a593Smuzhiyun#### im_job_handle_t
2422*4882a593Smuzhiyun
2423*4882a593Smuzhiyun- **说明**
2424*4882a593Smuzhiyun
2425*4882a593SmuzhiyunRGA jobhandle, used to identify the currently configured RGA job.
2426*4882a593Smuzhiyun
2427*4882a593Smuzhiyun- **路径**
2428*4882a593Smuzhiyun
2429*4882a593Smuzhiyunim2d_api/im2d_type.h
2430*4882a593Smuzhiyun
2431*4882a593Smuzhiyun- **定义**
2432*4882a593Smuzhiyun
2433*4882a593Smuzhiyun```c++
2434*4882a593Smuzhiyuntypedef uint32_t im_job_handle_t;
2435*4882a593Smuzhiyun```
2436*4882a593Smuzhiyun
2437*4882a593Smuzhiyun- **注意事项**
2438*4882a593Smuzhiyun
2439*4882a593SmuzhiyunAfter the configuration fails, imcancelJob must be used to release the current task handle to avoid memory leaks.
2440*4882a593Smuzhiyun
2441*4882a593Smuzhiyun
2442*4882a593Smuzhiyun
2443*4882a593Smuzhiyun#### rga_buffer_handle_t
2444*4882a593Smuzhiyun
2445*4882a593Smuzhiyun- **description**
2446*4882a593Smuzhiyun
2447*4882a593SmuzhiyunRGA driver image buffer handle.
2448*4882a593Smuzhiyun
2449*4882a593Smuzhiyun- **path**
2450*4882a593Smuzhiyun
2451*4882a593Smuzhiyunim2d_api/im2d_type.h
2452*4882a593Smuzhiyun
2453*4882a593Smuzhiyun- **definitions**
2454*4882a593Smuzhiyun
2455*4882a593Smuzhiyun```c++
2456*4882a593Smuzhiyuntypedef int rga_buffer_handle_t;
2457*4882a593Smuzhiyun```
2458*4882a593Smuzhiyun
2459*4882a593Smuzhiyun- **Note**
2460*4882a593Smuzhiyun
2461*4882a593SmuzhiyunWhen the buffer is used up, releasebuffer_handle must be used to release the memory to avoid memory leaks.
2462*4882a593Smuzhiyun
2463*4882a593Smuzhiyun
2464*4882a593Smuzhiyun
2465*4882a593Smuzhiyun#### im_handle_param_t
2466*4882a593Smuzhiyun
2467*4882a593Smuzhiyun- **description**
2468*4882a593Smuzhiyun
2469*4882a593SmuzhiyunDescribe parameters of the image buffer to be imported.
2470*4882a593Smuzhiyun
2471*4882a593Smuzhiyun- **path**
2472*4882a593Smuzhiyun
2473*4882a593Smuzhiyunim2d_api/im2d_type.h
2474*4882a593Smuzhiyun
2475*4882a593Smuzhiyun- **definitions**
2476*4882a593Smuzhiyun
2477*4882a593Smuzhiyun```c++
2478*4882a593Smuzhiyuntypedef struct rga_memory_parm im_handle_param_t;
2479*4882a593Smuzhiyun
2480*4882a593Smuzhiyunstruct rga_memory_parm {
2481*4882a593Smuzhiyun    uint32_t width_stride;
2482*4882a593Smuzhiyun    uint32_t height_stride;
2483*4882a593Smuzhiyun    uint32_t format;
2484*4882a593Smuzhiyun};
2485*4882a593Smuzhiyun```
2486*4882a593Smuzhiyun
2487*4882a593Smuzhiyun| Parameter     | Description                                        |
2488*4882a593Smuzhiyun| ------------- | -------------------------------------------------- |
2489*4882a593Smuzhiyun| width_stride  | Describes the horizontal stride of the image buffer to be imported, in pixels. |
2490*4882a593Smuzhiyun| height_stride | Describes the vertical stride of the image buffer to be imported, in pixels. |
2491*4882a593Smuzhiyun| format        | Describes the format of the buffer of the image to be imported.                       |
2492*4882a593Smuzhiyun
2493*4882a593Smuzhiyun- **Note**
2494*4882a593Smuzhiyun
2495*4882a593SmuzhiyunIf the actual size of buffer memory is smaller than the configured size, the importbuffer_T API error occurs.
2496*4882a593Smuzhiyun
2497*4882a593Smuzhiyun
2498*4882a593Smuzhiyun
2499*4882a593Smuzhiyun#### im_nn_t
2500*4882a593Smuzhiyun
2501*4882a593Smuzhiyun- **description**
2502*4882a593Smuzhiyun
2503*4882a593SmuzhiyunParameter of operation point preprocessing (quantization).
2504*4882a593Smuzhiyun
2505*4882a593Smuzhiyun- **path**
2506*4882a593Smuzhiyun
2507*4882a593Smuzhiyunim2d_api/im2d_type.h
2508*4882a593Smuzhiyun
2509*4882a593Smuzhiyun- **definitions**
2510*4882a593Smuzhiyun
2511*4882a593Smuzhiyun```c++
2512*4882a593Smuzhiyuntypedef struct im_nn {
2513*4882a593Smuzhiyun    int scale_r;                /* scaling factor on R channal */
2514*4882a593Smuzhiyun    int scale_g;                /* scaling factor on G channal */
2515*4882a593Smuzhiyun    int scale_b;                /* scaling factor on B channal */
2516*4882a593Smuzhiyun    int offset_r;               /* offset on R channal */
2517*4882a593Smuzhiyun    int offset_g;               /* offset on G channal */
2518*4882a593Smuzhiyun    int offset_b;               /* offset on B channal */
2519*4882a593Smuzhiyun} im_nn_t;
2520*4882a593Smuzhiyun```
2521*4882a593Smuzhiyun
2522*4882a593Smuzhiyun| Parameter | Description                |
2523*4882a593Smuzhiyun| -------- | ------------------- |
2524*4882a593Smuzhiyun| scale_r  | Scaling factor on red channel.   |
2525*4882a593Smuzhiyun| scale_g  | Scaling factor on green channel. |
2526*4882a593Smuzhiyun| scale_b  | Scaling factor on blue channel.  |
2527*4882a593Smuzhiyun| offset_r | Offset on red channel.     |
2528*4882a593Smuzhiyun| offset_g | Offset on green channel.   |
2529*4882a593Smuzhiyun| offset_b | Offset on blue channel.    |
2530*4882a593Smuzhiyun
2531*4882a593Smuzhiyun- **Note**
2532*4882a593Smuzhiyun
2533*4882a593Smuzhiyunnull
2534*4882a593Smuzhiyun
2535*4882a593Smuzhiyun
2536*4882a593Smuzhiyun
2537*4882a593Smuzhiyun#### im_colorkey_range
2538*4882a593Smuzhiyun
2539*4882a593Smuzhiyun- **description**
2540*4882a593Smuzhiyun
2541*4882a593SmuzhiyunColorkey range.
2542*4882a593Smuzhiyun
2543*4882a593Smuzhiyun- **path**
2544*4882a593Smuzhiyun
2545*4882a593Smuzhiyunim2d_api/im2d_type.h
2546*4882a593Smuzhiyun
2547*4882a593Smuzhiyun- **definitions**
2548*4882a593Smuzhiyun
2549*4882a593Smuzhiyun```c++
2550*4882a593Smuzhiyuntypedef struct {
2551*4882a593Smuzhiyun    int max;                    /* The Maximum value of the color key */
2552*4882a593Smuzhiyun    int min;                    /* The minimum value of the color key */
2553*4882a593Smuzhiyun} im_colorkey_range;
2554*4882a593Smuzhiyun```
2555*4882a593Smuzhiyun
2556*4882a593Smuzhiyun| Parameter | Description               |
2557*4882a593Smuzhiyun| -------- | ------------------ |
2558*4882a593Smuzhiyun| max      | The Maximum value of the color key. |
2559*4882a593Smuzhiyun| min      | The minimum value of the color key. |
2560*4882a593Smuzhiyun
2561*4882a593Smuzhiyun- **Note**
2562*4882a593Smuzhiyun
2563*4882a593Smuzhiyunnull
2564*4882a593Smuzhiyun
2565*4882a593Smuzhiyun
2566*4882a593Smuzhiyun
2567*4882a593Smuzhiyun---
2568*4882a593Smuzhiyun
2569*4882a593Smuzhiyun## Test Cases and Debugging Methods
2570*4882a593Smuzhiyun
2571*4882a593Smuzhiyun> In order to make developers get started with the above new API more quickly, here by running demo and parsing the  source code to help developers to understand and use the API.
2572*4882a593Smuzhiyun
2573*4882a593Smuzhiyun
2574*4882a593Smuzhiyun
2575*4882a593Smuzhiyun### Test File Description
2576*4882a593Smuzhiyun
2577*4882a593Smuzhiyun> Input and output binary file for testing should be prepared in advance. The default source image file in RGBA8888 format is stored in directory /sample/sample_file.
2578*4882a593Smuzhiyun>
2579*4882a593Smuzhiyun> In Android system, the source image should be stored in  /data/ directory of device,in Linux system, the source image should be stored in/usr/data directory of device. The file naming rules are as follows:
2580*4882a593Smuzhiyun
2581*4882a593Smuzhiyun```
2582*4882a593Smuzhiyunin%dw%d-h%d-%s.bin
2583*4882a593Smuzhiyunout%dw%d-h%d-%s.bin
2584*4882a593Smuzhiyun
2585*4882a593SmuzhiyunExample:
2586*4882a593Smuzhiyun1280×720 RGBA8888 input image: in0w1280-h720-rgba8888.bin
2587*4882a593Smuzhiyun1280×720 RGBA8888 output image: out0w1280-h720-rgba8888.bin
2588*4882a593Smuzhiyun```
2589*4882a593Smuzhiyun
2590*4882a593SmuzhiyunParameter descriptions:
2591*4882a593Smuzhiyun
2592*4882a593Smuzhiyun> The input is in ,the output is out.
2593*4882a593Smuzhiyun> --->The first%d is the index of files, usually 0, used to distinguish files of the same format, width and height.
2594*4882a593Smuzhiyun> --->The second%d is width, usually indicates virtual width.
2595*4882a593Smuzhiyun> --->The third%d is height, usually indicates virtual height.
2596*4882a593Smuzhiyun> --->The fourth%s is the name of format.
2597*4882a593Smuzhiyun>
2598*4882a593Smuzhiyun>  Some common image formats for preset tests are as follows. You can view names of other formats in rgaUtils.cpp:
2599*4882a593Smuzhiyun
2600*4882a593Smuzhiyun| format(Android)                 | format(Linux)            | name        |
2601*4882a593Smuzhiyun| :-------------------------------- | -------------------------- | ----------- |
2602*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_RGB_565          | RK_FORMAT_RGB_565          | "rgb565"    |
2603*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_RGB_888          | RK_FORMAT_RGB_888          | "rgb888"    |
2604*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_RGBA_8888        | RK_FORMAT_RGBA_8888        | "rgba8888"  |
2605*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_RGBX_8888        | RK_FORMAT_RGBX_8888        | "rgbx8888"  |
2606*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_BGRA_8888        | RK_FORMAT_BGRA_8888        | "bgra8888"  |
2607*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_YCrCb_420_SP     | RK_FORMAT_YCrCb_420_SP     | "crcb420sp" |
2608*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_YCrCb_NV12       | RK_FORMAT_YCbCr_420_SP     | "nv12"      |
2609*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_YCrCb_NV12_VIDEO | /                          | "nv12"      |
2610*4882a593Smuzhiyun| HAL_PIXEL_FORMAT_YCrCb_NV12_10    | RK_FORMAT_YCbCr_420_SP_10B | "nv12_10"   |
2611*4882a593Smuzhiyun
2612*4882a593Smuzhiyun>The default resolution of input image of demo is 1280x720, format is RGBA8888, in0w1280-h720-rgba8888.bin source image should be prepared in advance in the /data or /usr/data directory, in1w1280-h720-rgba8888.bin source image should be additionally prepared in advance in the /data or /usr/data directory in image blending mode.
2613*4882a593Smuzhiyun
2614*4882a593Smuzhiyun
2615*4882a593Smuzhiyun
2616*4882a593Smuzhiyun### Debugging Method Description
2617*4882a593Smuzhiyun
2618*4882a593Smuzhiyun> After running demo, print log as follows (in image copying, for example):
2619*4882a593Smuzhiyun>
2620*4882a593Smuzhiyun> Log is printed in Android system as follows:
2621*4882a593Smuzhiyun
2622*4882a593Smuzhiyun```C++
2623*4882a593Smuzhiyun# rgaImDemo --copy
2624*4882a593Smuzhiyun
2625*4882a593Smuzhiyunlibrga:RGA_GET_VERSION:3.02,3.020000					//RGA version
2626*4882a593Smuzhiyunctx=0x7ba35c1520,ctx->rgaFd=3							//RGA context
2627*4882a593SmuzhiyunStart selecting mode
2628*4882a593Smuzhiyunim2d copy ..											//RGA running mode
2629*4882a593SmuzhiyunGraphicBuffer check ok
2630*4882a593SmuzhiyunGraphicBuffer check ok
2631*4882a593Smuzhiyunlock buffer ok
2632*4882a593Smuzhiyunopen file ok											//src file status, if there is no corresponding file in /data/ directory, an error will be reported here
2633*4882a593Smuzhiyununlock buffer ok
2634*4882a593Smuzhiyunlock buffer ok
2635*4882a593Smuzhiyununlock buffer ok
2636*4882a593Smuzhiyuncopying .... successfully								//indicates successful running
2637*4882a593Smuzhiyunopen /data/out0w1280-h720-rgba8888.bin and write ok		//output filename and directory
2638*4882a593Smuzhiyun```
2639*4882a593Smuzhiyun
2640*4882a593Smuzhiyun> Log is printed in Linux system as follows:
2641*4882a593Smuzhiyun
2642*4882a593Smuzhiyun```C++
2643*4882a593Smuzhiyun# rgaImDemo --copy
2644*4882a593Smuzhiyun
2645*4882a593Smuzhiyunlibrga:RGA_GET_VERSION:3.02,3.020000					//RGA version
2646*4882a593Smuzhiyunctx=0x2b070,ctx->rgaFd=3								//RGA context
2647*4882a593SmuzhiyunRga built version:version:1.00
2648*4882a593SmuzhiyunStart selecting mode
2649*4882a593Smuzhiyunim2d copy ..											//RGA running mode
2650*4882a593Smuzhiyunopen file												//src file status, if there is no corresponding file in /usr/data/ directory, an error will be reported here
2651*4882a593Smuzhiyuncopying .... Run successfully							//indicates successful running
2652*4882a593Smuzhiyunopen /usr/data/out0w1280-h720-rgba8888.bin and write ok	//output filename and directory
2653*4882a593Smuzhiyun```
2654*4882a593Smuzhiyun
2655*4882a593Smuzhiyun> To view more detailed logs of RGA running, the Android system can enable RGA configuration log print by setting vendor.rga.log (Android 8 and below is sys.rga.log):
2656*4882a593Smuzhiyun
2657*4882a593Smuzhiyun```
2658*4882a593Smuzhiyunsetprop vendor.rga.log 1		enable RGA log print
2659*4882a593Smuzhiyunlogcat -s librga				enable and filter log print
2660*4882a593Smuzhiyunsetprop vendor.rga.log 0		 cancel RGA log print
2661*4882a593Smuzhiyun```
2662*4882a593Smuzhiyun
2663*4882a593Smuzhiyun> In Linux system, you should open core/NormalRgaContext.h, set __DEBUG to 1 and recompile.
2664*4882a593Smuzhiyun
2665*4882a593Smuzhiyun```
2666*4882a593Smuzhiyun#ifdef LINUX
2667*4882a593Smuzhiyun
2668*4882a593Smuzhiyun-#define __DEBUG 0
2669*4882a593Smuzhiyun+#define __DEBUG 1
2670*4882a593Smuzhiyun```
2671*4882a593Smuzhiyun
2672*4882a593Smuzhiyun> Generally, the printed log is as follows, which can be uploaded to RedMine for analysis by relevant engineers of RK:
2673*4882a593Smuzhiyun>
2674*4882a593Smuzhiyun> Log is printed in Android system as follows:
2675*4882a593Smuzhiyun
2676*4882a593Smuzhiyun```
2677*4882a593Smuzhiyun D librga  : <<<<-------- print rgaLog -------->>>>
2678*4882a593Smuzhiyun D librga  : src->hnd = 0x0 , dst->hnd = 0x0
2679*4882a593Smuzhiyun D librga  : srcFd = 11 , phyAddr = 0x0 , virAddr = 0x0
2680*4882a593Smuzhiyun D librga  : dstFd = 15 , phyAddr = 0x0 , virAddr = 0x0
2681*4882a593Smuzhiyun D librga  : srcBuf = 0x0 , dstBuf = 0x0
2682*4882a593Smuzhiyun D librga  : blend = 0 , perpixelAlpha = 1
2683*4882a593Smuzhiyun D librga  : scaleMode = 0 , stretch = 0;
2684*4882a593Smuzhiyun D librga  : rgaVersion = 3.020000  , ditherEn =0
2685*4882a593Smuzhiyun D librga  : srcMmuFlag = 1 , dstMmuFlag = 1 , rotateMode = 0
2686*4882a593Smuzhiyun D librga  : <<<<-------- rgaReg -------->>>>
2687*4882a593Smuzhiyun D librga  : render_mode=0 rotate_mode=0
2688*4882a593Smuzhiyun D librga  : src:[b,0,e1000],x-y[0,0],w-h[1280,720],vw-vh[1280,720],f=0
2689*4882a593Smuzhiyun D librga  : dst:[f,0,e1000],x-y[0,0],w-h[1280,720],vw-vh[1280,720],f=0
2690*4882a593Smuzhiyun D librga  : pat:[0,0,0],x-y[0,0],w-h[0,0],vw-vh[0,0],f=0
2691*4882a593Smuzhiyun D librga  : ROP:[0,0,0],LUT[0]
2692*4882a593Smuzhiyun D librga  : color:[0,0,0,0,0]
2693*4882a593Smuzhiyun D librga  : MMU:[1,0,80000521]
2694*4882a593Smuzhiyun D librga  : mode[0,0,0,0]
2695*4882a593Smuzhiyun```
2696*4882a593Smuzhiyun
2697*4882a593Smuzhiyun> Log is printed in Linux system as follows:
2698*4882a593Smuzhiyun
2699*4882a593Smuzhiyun```C++
2700*4882a593Smuzhiyunrender_mode=0 rotate_mode=0
2701*4882a593Smuzhiyunsrc:[0,a681a008,a68fb008],x-y[0,0],w-h[1280,720],vw-vh[1280,720],f=0
2702*4882a593Smuzhiyundst:[0,a6495008,a6576008],x-y[0,0],w-h[1280,720],vw-vh[1280,720],f=0
2703*4882a593Smuzhiyunpat:[0,0,0],x-y[0,0],w-h[0,0],vw-vh[0,0],f=0
2704*4882a593SmuzhiyunROP:[0,0,0],LUT[0]
2705*4882a593Smuzhiyuncolor:[0,0,0,0,0]
2706*4882a593SmuzhiyunMMU:[1,0,80000521]
2707*4882a593Smuzhiyunmode[0,0,0,0,0]
2708*4882a593Smuzhiyungr_color_x [0, 0, 0]
2709*4882a593Smuzhiyungr_color_x [0, 0, 0]
2710*4882a593Smuzhiyun```
2711*4882a593Smuzhiyun
2712*4882a593Smuzhiyun
2713*4882a593Smuzhiyun
2714*4882a593Smuzhiyun### Test Case Descriptions
2715*4882a593Smuzhiyun
2716*4882a593Smuzhiyun- The test path is sample/im2d_API_demo. Developers can modify the demo configuration as required. It is recommended to use the default configuration when running demo for the first time.
2717*4882a593Smuzhiyun- The compilation of test cases varies on different platforms. On the Android platform, the 'mm' command can be used to compile the test cases. On the Linux platform, when librga.so is compiled using cmake, the corresponding test cases will be generated in the same directory
2718*4882a593Smuzhiyun
2719*4882a593Smuzhiyun- Import the executable file generated by compiling the corresponding test case into the device through adb, add the execution permission, execute demo, and check the printed log.
2720*4882a593Smuzhiyun- Check the output file to see if it matches your expectations.
2721*4882a593Smuzhiyun
2722*4882a593Smuzhiyun
2723*4882a593Smuzhiyun
2724*4882a593Smuzhiyun#### Apply for Image Buffer
2725*4882a593Smuzhiyun
2726*4882a593Smuzhiyun> The demo provides two types of buffer for RGA synthesis: Graphicbuffer and AHardwareBuffer. The two buffers are distinguished by the macro USE_AHARDWAREBUFFER.
2727*4882a593Smuzhiyun
2728*4882a593Smuzhiyun```c++
2729*4882a593SmuzhiyunDirectory:librga/samples/im2d_api_demo/Android.mk
2730*4882a593Smuzhiyun(line +15)
2731*4882a593Smuzhiyun
2732*4882a593Smuzhiyunifeq (1,$(strip $(shell expr $(PLATFORM_SDK_VERSION) \> 25)))
2733*4882a593Smuzhiyun/*if USE_AHARDWAREBUFFER is set to 1 then use AHardwareBuffer, if USE_AHARDWAREBUFFER is set to 0 then use Graphicbuffer*/
2734*4882a593SmuzhiyunLOCAL_CFLAGS += -DUSE_AHARDWAREBUFFER=1
2735*4882a593Smuzhiyunendif
2736*4882a593Smuzhiyun```
2737*4882a593Smuzhiyun
2738*4882a593Smuzhiyun
2739*4882a593Smuzhiyun
2740*4882a593Smuzhiyun##### Graphicbuffer
2741*4882a593Smuzhiyun
2742*4882a593Smuzhiyun> Graphicbuffer is initialized, filled/emptied, and filling rga_buffer_t structure through three functions.
2743*4882a593Smuzhiyun
2744*4882a593Smuzhiyun```c++
2745*4882a593Smuzhiyun	/*Passing in width, height, and image formats of src/dst and initialize Graphicbuffer*/
2746*4882a593Smuzhiyun	src_buf = GraphicBuffer_Init(SRC_WIDTH, SRC_HEIGHT, SRC_FORMAT);
2747*4882a593Smuzhiyun	dst_buf = GraphicBuffer_Init(DST_WIDTH, DST_HEIGHT, DST_FORMAT);
2748*4882a593Smuzhiyun
2749*4882a593Smuzhiyun	/*Fill/empty Graphicbuffer by enumerating FILL_BUFF/EMPTY_BUFF*/
2750*4882a593Smuzhiyun	GraphicBuffer_Fill(src_buf, FILL_BUFF, 0);
2751*4882a593Smuzhiyun	if(MODE == MODE_BLEND)
2752*4882a593Smuzhiyun		GraphicBuffer_Fill(dst_buf, FILL_BUFF, 1);
2753*4882a593Smuzhiyun	else
2754*4882a593Smuzhiyun		GraphicBuffer_Fill(dst_buf, EMPTY_BUFF, 1);
2755*4882a593Smuzhiyun
2756*4882a593Smuzhiyun	/*Fill rga_buffer_t structure: src、dst*/
2757*4882a593Smuzhiyun	src = wrapbuffer_GraphicBuffer(src_buf);
2758*4882a593Smuzhiyun	dst = wrapbuffer_GraphicBuffer(dst_buf);
2759*4882a593Smuzhiyun```
2760*4882a593Smuzhiyun
2761*4882a593Smuzhiyun
2762*4882a593Smuzhiyun
2763*4882a593Smuzhiyun##### AHardwareBuffer
2764*4882a593Smuzhiyun
2765*4882a593Smuzhiyun> AHardwareBuffer is initialized, filled/emptied, and filling rga_buffer_t structure through three functions.
2766*4882a593Smuzhiyun
2767*4882a593Smuzhiyun```c++
2768*4882a593Smuzhiyun	/*Passing in width, height, and image formats of src/dst and initialize AHardwareBuffer*/
2769*4882a593Smuzhiyun	AHardwareBuffer_Init(SRC_WIDTH, SRC_HEIGHT, SRC_FORMAT, &src_buf);
2770*4882a593Smuzhiyun	AHardwareBuffer_Init(DST_WIDTH, DST_HEIGHT, DST_FORMAT, &dst_buf);
2771*4882a593Smuzhiyun
2772*4882a593Smuzhiyun	/*Fill/empty AHardwareBuffer by enumerating FILL_BUFF/EMPTY_BUFF*/
2773*4882a593Smuzhiyun	AHardwareBuffer_Fill(&src_buf, FILL_BUFF, 0);
2774*4882a593Smuzhiyun	if(MODE == MODE_BLEND)
2775*4882a593Smuzhiyun		AHardwareBuffer_Fill(&dst_buf, FILL_BUFF, 1);
2776*4882a593Smuzhiyun	else
2777*4882a593Smuzhiyun		AHardwareBuffer_Fill(&dst_buf, EMPTY_BUFF, 1);
2778*4882a593Smuzhiyun
2779*4882a593Smuzhiyun	/*Fill rga_buffer_t structure: src、dst*/
2780*4882a593Smuzhiyun	src = wrapbuffer_AHardwareBuffer(src_buf);
2781*4882a593Smuzhiyun	dst = wrapbuffer_AHardwareBuffer(dst_buf);
2782*4882a593Smuzhiyun```
2783*4882a593Smuzhiyun
2784*4882a593Smuzhiyun
2785*4882a593Smuzhiyun
2786*4882a593Smuzhiyun#### Viewing Help Information
2787*4882a593Smuzhiyun
2788*4882a593Smuzhiyun> Run the following command to obtain the help information about the test case:
2789*4882a593Smuzhiyun
2790*4882a593Smuzhiyun```
2791*4882a593SmuzhiyunrgaImDemo -h
2792*4882a593SmuzhiyunrgaImDemo --help
2793*4882a593SmuzhiyunrgaImDemo
2794*4882a593Smuzhiyun```
2795*4882a593Smuzhiyun
2796*4882a593Smuzhiyun> You can use demo according to the help information. The following information is printed:
2797*4882a593Smuzhiyun
2798*4882a593Smuzhiyun```
2799*4882a593Smuzhiyunrk3399_Android10:/ # rgaImDemo
2800*4882a593Smuzhiyunlibrga:RGA_GET_VERSION:3.02,3.020000
2801*4882a593Smuzhiyunctx=0x7864d7c520,ctx->rgaFd=3
2802*4882a593Smuzhiyun
2803*4882a593Smuzhiyun=============================================================================================
2804*4882a593Smuzhiyun   usage: rgaImDemo [--help/-h] [--while/-w=(time)] [--querystring/--querystring=<options>]
2805*4882a593Smuzhiyun                    [--copy] [--resize=<up/down>] [--crop] [--rotate=90/180/270]
2806*4882a593Smuzhiyun                    [--flip=H/V] [--translate] [--blend] [--cvtcolor]
2807*4882a593Smuzhiyun                    [--fill=blue/green/red]
2808*4882a593Smuzhiyun         --help/-h     Call help
2809*4882a593Smuzhiyun         --while/w     Set the loop mode. Users can set the number of cycles by themselves.
2810*4882a593Smuzhiyun         --querystring You can print the version or support information corresponding to the current version of RGA according to the options.
2811*4882a593Smuzhiyun                       If there is no input options, all versions and support information of the current version of RGA will be printed.
2812*4882a593Smuzhiyun                       <options>:
2813*4882a593Smuzhiyun                       vendor           Print vendor information.
2814*4882a593Smuzhiyun                       version          Print RGA version, and librga/im2d_api version.
2815*4882a593Smuzhiyun                       maxinput         Print max input resolution.
2816*4882a593Smuzhiyun                       maxoutput        Print max output resolution.
2817*4882a593Smuzhiyun                       scalelimit       Print scale limit.
2818*4882a593Smuzhiyun                       inputformat      Print supported input formats.
2819*4882a593Smuzhiyun                       outputformat     Print supported output formats.
2820*4882a593Smuzhiyun                       expected         Print expected performance.
2821*4882a593Smuzhiyun                       all              Print all information.
2822*4882a593Smuzhiyun         --copy        Copy the image by RGA.The default is 720p to 720p.
2823*4882a593Smuzhiyun         --resize      resize the image by RGA.You can choose to up(720p->1080p) or down(720p->480p).
2824*4882a593Smuzhiyun         --crop        Crop the image by RGA.By default, a picture of 300*300 size is cropped from (100,100).
2825*4882a593Smuzhiyun         --rotate      Rotate the image by RGA.You can choose to rotate 90/180/270 degrees.
2826*4882a593Smuzhiyun
2827*4882a593Smuzhiyun         --flip        Flip the image by RGA.You can choice of horizontal flip or vertical flip.
2828*4882a593Smuzhiyun         --translate   Translate the image by RGA.Default translation (300,300).
2829*4882a593Smuzhiyun         --blend       Blend the image by RGA.Default, Porter-Duff 'SRC over DST'.
2830*4882a593Smuzhiyun         --cvtcolor    Modify the image format and color space by RGA.The default is RGBA8888 to NV12.
2831*4882a593Smuzhiyun         --fill        Fill the image by RGA to blue, green, red, when you set the option to the corresponding color.
2832*4882a593Smuzhiyun=============================================================================================
2833*4882a593Smuzhiyun```
2834*4882a593Smuzhiyun
2835*4882a593Smuzhiyun> Parameter parsing is in the directory /librga/demo/im2d_api_demo/args.cpp.
2836*4882a593Smuzhiyun
2837*4882a593Smuzhiyun
2838*4882a593Smuzhiyun
2839*4882a593Smuzhiyun#### Executing Demo in Loop
2840*4882a593Smuzhiyun
2841*4882a593Smuzhiyun> Run the following command to loop demo. The loop command must precede all parameters. The number of cycles are of the type int and the default interval is 200ms.
2842*4882a593Smuzhiyun
2843*4882a593Smuzhiyun```
2844*4882a593SmuzhiyunrgaImDemo -w6 --copy
2845*4882a593SmuzhiyunrgaImDemo --while=6 --copy
2846*4882a593Smuzhiyun```
2847*4882a593Smuzhiyun
2848*4882a593Smuzhiyun
2849*4882a593Smuzhiyun
2850*4882a593Smuzhiyun#### Obtain RGA Version and Support Information
2851*4882a593Smuzhiyun
2852*4882a593Smuzhiyun> Run the following command to obtain the version and support information:
2853*4882a593Smuzhiyun
2854*4882a593Smuzhiyun```
2855*4882a593SmuzhiyunrgaImDemo --querystring
2856*4882a593SmuzhiyunrgaImDemo --querystring=<options>
2857*4882a593Smuzhiyun```
2858*4882a593Smuzhiyun
2859*4882a593Smuzhiyun> If there is no input options, all versions and support information of current version of RGA will be printed.
2860*4882a593Smuzhiyun
2861*4882a593Smuzhiyun```
2862*4882a593Smuzhiyunoptions:
2863*4882a593Smuzhiyun	=vendor				  Print vendor information.
2864*4882a593Smuzhiyun	=version			  Print RGA version, and librga/im2d_api version.
2865*4882a593Smuzhiyun	=maxinput			  Print max input resolution.
2866*4882a593Smuzhiyun	=maxoutput			Print max output resolution.
2867*4882a593Smuzhiyun	=scalelimit			Print scale limit.
2868*4882a593Smuzhiyun	=inputformat		Print supported input formats.
2869*4882a593Smuzhiyun	=outputformat		Print supported output formats.
2870*4882a593Smuzhiyun	=expected			  Print expected performance.
2871*4882a593Smuzhiyun	=all				    Print all information.
2872*4882a593Smuzhiyun```
2873*4882a593Smuzhiyun
2874*4882a593Smuzhiyun##### Code Parsing
2875*4882a593Smuzhiyun
2876*4882a593Smuzhiyun> According to parameters of main() to print different information.
2877*4882a593Smuzhiyun
2878*4882a593Smuzhiyun```c++
2879*4882a593Smuzhiyun	/*Convert the parameters of main() into QUERYSTRING_INFO enumeration values*/
2880*4882a593Smuzhiyun	IM_INFO = (QUERYSTRING_INFO)parm_data[MODE_QUERYSTRING];
2881*4882a593Smuzhiyun	/*Print the string returned by querystring(), which is the required information*/
2882*4882a593Smuzhiyun	printf("\n%s\n", querystring(IM_INFO));
2883*4882a593Smuzhiyun```
2884*4882a593Smuzhiyun
2885*4882a593Smuzhiyun
2886*4882a593Smuzhiyun
2887*4882a593Smuzhiyun#### Image Resizing
2888*4882a593Smuzhiyun
2889*4882a593Smuzhiyun> Use the following command to test image resizing.
2890*4882a593Smuzhiyun
2891*4882a593Smuzhiyun```
2892*4882a593SmuzhiyunrgaImDemo --resize=up
2893*4882a593SmuzhiyunrgaImDemo --resize=down
2894*4882a593Smuzhiyun```
2895*4882a593Smuzhiyun
2896*4882a593Smuzhiyun> This function must be filled withoptions as follows:
2897*4882a593Smuzhiyun
2898*4882a593Smuzhiyun```
2899*4882a593Smuzhiyunoptions:
2900*4882a593Smuzhiyun	=up					image resolution scale up to 1920x1080
2901*4882a593Smuzhiyun	=down 			image resolution scale down to 720x480
2902*4882a593Smuzhiyun```
2903*4882a593Smuzhiyun
2904*4882a593Smuzhiyun##### Code Parsing
2905*4882a593Smuzhiyun
2906*4882a593Smuzhiyun> According to the parameters (up/down) of main() to choose to up(720p->1080p) or down(720p->480p), that is, for different scenarios, the buffer is re-initialized, emptied, or fills rga_buffer_t structure, and the rga_buffer_t structure that stores src and dst image data is passed to imresize().
2907*4882a593Smuzhiyun
2908*4882a593Smuzhiyun```c++
2909*4882a593Smuzhiyun	switch(parm_data[MODE_RESIZE])
2910*4882a593Smuzhiyun	{
2911*4882a593Smuzhiyun        /*scale up the image*/
2912*4882a593Smuzhiyun		case IM_UP_SCALE :
2913*4882a593Smuzhiyun            /*re-initialize Graphicbuffer to corresponding resolution 1920x1080*/
2914*4882a593Smuzhiyun			dst_buf = GraphicBuffer_Init(1920, 1080, DST_FORMAT);
2915*4882a593Smuzhiyun            /*empty the buffer*/
2916*4882a593Smuzhiyun			GraphicBuffer_Fill(dst_buf, EMPTY_BUFF, 1);
2917*4882a593Smuzhiyun            /*refill rga_buffer_t structure that stores dst data*/
2918*4882a593Smuzhiyun			dst = wrapbuffer_GraphicBuffer(dst_buf);
2919*4882a593Smuzhiyun			break;
2920*4882a593Smuzhiyun
2921*4882a593Smuzhiyun		case IM_DOWN_SCALE :
2922*4882a593Smuzhiyun            /*re-initialize Graphicbuffer to corresponding resolution 720x480**/
2923*4882a593Smuzhiyun			dst_buf = GraphicBuffer_Init(720, 480, DST_FORMAT);
2924*4882a593Smuzhiyun            /*empty the buffer*/
2925*4882a593Smuzhiyun			GraphicBuffer_Fill(dst_buf, EMPTY_BUFF, 1);
2926*4882a593Smuzhiyun            /*refill rga_buffer_t structure that stores dst data*/
2927*4882a593Smuzhiyun			dst = wrapbuffer_GraphicBuffer(dst_buf);
2928*4882a593Smuzhiyun			break;
2929*4882a593Smuzhiyun	}
2930*4882a593Smuzhiyun	/*pass src and dst of rga_buffer_t structure to imresize()*/
2931*4882a593Smuzhiyun	STATUS = imresize(src, dst);
2932*4882a593Smuzhiyun	/*print running status according to IM_STATUS enumeration values*/
2933*4882a593Smuzhiyun	printf("resizing .... %s\n", imStrError(STATUS));
2934*4882a593Smuzhiyun```
2935*4882a593Smuzhiyun
2936*4882a593Smuzhiyun
2937*4882a593Smuzhiyun
2938*4882a593Smuzhiyun#### Image Cropping
2939*4882a593Smuzhiyun
2940*4882a593Smuzhiyun> Test image cropping using the following command.
2941*4882a593Smuzhiyun
2942*4882a593Smuzhiyun```
2943*4882a593SmuzhiyunrgaImDemo --crop
2944*4882a593Smuzhiyun```
2945*4882a593Smuzhiyun
2946*4882a593Smuzhiyun> Options are not available for this feature. By default, crop the image within the coordinate LT(100,100),RT(400,100),LB(100,400),RB(400,400).
2947*4882a593Smuzhiyun
2948*4882a593Smuzhiyun##### Code Parsing
2949*4882a593Smuzhiyun
2950*4882a593Smuzhiyun> Assign the size of clipped area in the im_rect structure that stores the src rectangle data, and pass the rga_buffer_t structure that stores the src and dst image data to imcrop().
2951*4882a593Smuzhiyun
2952*4882a593Smuzhiyun```c++
2953*4882a593Smuzhiyun	/*The coordinates of the clipped vertex are determined by x and y,the size of the clipped area is determined by width and height*/
2954*4882a593Smuzhiyun	src_rect.x      = 100;
2955*4882a593Smuzhiyun	src_rect.y      = 100;
2956*4882a593Smuzhiyun	src_rect.width  = 300;
2957*4882a593Smuzhiyun	src_rect.height = 300;
2958*4882a593Smuzhiyun
2959*4882a593Smuzhiyun	/*pass src and dst of src_rect structure and rga_buffer_t structure format to imcrop()*/
2960*4882a593Smuzhiyun	STATUS = imcrop(src, dst, src_rect);
2961*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration values*/
2962*4882a593Smuzhiyun	printf("cropping .... %s\n", imStrError(STATUS));
2963*4882a593Smuzhiyun```
2964*4882a593Smuzhiyun
2965*4882a593Smuzhiyun
2966*4882a593Smuzhiyun
2967*4882a593Smuzhiyun#### Image Rotation
2968*4882a593Smuzhiyun
2969*4882a593Smuzhiyun> Test image rotation using the following command.
2970*4882a593Smuzhiyun
2971*4882a593Smuzhiyun```
2972*4882a593SmuzhiyunrgaImDemo --rotate=90
2973*4882a593SmuzhiyunrgaImDemo --rotate=180
2974*4882a593SmuzhiyunrgaImDemo --rotate=270
2975*4882a593Smuzhiyun```
2976*4882a593Smuzhiyun
2977*4882a593Smuzhiyun> This function must be filled with options, which are as follows:
2978*4882a593Smuzhiyun
2979*4882a593Smuzhiyun```
2980*4882a593Smuzhiyunoptions:
2981*4882a593Smuzhiyun	=90					Image rotation by 90°, exchange the width and height of output image resolution.
2982*4882a593Smuzhiyun	=180 				Image rotation by 180°, output image resolution unchanged.
2983*4882a593Smuzhiyun	=270 				Image rotation by 270°, exchange the width and height of output image resolution.
2984*4882a593Smuzhiyun```
2985*4882a593Smuzhiyun
2986*4882a593Smuzhiyun##### Code Parsing
2987*4882a593Smuzhiyun
2988*4882a593Smuzhiyun> According to the arguments (up/down) of main() to choose the rotation degrees(90/180/270). IM_USAGE enumeration transformed from arguments values, together with  the rga_buffer_t structure that stores src and dst image data is passed to imrotate().
2989*4882a593Smuzhiyun
2990*4882a593Smuzhiyun```c++
2991*4882a593Smuzhiyun	/*convert the parameters of main() into IM_USAGE enumeration values*/
2992*4882a593Smuzhiyun	ROTATE = (IM_USAGE)parm_data[MODE_ROTATE];
2993*4882a593Smuzhiyun
2994*4882a593Smuzhiyun	/*pass both IM_USAGE enumeration value that identifies the rotation degrees and src and dst of rga_buffer_t structure format to imrotate()*/
2995*4882a593Smuzhiyun	STATUS = imrotate(src, dst, ROTATE);
2996*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration values*/
2997*4882a593Smuzhiyun	printf("rotating .... %s\n", imStrError(STATUS));
2998*4882a593Smuzhiyun```
2999*4882a593Smuzhiyun
3000*4882a593Smuzhiyun
3001*4882a593Smuzhiyun
3002*4882a593Smuzhiyun#### Image Mirror Flip
3003*4882a593Smuzhiyun
3004*4882a593Smuzhiyun> Use the following command to test mirror flipping
3005*4882a593Smuzhiyun
3006*4882a593Smuzhiyun```
3007*4882a593SmuzhiyunrgaImDemo --flip=H
3008*4882a593SmuzhiyunrgaImDemo --flip=V
3009*4882a593Smuzhiyun```
3010*4882a593Smuzhiyun
3011*4882a593Smuzhiyun> This function must be filled with options, which are as follows:
3012*4882a593Smuzhiyun
3013*4882a593Smuzhiyun```
3014*4882a593Smuzhiyunoptions:
3015*4882a593Smuzhiyun	=H					Image horizontal mirror flip.
3016*4882a593Smuzhiyun	=V 					Image vertical mirror flip.
3017*4882a593Smuzhiyun```
3018*4882a593Smuzhiyun
3019*4882a593Smuzhiyun##### Code Parsing
3020*4882a593Smuzhiyun
3021*4882a593Smuzhiyun> According to the arguments (H/V) of main() to choose the flipped direction, transform the arguments to IM_USAGE enumeration values, and the rga_buffer_t structure that stores src and dst image data is passed to imflip().
3022*4882a593Smuzhiyun
3023*4882a593Smuzhiyun```c++
3024*4882a593Smuzhiyun	/*convert the parameters of main() into IM_USAGE enumeration values*/
3025*4882a593Smuzhiyun	FLIP = (IM_USAGE)parm_data[MODE_FLIP];
3026*4882a593Smuzhiyun
3027*4882a593Smuzhiyun	/*pass both IM_USAGE enumeration value that identifies the flipped direction and src and dst of rga_buffer_t structure format to imflip()*/
3028*4882a593Smuzhiyun	STATUS = imflip(src, dst, FLIP);
3029*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3030*4882a593Smuzhiyun	printf("flipping .... %s\n", imStrError(STATUS));
3031*4882a593Smuzhiyun```
3032*4882a593Smuzhiyun
3033*4882a593Smuzhiyun
3034*4882a593Smuzhiyun
3035*4882a593Smuzhiyun#### Image Color Fill
3036*4882a593Smuzhiyun
3037*4882a593Smuzhiyun> Use the following command to test the color fill.
3038*4882a593Smuzhiyun
3039*4882a593Smuzhiyun```
3040*4882a593SmuzhiyunrgaImDemo --fill=blue
3041*4882a593SmuzhiyunrgaImDemo --fill=green
3042*4882a593SmuzhiyunrgaImDemo --fill=red
3043*4882a593Smuzhiyun```
3044*4882a593Smuzhiyun
3045*4882a593SmuzhiyunThis function must be filled with options. By default, fill the color of image within the coordinate LT(100,100),RT(400,100),LB(100,400),RB(400,400), options are as follows:
3046*4882a593Smuzhiyun
3047*4882a593Smuzhiyun```
3048*4882a593Smuzhiyunoptions:
3049*4882a593Smuzhiyun	=blue				Fill the image color as blue.
3050*4882a593Smuzhiyun	=green			Fill the image color as green.
3051*4882a593Smuzhiyun	=red				Fill the image color as red.
3052*4882a593Smuzhiyun```
3053*4882a593Smuzhiyun
3054*4882a593Smuzhiyun##### Code Parsing
3055*4882a593Smuzhiyun
3056*4882a593Smuzhiyun> The filled color is determined according to the (blue/green/red) parameters of main(), and the size to be filled is assigned to the im_rect structure that stores the dst rectangle data, and the passed parameter is converted to the hexadecimal number of the corresponding color, which is passed to imfill() along with  rga_buffer_t that stores the dst image data.
3057*4882a593Smuzhiyun
3058*4882a593Smuzhiyun```c++
3059*4882a593Smuzhiyun	/*Convert parameter of main() to hexadecimal number of the corresponding color*/
3060*4882a593Smuzhiyun	COLOR = parm_data[MODE_FILL];
3061*4882a593Smuzhiyun
3062*4882a593Smuzhiyun	/*The coordinates of clipping vertex are determined by x and y, and size of color-filled area is determined by width and height*/
3063*4882a593Smuzhiyun	dst_rect.x      = 100;
3064*4882a593Smuzhiyun	dst_rect.y      = 100;
3065*4882a593Smuzhiyun	dst_rect.width  = 300;
3066*4882a593Smuzhiyun	dst_rect.height = 300;
3067*4882a593Smuzhiyun
3068*4882a593Smuzhiyun	/*Pass dst_rect of im_rect format and hexadecimal number of the corresponding color together with src and dst of rga_buffer_t format to imfill().*/
3069*4882a593Smuzhiyun	STATUS = imfill(dst, dst_rect, COLOR);
3070*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3071*4882a593Smuzhiyun	printf("filling .... %s\n", imStrError(STATUS));
3072*4882a593Smuzhiyun```
3073*4882a593Smuzhiyun
3074*4882a593Smuzhiyun
3075*4882a593Smuzhiyun
3076*4882a593Smuzhiyun#### Image Translation
3077*4882a593Smuzhiyun
3078*4882a593Smuzhiyun> Use the following command to test image translation.
3079*4882a593Smuzhiyun
3080*4882a593Smuzhiyun```
3081*4882a593SmuzhiyunrgaImDemo --translate
3082*4882a593Smuzhiyun```
3083*4882a593Smuzhiyun
3084*4882a593Smuzhiyun> This feature has no options. By default, the vertex (upper-left coordinate) is shifted to (300,300), that is,  shifted 300 pixels to the right and 300 pixels down.
3085*4882a593Smuzhiyun
3086*4882a593Smuzhiyun##### Code Parsing
3087*4882a593Smuzhiyun
3088*4882a593Smuzhiyun> Assign the offset of translation to the im_rect that stores the src rectangle data, and pass the rga_buffer_t structure that stores the src and dst image data to imtranslate().
3089*4882a593Smuzhiyun
3090*4882a593Smuzhiyun```c++
3091*4882a593Smuzhiyun	/*The coordinates of vertices of translated image are determined by x and y*/
3092*4882a593Smuzhiyun	src_rect.x = 300;
3093*4882a593Smuzhiyun	src_rect.y = 300;
3094*4882a593Smuzhiyun
3095*4882a593Smuzhiyun	/*pass the src_rect of im_rect format along with src and dst of rga_buffer_t format into imtranslate()*/
3096*4882a593Smuzhiyun	STATUS = imtranslate(src, dst, src_rect.x, src_rect.y);
3097*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3098*4882a593Smuzhiyun	printf("translating .... %s\n", imStrError(STATUS));
3099*4882a593Smuzhiyun```
3100*4882a593Smuzhiyun
3101*4882a593Smuzhiyun
3102*4882a593Smuzhiyun
3103*4882a593Smuzhiyun#### Image Copying
3104*4882a593Smuzhiyun
3105*4882a593Smuzhiyun> Use the following command to test image copying.
3106*4882a593Smuzhiyun
3107*4882a593Smuzhiyun```
3108*4882a593SmuzhiyunrgaImDemo --copy
3109*4882a593Smuzhiyun```
3110*4882a593Smuzhiyun
3111*4882a593Smuzhiyun> This feature has no options. The default copy resolution is 1280x720 and the format is RGBA8888.
3112*4882a593Smuzhiyun
3113*4882a593Smuzhiyun##### Code Parsing
3114*4882a593Smuzhiyun
3115*4882a593Smuzhiyun> Passing rga_buffer_t that stores src and dst image data to imcopy().
3116*4882a593Smuzhiyun
3117*4882a593Smuzhiyun```c++
3118*4882a593Smuzhiyun	/*passing src and dst of rga_buffer_t format to imcopy()*/
3119*4882a593Smuzhiyun	STATUS = imcopy(src, dst);
3120*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3121*4882a593Smuzhiyun	printf("copying .... %s\n", imStrError(STATUS));
3122*4882a593Smuzhiyun```
3123*4882a593Smuzhiyun
3124*4882a593Smuzhiyun
3125*4882a593Smuzhiyun
3126*4882a593Smuzhiyun#### Image Blending
3127*4882a593Smuzhiyun
3128*4882a593Smuzhiyun> Use the following command to test image blending.
3129*4882a593Smuzhiyun
3130*4882a593Smuzhiyun```
3131*4882a593SmuzhiyunrgaImDemo --blend
3132*4882a593Smuzhiyun```
3133*4882a593Smuzhiyun
3134*4882a593Smuzhiyun> This feature has no options. By default, the blending mode is IM_ALPHA_BLEND_DST.
3135*4882a593Smuzhiyun
3136*4882a593Smuzhiyun##### Code Parsing
3137*4882a593Smuzhiyun
3138*4882a593Smuzhiyun> Passing rga_buffer_t that stores src and dst image data to imblend().
3139*4882a593Smuzhiyun
3140*4882a593Smuzhiyun```c++
3141*4882a593Smuzhiyun	/*passing src and dst of rga_buffer_t format to imblend()*/
3142*4882a593Smuzhiyun	STATUS = imblend(src, dst);
3143*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3144*4882a593Smuzhiyun	printf("blending .... %s\n", imStrError(STATUS));
3145*4882a593Smuzhiyun```
3146*4882a593Smuzhiyun
3147*4882a593Smuzhiyun
3148*4882a593Smuzhiyun
3149*4882a593Smuzhiyun#### Image Format Conversion
3150*4882a593Smuzhiyun
3151*4882a593Smuzhiyun> Use the following command to test image format conversion.
3152*4882a593Smuzhiyun
3153*4882a593Smuzhiyun```
3154*4882a593SmuzhiyunrgaImDemo --cvtcolor
3155*4882a593Smuzhiyun```
3156*4882a593Smuzhiyun
3157*4882a593Smuzhiyun> This feature has no options. By default, images with resolution of 1280x720 will be converted from RGBA8888 to NV12.
3158*4882a593Smuzhiyun
3159*4882a593Smuzhiyun##### Code Parsing
3160*4882a593Smuzhiyun
3161*4882a593SmuzhiyunAssign the format to be converted in the format variable member of rga_buffer_t, and pass the rga_buffer_t structure that stores src and dst image data to imcvtcolor().
3162*4882a593Smuzhiyun
3163*4882a593Smuzhiyun```c++
3164*4882a593Smuzhiyun	/*Assign the format in the format variable member*/
3165*4882a593Smuzhiyun	src.format = HAL_PIXEL_FORMAT_RGBA_8888;
3166*4882a593Smuzhiyun	dst.format = HAL_PIXEL_FORMAT_YCrCb_NV12;
3167*4882a593Smuzhiyun
3168*4882a593Smuzhiyun	/*passing the format to be converted and src and dst of rga_buffer_t format to  imcvtcolor()*/
3169*4882a593Smuzhiyun	STATUS = imcvtcolor(src, dst, src.format, dst.format);
3170*4882a593Smuzhiyun	/*print the running status according to the returned IM_STATUS enumeration value*/
3171*4882a593Smuzhiyun	printf("cvtcolor .... %s\n", imStrError(STATUS));
3172*4882a593Smuzhiyun```
3173