diff mbox

[FFmpeg-devel,v3,2/2] libavcodec/hevcdec: implement skip_frame

Message ID DB3PR0202MB3452E29DAA5D5C346AAA5714EC330@DB3PR0202MB3452.eurprd02.prod.outlook.com
State New
Headers show

Commit Message

Stefan _ Dec. 7, 2017, 7:56 p.m. UTC
On 07.12.2017 at 17:41 Michael Niedermayer wrote:
> The move and the functional change should be in seperate patches

> that keeps changes easy to read and understand

>

> [...]

Comments

Stefan _ Dec. 19, 2017, 5:53 p.m. UTC | #1
On 07.12.2017 at 20:56 Stefan _ wrote:
> On 07.12.2017 at 17:41 Michael Niedermayer wrote:

>> The move and the functional change should be in seperate patches

>> that keeps changes easy to read and understand

>>

>> [...]


bump

(Previous patch in same series was merged. This one wasn't and hasn't 
received any comments either.)
Michael Niedermayer Dec. 20, 2017, 9:07 p.m. UTC | #2
On Thu, Dec 07, 2017 at 07:56:13PM +0000, Stefan _ wrote:
> On 07.12.2017 at 17:41 Michael Niedermayer wrote:
> > The move and the functional change should be in seperate patches
> > that keeps changes easy to read and understand
> >
> > [...]
> 
> 

>  hevcdec.c |   16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 4f6058191b1d861a1333e6391881388e81c7dd4e  0002-libavcodec-hevcdec-implement-skip_frame.patch
> >From abeb2b106a64d96b216912d4272a734b123b62e2 Mon Sep 17 00:00:00 2001
> From: sfan5 <sfan5@live.de>
> Date: Thu, 7 Dec 2017 20:40:35 +0100
> Subject: [PATCH 2/2] libavcodec/hevcdec: implement skip_frame

will apply

thanks

[...]
diff mbox

Patch

>From abeb2b106a64d96b216912d4272a734b123b62e2 Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Thu, 7 Dec 2017 20:40:35 +0100
Subject: [PATCH 2/2] libavcodec/hevcdec: implement skip_frame

---
 libavcodec/hevcdec.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

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);
-- 
2.15.0