diff options
author | sfan5 <sfan5@live.de> | 2017-12-07 20:40:35 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-12-20 22:26:31 +0100 |
commit | 05c1c79d3779ae53c50007c4812ec5195dc2c264 (patch) | |
tree | d0399bc1c786d271c408e0b0d35b03fb1fc76108 /libavcodec | |
parent | cfd52094c027a3e31ee6ea9aafeb4a2e3c152ec1 (diff) | |
download | ffmpeg-05c1c79d3779ae53c50007c4812ec5195dc2c264.tar.gz |
libavcodec/hevcdec: implement skip_frame
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hevcdec.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 433a7056ea..4bfae8c12b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2905,6 +2905,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) return ret; + if ( + (s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || + (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || + (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) { + break; + } + if (s->sh.first_slice_in_pic_flag) { if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { @@ -3028,7 +3035,14 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) /* decode the NAL units */ for (i = 0; i < s->pkt.nb_nals; i++) { - ret = decode_nal_unit(s, &s->pkt.nals[i]); + H2645NAL *nal = &s->pkt.nals[i]; + + if (s->avctx->skip_frame >= AVDISCARD_ALL || + (s->avctx->skip_frame >= AVDISCARD_NONREF + && ff_hevc_nal_is_nonref(nal->type))) + continue; + + ret = decode_nal_unit(s, nal); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error parsing NAL unit #%d.\n", i); |