History

vaapi_encode: Add flag to mark encoders supporting only constant-quality

And set it for MJPEG.

Mark Thompson committed 8 years ago

Commit fef21621 parent a7eda763 files · +6 −1Browse files

Unified · Split

3 files
  1. libavcodec/vaapi_encode.c +2 −1
  2. libavcodec/vaapi_encode.h +2 −0
  3. libavcodec/vaapi_encode_mjpeg.c +2 −0
libavcodec/vaapi_encode.c+2−1
@@ -1277,7 +1277,8 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) · 1276 unmodified lines
12771277 ctx->va_rc_mode = VA_RC_CQP;
12781278 return 0;
12791279 }
1280− if (avctx->flags & AV_CODEC_FLAG_QSCALE ||
1280+ if (ctx->codec->flags & FLAG_CONSTANT_QUALITY_ONLY ||
1281+ avctx->flags & AV_CODEC_FLAG_QSCALE ||
12811282 avctx->bit_rate <= 0) {
12821283 if (rc_attr.value & VA_RC_CQP) {
12831284 av_log(avctx, AV_LOG_VERBOSE, "Using constant-quality mode.\n");
libavcodec/vaapi_encode.h+2−0
@@ -251,6 +251,8 @@ typedef struct VAAPIEncodeContext { · 250 unmodified lines
251251 enum {
252252 // Codec supports controlling the subdivision of pictures into slices.
253253 FLAG_SLICE_CONTROL = 1 << 0,
254+ // Codec only supports constant quality (no rate control).
255+ FLAG_CONSTANT_QUALITY_ONLY = 1 << 1,
254256 };
255257
256258 typedef struct VAAPIEncodeType {
libavcodec/vaapi_encode_mjpeg.c+2−0
@@ -476,6 +476,8 @@ static const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles[] = { · 475 unmodified lines
476476 static const VAAPIEncodeType vaapi_encode_type_mjpeg = {
477477 .profiles = vaapi_encode_mjpeg_profiles,
478478
479+ .flags = FLAG_CONSTANT_QUALITY_ONLY,
480+
479481 .configure = &vaapi_encode_mjpeg_configure,
480482
481483 .picture_params_size = sizeof(VAEncPictureParameterBufferJPEG),

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