diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2018-04-13 19:39:24 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2018-04-15 11:26:46 +0200 |
commit | 955fa237f495e3077996c1d282b4ace2a9ad6c15 (patch) | |
tree | 40a486bb4f0f31131b52542dd4ac4ae7c55de58a /libavcodec | |
parent | 8df8a9299364016027825a67534b93cd2b6af473 (diff) | |
download | ffmpeg-955fa237f495e3077996c1d282b4ace2a9ad6c15.tar.gz |
avcodec/nvdec: correctly set intra_pic_flag for h264/hevc
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/nvdec_h264.c | 8 | ||||
-rw-r--r-- | libavcodec/nvdec_hevc.c | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/nvdec_h264.c b/libavcodec/nvdec_h264.c index 35f54f2ed5..25b30329d0 100644 --- a/libavcodec/nvdec_h264.c +++ b/libavcodec/nvdec_h264.c @@ -74,7 +74,7 @@ static int nvdec_h264_start_frame(AVCodecContext *avctx, .bottom_field_flag = h->picture_structure == PICT_BOTTOM_FIELD, .second_field = FIELD_PICTURE(h) && !h->first_field, .ref_pic_flag = h->nal_ref_idc != 0, - .intra_pic_flag = 0, + .intra_pic_flag = 1, .CodecSpecific.h264 = { .log2_max_frame_num_minus4 = sps->log2_max_frame_num - 4, @@ -132,6 +132,9 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; + CUVIDPICPARAMS *pp = &ctx->pic_params; + const H264Context *h = avctx->priv_data; + const H264SliceContext *sl = &h->slice_ctx[0]; void *tmp; tmp = av_fast_realloc(ctx->bitstream, &ctx->bitstream_allocated, @@ -152,6 +155,9 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, ctx->bitstream_len += size + 3; ctx->nb_slices++; + if (sl->slice_type != AV_PICTURE_TYPE_I && sl->slice_type != AV_PICTURE_TYPE_SI) + pp->intra_pic_flag = 0; + return 0; } diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c index e89256d75a..008963130b 100644 --- a/libavcodec/nvdec_hevc.c +++ b/libavcodec/nvdec_hevc.c @@ -93,7 +93,7 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx, .FrameHeightInMbs = sps->height / 16, .CurrPicIdx = cf->idx, .ref_pic_flag = 1, - .intra_pic_flag = 0, + .intra_pic_flag = IS_IRAP(s), .CodecSpecific.hevc = { .pic_width_in_luma_samples = sps->width, |