Re: [FFmpeg-devel] [PATCH v3 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function

2017-12-08 Thread Michael Niedermayer
On Thu, Dec 07, 2017 at 07:56:11PM +, 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
> >
> > [...]
> 
> 

>  hevc_filter.c |   20 +++-
>  hevcdec.h |   20 
>  2 files changed, 23 insertions(+), 17 deletions(-)
> 04e3531811a72a5c76a832b9db910f249430c95e  
> 0001-libavcodec-hevc_filter-move-AVDISCARD_NONREF-switch-.patch
> >From b5d6c40c6516b90abeeffb7cf8ecd1ca1c3f7cb2 Mon Sep 17 00:00:00 2001
> From: sfan5 
> Date: Thu, 7 Dec 2017 20:37:48 +0100
> Subject: [PATCH 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case
>  into function

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function

2017-12-07 Thread Stefan _
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
>
> [...]


>From b5d6c40c6516b90abeeffb7cf8ecd1ca1c3f7cb2 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 7 Dec 2017 20:37:48 +0100
Subject: [PATCH 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case
 into function

In preparation for implementation of skip_frame.
---
 libavcodec/hevc_filter.c | 20 +++-
 libavcodec/hevcdec.h | 20 
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 94fb7cd3d1..6b9824088c 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,29 +842,15 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 {
 int x_end = x >= s->ps.sps->width  - ctb_size;
-int skip = 0, is_n = 0;
-switch (s->nal_unit_type) {
-case HEVC_NAL_TRAIL_N:
-case HEVC_NAL_TSA_N:
-case HEVC_NAL_STSA_N:
-case HEVC_NAL_RADL_N:
-case HEVC_NAL_RASL_N:
-case HEVC_NAL_VCL_N10:
-case HEVC_NAL_VCL_N12:
-case HEVC_NAL_VCL_N14:
-case HEVC_NAL_BLA_N_LP:
-case HEVC_NAL_IDR_N_LP:
-is_n = 1;
-break;
-default: break;
-}
+int skip = 0;
 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
  s->sh.slice_type != HEVC_SLICE_I) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
  s->sh.slice_type == HEVC_SLICE_B) ||
-(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n))
+(s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
+ff_hevc_nal_is_nonref(s->nal_unit_type)))
 skip = 1;
 
 if (!skip)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index ef918f4fb2..b311edc8ae 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -548,6 +548,26 @@ int ff_hevc_frame_nb_refs(HEVCContext *s);
 
 int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
 
+static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
+{
+switch (type) {
+case HEVC_NAL_TRAIL_N:
+case HEVC_NAL_TSA_N:
+case HEVC_NAL_STSA_N:
+case HEVC_NAL_RADL_N:
+case HEVC_NAL_RASL_N:
+case HEVC_NAL_VCL_N10:
+case HEVC_NAL_VCL_N12:
+case HEVC_NAL_VCL_N14:
+case HEVC_NAL_BLA_N_LP:
+case HEVC_NAL_IDR_N_LP:
+return 1;
+break;
+default: break;
+}
+return 0;
+}
+
 /**
  * Find next frame in output order and put a reference to it in frame.
  * @return 1 if a frame was output, 0 otherwise
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel