hardware/intel/libva
修订版 | 48f89886953f1e311f2dc2a8ca45092f8eb7d2b8 (tree) |
---|---|
时间 | 2016-05-09 17:48:52 |
作者 | pylee <penne.y.lee@inte...> |
Commiter | Xiang, Haihao |
Merge ROI patches from staging branch
Cherry-pick'ed from:
26cc3b0: Add Region-of-Interest (ROI) support for encoder based on user provided ROI rectangles.
84b90a3: ROI updates for encoder.
Signed-off-by: pylee <penne.y.lee@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-By: Sean V Kelley <sean.v.kelley@intel.com>
@@ -222,6 +222,14 @@ typedef int VAStatus; /** Return status type from functions */ | ||
222 | 222 | */ |
223 | 223 | const char *vaErrorStr(VAStatus error_status); |
224 | 224 | |
225 | +typedef struct _VARectangle | |
226 | +{ | |
227 | + short x; | |
228 | + short y; | |
229 | + unsigned short width; | |
230 | + unsigned short height; | |
231 | +} VARectangle; | |
232 | + | |
225 | 233 | /** |
226 | 234 | * Initialization: |
227 | 235 | * A display must be obtained by calling vaGetDisplay() before calling |
@@ -452,6 +460,17 @@ typedef enum | ||
452 | 460 | * externally skipped frames. |
453 | 461 | */ |
454 | 462 | VAConfigAttribEncSkipFrame = 24, |
463 | + /** | |
464 | + * \brief Encoding region-of-interest (ROI) attribute. Read-only. | |
465 | + * | |
466 | + * This attribute conveys whether the driver supports region-of-interest (ROI) encoding, | |
467 | + * based on user provided ROI rectangles. The attribute value is partitioned into fields | |
468 | + * as defined in the VAConfigAttribValEncROI union. | |
469 | + * | |
470 | + * If ROI encoding is supported, the ROI information is passed to the driver using | |
471 | + * VAEncMiscParameterTypeROI. | |
472 | + */ | |
473 | + VAConfigAttribEncROI = 25, | |
455 | 474 | /**@}*/ |
456 | 475 | VAConfigAttribTypeMax |
457 | 476 | } VAConfigAttribType; |
@@ -565,6 +584,21 @@ typedef union _VAConfigAttribValEncJPEG { | ||
565 | 584 | unsigned int value; |
566 | 585 | } VAConfigAttribValEncJPEG; |
567 | 586 | |
587 | +/** \brief Attribute value for VAConfigAttribEncROI */ | |
588 | +typedef union _VAConfigAttribValEncROI { | |
589 | + struct { | |
590 | + /** \brief The number of ROI regions supported, 0 if ROI is not supported. */ | |
591 | + unsigned int num_roi_regions : 8; | |
592 | + /** \brief Indicates if ROI priority indication is supported when | |
593 | + * VAConfigAttribRateControl != VA_RC_CQP, else only ROI delta QP added on top of | |
594 | + * the frame level QP is supported when VAConfigAttribRateControl == VA_RC_CQP. | |
595 | + */ | |
596 | + unsigned int roi_rc_priority_support : 1; | |
597 | + unsigned int reserved : 23; | |
598 | + } bits; | |
599 | + unsigned int value; | |
600 | +} VAConfigAttribValEncROI; | |
601 | + | |
568 | 602 | /** |
569 | 603 | * if an attribute is not applicable for a given |
570 | 604 | * profile/entrypoint pair, then set the value to the following |
@@ -1038,7 +1072,9 @@ typedef enum | ||
1038 | 1072 | VAEncMiscParameterTypeQualityLevel = 6, |
1039 | 1073 | /** \brief Buffer type used for sending skip frame parameters to the encoder's |
1040 | 1074 | * rate control, when the user has externally skipped frames. */ |
1041 | - VAEncMiscParameterTypeSkipFrame = 9 | |
1075 | + VAEncMiscParameterTypeSkipFrame = 9, | |
1076 | + /** \brief Buffer type used for region-of-interest (ROI) parameters. */ | |
1077 | + VAEncMiscParameterTypeROI = 10 | |
1042 | 1078 | } VAEncMiscParameterType; |
1043 | 1079 | |
1044 | 1080 | /** \brief Packed header type. */ |
@@ -1212,7 +1248,49 @@ typedef struct _VAEncMiscParameterSkipFrame { | ||
1212 | 1248 | unsigned int size_skip_frames; |
1213 | 1249 | } VAEncMiscParameterSkipFrame; |
1214 | 1250 | |
1215 | -/* | |
1251 | +/** | |
1252 | + * \brief Encoding region-of-interest (ROI). | |
1253 | + * | |
1254 | + * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation | |
1255 | + * supports ROI input. The ROI set through this structure is applicable only to the | |
1256 | + * current frame or field, so must be sent every frame or field to be applied. The number of | |
1257 | + * supported ROIs can be queried through the VAConfigAttribEncROI. The encoder will use the | |
1258 | + * ROI information to adjust the QP values of the MB's that fall within the ROIs. | |
1259 | + */ | |
1260 | +typedef struct _VAEncROI | |
1261 | +{ | |
1262 | + /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate | |
1263 | + * codec coding units. It is relative to frame coordinates for the frame case and | |
1264 | + * to field coordinates for the field case. */ | |
1265 | + VARectangle roi_rectangle; | |
1266 | + /** \brief When VAConfigAttribRateControl == VA_RC_CQP then roi_value specifes the | |
1267 | + * delta QP that will be added on top of the frame level QP. For other rate control | |
1268 | + * modes, roi_value specifies the priority of the ROI region relative to the non-ROI | |
1269 | + * region. It can be positive (more important) or negative (less important) values | |
1270 | + * and is compared with non-ROI region (taken as value 0). | |
1271 | + * E.g. ROI region with roi_value -3 is less important than the non-ROI region | |
1272 | + * (roi_value implied to be 0) which is less important than ROI region with | |
1273 | + * roi_value +2. For overlapping regions, the roi_value that is first in the ROI | |
1274 | + * array will have priority. */ | |
1275 | + char roi_value; | |
1276 | +} VAEncROI; | |
1277 | + | |
1278 | +typedef struct _VAEncMiscParameterBufferROI { | |
1279 | + /** \brief Number of ROIs being sent.*/ | |
1280 | + unsigned int num_roi; | |
1281 | + | |
1282 | + /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's | |
1283 | + * rate control will determine actual delta QPs. Specifies the max/min allowed delta | |
1284 | + * QPs. */ | |
1285 | + char max_delta_qp; | |
1286 | + char min_delta_qp; | |
1287 | + | |
1288 | + /** \brief Pointer to a VAEncROI array with num_roi elements. It is relative to frame | |
1289 | + * coordinates for the frame case and to field coordinates for the field case.*/ | |
1290 | + VAEncROI *roi; | |
1291 | +} VAEncMiscParameterBufferROI; | |
1292 | + | |
1293 | +/** | |
1216 | 1294 | * There will be cases where the bitstream buffer will not have enough room to hold |
1217 | 1295 | * the data for the entire slice, and the following flags will be used in the slice |
1218 | 1296 | * parameter to signal to the server for the possible cases. |
@@ -2618,14 +2696,6 @@ VAStatus vaDeassociateSubpicture ( | ||
2618 | 2696 | int num_surfaces |
2619 | 2697 | ); |
2620 | 2698 | |
2621 | -typedef struct _VARectangle | |
2622 | -{ | |
2623 | - short x; | |
2624 | - short y; | |
2625 | - unsigned short width; | |
2626 | - unsigned short height; | |
2627 | -} VARectangle; | |
2628 | - | |
2629 | 2699 | /** |
2630 | 2700 | * Display attributes |
2631 | 2701 | * Display attributes are used to control things such as contrast, hue, saturation, |