History

vaapi_encode: Use gop_size consistently in RC parameters

The non-H.26[45] codecs already use this form. Since we don't currently generate I frames for codecs which support them separately to IDR, the p_per_i variable is set to infinity by default so that it doesn't interfere with any other calculation. (All the code for I frames still exists, and it works for H.264 if set manually.) (cherry picked from commit 6af014f4028238b4c50f1731b3369a41d65fa9c4)

Mark Thompson committed 9 years ago

Commit b658b531 parent 28aedee3 files · +5 −6Browse files

Unified · Split

3 files
  1. libavcodec/vaapi_encode.c +1 −2
  2. libavcodec/vaapi_encode_h264.c +2 −2
  3. libavcodec/vaapi_encode_h265.c +2 −2
libavcodec/vaapi_encode.c+1−2
@@ -1435,8 +1435,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) · 1434 unmodified lines
1435 ctx->output_order = - ctx->output_delay - 1;1435 ctx->output_order = - ctx->output_delay - 1;
1436 1436
1437 // Currently we never generate I frames, only IDR.1437 // Currently we never generate I frames, only IDR.
1438 ctx->p_per_i = ((avctx->gop_size - 1 + avctx->max_b_frames) /1438 ctx->p_per_i = INT_MAX;
1439 (avctx->max_b_frames + 1));
1440 ctx->b_per_p = avctx->max_b_frames;1439 ctx->b_per_p = avctx->max_b_frames;
1441 1440
1442 if (ctx->codec->sequence_params_size > 0) {1441 if (ctx->codec->sequence_params_size > 0) {
libavcodec/vaapi_encode_h264.c+2−2
@@ -905,8 +905,8 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) · 904 unmodified lines
905 mseq->nal_hrd_parameters_present_flag = 0;905 mseq->nal_hrd_parameters_present_flag = 0;
906 }906 }
907 907
908 vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1);908 vseq->intra_period = avctx->gop_size;
909 vseq->intra_idr_period = vseq->intra_period;909 vseq->intra_idr_period = avctx->gop_size;
910 vseq->ip_period = ctx->b_per_p + 1;910 vseq->ip_period = ctx->b_per_p + 1;
911 }911 }
912 912
libavcodec/vaapi_encode_h265.c+2−2
@@ -832,8 +832,8 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) · 831 unmodified lines
832 vseq->vui_time_scale = avctx->time_base.den;832 vseq->vui_time_scale = avctx->time_base.den;
833 }833 }
834 834
835 vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1);835 vseq->intra_period = avctx->gop_size;
836 vseq->intra_idr_period = vseq->intra_period;836 vseq->intra_idr_period = avctx->gop_size;
837 vseq->ip_period = ctx->b_per_p + 1;837 vseq->ip_period = ctx->b_per_p + 1;
838 }838 }
839 839

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