diff mbox

[FFmpeg-devel] libavcodec/hevc_filter: support for all skip_loop_filter levels

Message ID DB3PR0202MB3452EBD743CF6BD0D05546E4EC380@DB3PR0202MB3452.eurprd02.prod.outlook.com
State Superseded
Headers show

Commit Message

sfan5 Nov. 30, 2017, 11:22 p.m. UTC
Hi,

Attached patch adds full support for skip_loop_filter (all levels) to 
the hevc decoder.

I'm not too sure about the implementation of "nonref", since this email 
(http://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/176116.html) 
mentions looking at nal_unit_type and temporal_id instead. Some help 
would be appreciated.

The 'make fate' test suite passed.

Comments

Michael Niedermayer Dec. 1, 2017, 4:45 p.m. UTC | #1
On Thu, Nov 30, 2017 at 11:22:41PM +0000, Stefan _ wrote:
> Hi,
> 
> Attached patch adds full support for skip_loop_filter (all levels) to 
> the hevc decoder.
> 
> I'm not too sure about the implementation of "nonref", since this email 
> (http://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/176116.html) 
> mentions looking at nal_unit_type and temporal_id instead. Some help 
> would be appreciated.
> 
> The 'make fate' test suite passed.
> 

>  doc/decoders.texi        |    7 -------
>  libavcodec/hevc_filter.c |   12 +++++++++++-
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 3d17844176bdd364e689212417b7857fe46fd3bb  0001-libavcodec-hevc_filter-support-for-all-skip_loop_fil.patch
> From 3e2f7152e3dab1f6cfe7c7e14f2ba1cee519978c Mon Sep 17 00:00:00 2001
> From: sfan5 <sfan5@live.de>
> Date: Thu, 30 Nov 2017 23:58:02 +0100
> Subject: [PATCH] libavcodec/hevc_filter: support for all skip_loop_filter
>  levels.
> 
> Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off.
> ---
>  doc/decoders.texi        |  7 -------
>  libavcodec/hevc_filter.c | 12 +++++++++++-
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/doc/decoders.texi b/doc/decoders.texi
> index d149d2bea5..a9510bdf02 100644
> --- a/doc/decoders.texi
> +++ b/doc/decoders.texi
> @@ -25,13 +25,6 @@ enabled decoders.
>  A description of some of the currently available video decoders
>  follows.
>  
> -@section hevc
> -
> -HEVC / H.265 decoder.
> -
> -Note: the @option{skip_loop_filter} option has effect only at level
> -@code{all}.
> -
>  @section rawvideo
>  
>  Raw video decoder.
> diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
> index b53f4cc721..17ec59619f 100644
> --- a/libavcodec/hevc_filter.c
> +++ b/libavcodec/hevc_filter.c
> @@ -842,7 +842,17 @@ 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;
> -    if (s->avctx->skip_loop_filter < AVDISCARD_ALL)
> +    int deblock = 1;
> +    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 &&
> +         ff_hevc_frame_nb_refs(s) == 0))

AVDISCARD_NONREF is about frames which are not referenced by any other
doesnt ff_hevc_frame_nb_refs() produce the number of references curently
aka the other end of the reference arrows ?


[...]
Carl Eugen Hoyos Dec. 4, 2017, 8:06 p.m. UTC | #2
2017-12-01 0:22 GMT+01:00 Stefan _ <sfan5@live.de>:

> Attached patch adds full support for skip_loop_filter
> (all levels) to the hevc decoder.

Will you also work on -skip_frame for hevc?

Carl Eugen
diff mbox

Patch

From 3e2f7152e3dab1f6cfe7c7e14f2ba1cee519978c Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Thu, 30 Nov 2017 23:58:02 +0100
Subject: [PATCH] libavcodec/hevc_filter: support for all skip_loop_filter
 levels.

Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off.
---
 doc/decoders.texi        |  7 -------
 libavcodec/hevc_filter.c | 12 +++++++++++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index d149d2bea5..a9510bdf02 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -25,13 +25,6 @@  enabled decoders.
 A description of some of the currently available video decoders
 follows.
 
-@section hevc
-
-HEVC / H.265 decoder.
-
-Note: the @option{skip_loop_filter} option has effect only at level
-@code{all}.
-
 @section rawvideo
 
 Raw video decoder.
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index b53f4cc721..17ec59619f 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,7 +842,17 @@  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;
-    if (s->avctx->skip_loop_filter < AVDISCARD_ALL)
+    int deblock = 1;
+    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 &&
+         ff_hevc_frame_nb_refs(s) == 0))
+        deblock = 0;
+    if (deblock)
         deblocking_filter_CTB(s, x, y);
     if (s->ps.sps->sao_enabled) {
         int y_end = y >= s->ps.sps->height - ctb_size;
-- 
2.15.0