History

vaapi_encode: Maintain a pool of bitstream output buffers

Previously we would allocate a new one for every frame. This instead maintains an AVBufferPool of them to use as-needed. Also makes the maximum size of an output buffer adapt to the frame size - the fixed upper bound was a bit too easy to hit when encoding large pictures at high quality.

Mark Thompson committed 10 years ago

Commit 8a62d2c1 parent bd31c612 files · +75 −19Browse files

Showing the changes to libavcodec/vaapi_encode.h (1 of 2 files). Show all

Unified · Split

libavcodec/vaapi_encode.h+3−1
@@ -39,7 +39,6 @@ enum { · 38 unmodified lines
3939 MAX_PARAM_BUFFERS = 16,
4040 MAX_REORDER_DELAY = 16,
4141 MAX_PARAM_BUFFER_SIZE = 1024,
42− MAX_OUTPUT_BUFFER_SIZE = 1024 * 1024,
4342 };
4443
4544 enum {
@@ -84,6 +83,7 @@ typedef struct VAAPIEncodePicture { · 38 unmodified lines
8483 int nb_param_buffers;
8584 VABufferID param_buffers[MAX_PARAM_BUFFERS];
8685
86+ AVBufferRef *output_buffer_ref;
8787 VABufferID output_buffer;
8888
8989 void *priv_data;
@@ -130,6 +130,8 @@ typedef struct VAAPIEncodeContext { · 40 unmodified lines
130130 AVBufferRef *recon_frames_ref;
131131 AVHWFramesContext *recon_frames;
132132
133+ AVBufferPool *output_buffer_pool;
134+
133135 VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES];
134136 int nb_config_attributes;
135137

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t