[FFmpeg-devel] [PATCH]lavc/hevcdec: Treat clean random access nals as keyframes for -skip_frame

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun May 27 23:53:08 EEST 2018


2018-05-26 18:38 GMT+02:00, Mark Thompson <sw at jkqxz.net>:
> On 24/05/18 17:57, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch fixes ticket #7227 here, -skip_frame nokey shows no
>> warnings on decoding with this change and still decodes less frames
>> than -skip_frame nointra (which shows many warnings).
>>
>> Please comment, Carl Eugen
>>
>>
>> From ea5cf5aab2a9360971f5291fce19e5daae833de0 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
>> Date: Thu, 24 May 2018 18:53:16 +0200
>> Subject: [PATCH] lavc/hevcdec: Treat clean random access nals as keyframes
>>  for -skip_frame.
>>
>> Fixes ticket #7227.
>> ---
>>  libavcodec/hevcdec.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
>> index c887762..dd7675a 100644
>> --- a/libavcodec/hevcdec.c
>> +++ b/libavcodec/hevcdec.c
>> @@ -2919,7 +2919,7 @@ static int decode_nal_unit(HEVCContext *s, const
>> H2645NAL *nal)
>>          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))) {
>> +            (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s) &&
>> s->nal_unit_type != HEVC_NAL_CRA_NUT)) {
>
> I think "!IS_IRAP(s)" would be simpler and perhaps more consistent?
> (Compared to what you have here it adds BLA NAL units as well,
> which will be equivalent to CRA for this purpose.)

Patch applied with this change.

Thank you, Carl Eugen


More information about the ffmpeg-devel mailing list