Skip to content

Commit a82506b

Browse files
committed
va: Add encoding tuning mode
This provides a hint to driver about the requested encode tuning in addition to quality level number. It can be used by hardware encoders that supports low latency encoding as a special mode instead of setting the lowest quality level.
1 parent a438699 commit a82506b

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

va/va.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,15 @@ typedef enum {
10501050
* columns supported for encoding with tile support.
10511051
*/
10521052
VAConfigAttribEncMaxTileCols = 57,
1053+
/**
1054+
* \brief Encoding tuning mode attribute. Read-only.
1055+
*
1056+
* This attribute conveys whether the driver supports different tuning modes
1057+
* for encoding. The attribute value is any combination of VA_ENC_TUNING_MODE_XXX.
1058+
*
1059+
* The tuning mode is passed to the driver using VAEncMiscParameterBufferQualityLevel.
1060+
*/
1061+
VAConfigAttribEncTuningMode = 58,
10531062
/**@}*/
10541063
VAConfigAttribTypeMax
10551064
} VAConfigAttribType;
@@ -2707,6 +2716,13 @@ typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
27072716
unsigned long va_reserved[VA_PADDING_LOW];
27082717
} VAEncMiscParameterBufferMultiPassFrameSize;
27092718

2719+
/** \brief Default tuning mode */
2720+
#define VA_ENC_TUNING_MODE_DEFAULT 0x00000000
2721+
/** \brief Compromise quality to lower the latency of video encode operations */
2722+
#define VA_ENC_TUNING_MODE_LOW_LATENCY 0x00000001
2723+
/** \brief Compromise quality for lowest latency of video encode operations */
2724+
#define VA_ENC_TUNING_MODE_ULTRA_LOW_LATENCY 0x00000002
2725+
27102726
/**
27112727
* \brief Encoding quality level.
27122728
*
@@ -2717,15 +2733,20 @@ typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
27172733
* attribute. A lower value means higher quality, and a value of 1 represents the highest
27182734
* quality. The quality level setting is used as a trade-off between quality and speed/power
27192735
* consumption, with higher quality corresponds to lower speed and higher power consumption.
2736+
* The number of supported tuning modes can be queried through the VAConfigAttribEncTuningMode
2737+
* attribute.
27202738
*/
27212739
typedef struct _VAEncMiscParameterBufferQualityLevel {
27222740
/** \brief Encoding quality level setting. When set to 0, default quality
27232741
* level is used.
27242742
*/
27252743
uint32_t quality_level;
27262744

2745+
/** \brief Encoding tuning mode setting, see VA_ENC_TUNING_MODE_XXX */
2746+
uint32_t tuning_mode;
2747+
27272748
/** \brief Reserved bytes for future use, must be zero */
2728-
uint32_t va_reserved[VA_PADDING_LOW];
2749+
uint32_t va_reserved[VA_PADDING_LOW - 1];
27292750
} VAEncMiscParameterBufferQualityLevel;
27302751

27312752
/**

va/va_str.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
151151
TOSTR(VAConfigAttribEncPerBlockControl);
152152
TOSTR(VAConfigAttribEncMaxTileRows);
153153
TOSTR(VAConfigAttribEncMaxTileCols);
154+
TOSTR(VAConfigAttribEncTuningMode);
154155
case VAConfigAttribTypeMax:
155156
break;
156157
}

va/va_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,6 +3642,7 @@ static void va_TraceVAEncMiscParameterBuffer(
36423642

36433643
va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterBufferQualityLevel\n");
36443644
va_TraceMsg(trace_ctx, "\tquality_level = %d\n", p->quality_level);
3645+
va_TraceMsg(trace_ctx, "\ttuning_mode = %d\n", p->tuning_mode);
36453646
break;
36463647
}
36473648
case VAEncMiscParameterTypeROI: {

0 commit comments

Comments
 (0)