libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function

In preparation for implementation of skip_frame.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
sfan5 2017-12-07 20:37:48 +01:00 committed by Michael Niedermayer
parent 2fdc9f7c49
commit a428f2fcd9
2 changed files with 23 additions and 17 deletions

View File

@ -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)

View File

@ -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