Skip to content

Commit

Permalink
Add max frame size parameters for multiple pass case in legacy mode
Browse files Browse the repository at this point in the history
Add new data structure and parameter buffer type for max frame size parameters in multiple pass case.

Signed-off-by: Wang, Chengwei C <[email protected]>
  • Loading branch information
Wang, Chengwei C authored and XinfengZhang committed Sep 20, 2018
1 parent 9c51135 commit 250b3dc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
27 changes: 27 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,8 @@ typedef enum
VAEncMiscParameterTypeSkipFrame = 9,
/** \brief Buffer type used for region-of-interest (ROI) parameters. */
VAEncMiscParameterTypeROI = 10,
/** \brief Buffer type used to express a maximum frame size (in bytes) settings for multiple pass. */
VAEncMiscParameterTypeMultiPassFrameSize = 11,
/** \brief Buffer type used for temporal layer structure */
VAEncMiscParameterTypeTemporalLayerStructure = 12,
/** \brief Buffer type used for dirty region-of-interest (ROI) parameters. */
Expand Down Expand Up @@ -2115,6 +2117,31 @@ typedef struct _VAEncMiscParameterBufferMaxFrameSize {
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterBufferMaxFrameSize;

/**
* \brief Maximum frame size (in bytes) settings for multiple pass.
*
* This misc parameter buffer defines the maximum size of a frame (in
* bytes) settings for multiple pass. currently only AVC encoder can
* support this settings in multiple pass case. If the frame size exceeds
* this size, the encoder will do more pak passes to adjust the QP value
* to control the frame size.
*/
typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
/** \brief Type. Shall be set to #VAEncMiscParameterTypeMultiPassMaxFrameSize. */
VAEncMiscParameterType type;
/** \brief Maximum size of a frame (in byte) */
uint32_t max_frame_size;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved;
/** \brief number of passes, every pass has different QP, currently AVC encoder can support up to 4 passes */
uint8_t num_passes;
/** \brief delta QP list for every pass */
uint8_t *delta_qp;

/** \brief Reserved bytes for future use, must be zero */
unsigned long va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterBufferMultiPassFrameSize;

/**
* \brief Encoding quality level.
*
Expand Down
12 changes: 12 additions & 0 deletions va/va_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,18 @@ static void va_TraceVAEncMiscParameterBuffer(
va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
break;
}
case VAEncMiscParameterTypeMultiPassFrameSize:
{
int i;
VAEncMiscParameterBufferMultiPassFrameSize *p = (VAEncMiscParameterBufferMultiPassFrameSize *)tmp->data;

va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMultiPassFrameSize\n");
va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
va_TraceMsg(trace_ctx, "\tnum_passes = %d\n", p->num_passes);
for(i = 0; i<p->num_passes; ++i)
va_TraceMsg(trace_ctx, "\tdelta_qp[%d] = %d\n", i, p->delta_qp[i]);
break;
}
case VAEncMiscParameterTypeQualityLevel:
{
VAEncMiscParameterBufferQualityLevel *p = (VAEncMiscParameterBufferQualityLevel *)tmp->data;
Expand Down

0 comments on commit 250b3dc

Please sign in to comment.