Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

va: Add encoding tuning mode #796

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,15 @@ typedef enum {
* columns supported for encoding with tile support.
*/
VAConfigAttribEncMaxTileCols = 57,
/**
* \brief Encoding tuning mode attribute. Read-only.
*
* This attribute conveys whether the driver supports different tuning modes
* for encoding. The attribute value is any combination of VA_ENC_TUNING_MODE_XXX.
*
* The tuning mode is passed to the driver using VAEncMiscParameterBufferQualityLevel.
*/
VAConfigAttribEncTuningMode = 58,
/**@}*/
VAConfigAttribTypeMax
} VAConfigAttribType;
Expand Down Expand Up @@ -2707,6 +2716,13 @@ typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
unsigned long va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterBufferMultiPassFrameSize;

/** \brief Default tuning mode */
#define VA_ENC_TUNING_MODE_DEFAULT 0x00000000
/** \brief Compromise quality to lower the latency of video encode operations */
#define VA_ENC_TUNING_MODE_LOW_LATENCY 0x00000001
/** \brief Compromise quality for lowest latency of video encode operations */
#define VA_ENC_TUNING_MODE_ULTRA_LOW_LATENCY 0x00000002

/**
* \brief Encoding quality level.
*
Expand All @@ -2717,15 +2733,20 @@ typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
* attribute. A lower value means higher quality, and a value of 1 represents the highest
* quality. The quality level setting is used as a trade-off between quality and speed/power
* consumption, with higher quality corresponds to lower speed and higher power consumption.
* The number of supported tuning modes can be queried through the VAConfigAttribEncTuningMode
* attribute.
*/
typedef struct _VAEncMiscParameterBufferQualityLevel {
/** \brief Encoding quality level setting. When set to 0, default quality
* level is used.
*/
uint32_t quality_level;

/** \brief Encoding tuning mode setting, see VA_ENC_TUNING_MODE_XXX */
uint32_t tuning_mode;

/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
uint32_t va_reserved[VA_PADDING_LOW - 1];
} VAEncMiscParameterBufferQualityLevel;

/**
Expand Down
1 change: 1 addition & 0 deletions va/va_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
TOSTR(VAConfigAttribEncPerBlockControl);
TOSTR(VAConfigAttribEncMaxTileRows);
TOSTR(VAConfigAttribEncMaxTileCols);
TOSTR(VAConfigAttribEncTuningMode);
case VAConfigAttribTypeMax:
break;
}
Expand Down
1 change: 1 addition & 0 deletions va/va_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3642,6 +3642,7 @@ static void va_TraceVAEncMiscParameterBuffer(

va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterBufferQualityLevel\n");
va_TraceMsg(trace_ctx, "\tquality_level = %d\n", p->quality_level);
va_TraceMsg(trace_ctx, "\ttuning_mode = %d\n", p->tuning_mode);
break;
}
case VAEncMiscParameterTypeROI: {
Expand Down