From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 21/39] lavc/hevcdec: output RASL frames based on the value of no_rasl_output_flag Date: Fri, 7 Jun 2024 15:01:17 +0200 Message-ID: <20240607130135.9088-21-anton@khirnov.net> (raw) In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> Instead of an ad-hoc scheme. Also, combine skipping RASL frames with skip_frame handling - current code seems flawed as it only executes for the first slice of a RASL frame and unnecessarily unsets is_decoded, which should not be set at this point anyway.. Some RASL frames in fate-hevc-afd-tc-sei that were previously discarded are now output. --- libavcodec/hevc/hevcdec.c | 33 ++++--------------------------- libavcodec/hevc/hevcdec.h | 1 - tests/ref/fate/hevc-afd-tc-sei | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index d444ea93f7..a57fa4e539 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -605,7 +605,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; - s->max_ra = INT_MAX; if (IS_IDR(s)) ff_hevc_clear_refs(s); } @@ -645,7 +644,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) s->avctx->pix_fmt = pix_fmt; s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; - s->max_ra = INT_MAX; } sh->dependent_slice_segment_flag = 0; @@ -3106,32 +3104,15 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } - if ( - (s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || + 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_IRAP(s))) { + (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s)) || + ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && + s->no_rasl_output_flag)) { 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)) { - s->max_ra = s->poc; - } else { - if (IS_IDR(s)) - s->max_ra = INT_MIN; - } - } - - if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && - s->poc <= s->max_ra) { - s->is_decoded = 0; - break; - } else { - if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) - s->max_ra = INT_MIN; - } - s->overlap ++; ret = hevc_frame_start(s); if (ret < 0) @@ -3196,7 +3177,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; - s->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: @@ -3572,8 +3552,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) return AVERROR(ENOMEM); } - s->max_ra = INT_MAX; - s->md5_ctx = av_md5_alloc(); if (!s->md5_ctx) return AVERROR(ENOMEM); @@ -3626,7 +3604,6 @@ static int hevc_update_thread_context(AVCodecContext *dst, s->seq_decode = s0->seq_decode; s->seq_output = s0->seq_output; s->poc_tid0 = s0->poc_tid0; - s->max_ra = s0->max_ra; s->eos = s0->eos; s->no_rasl_output_flag = s0->no_rasl_output_flag; @@ -3640,7 +3617,6 @@ static int hevc_update_thread_context(AVCodecContext *dst, if (s0->eos) { s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; - s->max_ra = INT_MAX; } ret = ff_h2645_sei_ctx_replace(&s->sei.common, &s0->sei.common); @@ -3734,7 +3710,6 @@ static void hevc_decode_flush(AVCodecContext *avctx) ff_hevc_reset_sei(&s->sei); ff_dovi_ctx_flush(&s->dovi_ctx); av_buffer_unref(&s->rpu_buf); - s->max_ra = INT_MAX; s->eos = 1; if (FF_HW_HAS_CB(avctx, flush)) diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index fa7caf9cf7..04eacca76d 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -487,7 +487,6 @@ typedef struct HEVCContext { int slice_idx; ///< number of the slice being currently decoded int eos; ///< current packet contains an EOS/EOB NAL int last_eos; ///< last packet contains an EOS/EOB NAL - int max_ra; int bs_width; int bs_height; int overlap; diff --git a/tests/ref/fate/hevc-afd-tc-sei b/tests/ref/fate/hevc-afd-tc-sei index 27eb3fc8d7..735226745b 100644 --- a/tests/ref/fate/hevc-afd-tc-sei +++ b/tests/ref/fate/hevc-afd-tc-sei @@ -202,3 +202,39 @@ value=00:00:00:00 [/TIMECODE] [/SIDE_DATA] [/FRAME] +[FRAME] +[SIDE_DATA] +side_data_type=Active format description +active_format=8 +[/SIDE_DATA] +[SIDE_DATA] +side_data_type=SMPTE 12-1 timecode +[TIMECODE] +value=00:00:00:00 +[/TIMECODE] +[/SIDE_DATA] +[/FRAME] +[FRAME] +[SIDE_DATA] +side_data_type=Active format description +active_format=8 +[/SIDE_DATA] +[SIDE_DATA] +side_data_type=SMPTE 12-1 timecode +[TIMECODE] +value=00:00:00:00 +[/TIMECODE] +[/SIDE_DATA] +[/FRAME] +[FRAME] +[SIDE_DATA] +side_data_type=Active format description +active_format=8 +[/SIDE_DATA] +[SIDE_DATA] +side_data_type=SMPTE 12-1 timecode +[TIMECODE] +value=00:00:00:00 +[/TIMECODE] +[/SIDE_DATA] +[/FRAME] -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-06-07 13:10 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-07 13:00 [FFmpeg-devel] [PATCH 01/39] lavc/hevcdec: do not free SliceHeader arrays in pic_arrays_free() Anton Khirnov 2024-06-07 13:00 ` [FFmpeg-devel] [PATCH 02/39] lavc/hevcdec: simplify condition Anton Khirnov 2024-06-07 13:00 ` [FFmpeg-devel] [PATCH 03/39] lavc/hevcdec: drop a redundant assignment in hevc_decode_frame() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 04/39] lavc/hevc_ps: make PPS hold a reference to its SPS Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 05/39] lavc/hevc_ps: make SPS hold a reference to its VPS Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 06/39] lavc/hevc/parser: stop using HEVCParamSets.[psv]ps Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 07/39] lavc/hevc/mvs: stop accessing parameter sets through HEVCParamSets Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 08/39] lavc/hevc/filter: " Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 09/39] lavc/hevc/cabac: " Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 10/39] lavc/hevc/pred: " Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 11/39] lavc/hevcdec: " Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 12/39] lavc/hevcdec: move active PPS from HEVCParamSets to HEVCContext Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 13/39] lavc/hevcdec: drop an always-zero variable Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 14/39] lavc/hevcdec: only ignore INVALIDDATA in decode_nal_unit() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 15/39] lavc/hevcdec: pass SliceHeader explicitly to pred_weight_table() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 16/39] lavc/hevcdec: do not pass HEVCContext to decode_lt_rps() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 17/39] lavc/hevcdec: move pocTid0 computation to hevc_frame_start() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 18/39] lavc/hevcdec: only call export_stream_params_from_sei() once per frame Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 19/39] lavc/hevcdec: do not pass HEVCContext to ff_hevc_frame_nb_refs() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 20/39] lavc/hevcdec: only set no_rasl_output_flag for IRAP frames Anton Khirnov 2024-06-07 13:01 ` Anton Khirnov [this message] 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 22/39] lavc/hevc/cabac: do not infer WPP use based on HEVCContext.threads_number Anton Khirnov 2024-06-08 7:02 ` Christophe Gisquet 2024-06-08 13:06 ` Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 23/39] lavc/hevcdec: drop redundant HEVCContext.threads_{type, number} Anton Khirnov 2024-06-08 7:08 ` Christophe Gisquet 2024-06-08 13:07 ` Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 24/39] lavc/hevcdec: store slice header POC in SliceHeader Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 25/39] lavc/hevcdec: move a slice segment sanity check to hls_slice_header() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 26/39] lavc/hevcdec: move slice decoding dispatch to its own function Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 27/39] lavc/hevcdec: move per-slice local_ctx setup out of hls_slice_header() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 28/39] lavc/hevcdec: move calling hwaccel start_frame to hevc_frame_start() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 29/39] lavc/hevcdec: move calling hwaccel decode_slice to decode_slice_data() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 30/39] lavc/hevcdec: move constructing slice RPL " Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 31/39] lavc/hevcdec: set active PPS/SPS in hevc_frame_start() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 32/39] lavc/hevcdec: move sequence increment/IDR handling to hevc_frame_start() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 33/39] lavc/hevcdec: move setting slice_initialized out of hls_slice_header() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 34/39] lavc/hevcdec: move the check for multiple frames in a packet Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 35/39] lavc/hevcdec: drop a redundant multiple-frame-per-packet check Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 36/39] lavc/hevcdec: factor decoding a slice NALU out of decode_nal_unit() Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 37/39] lavc/hevcdec: move some frame-end code to hevc_frame_end() Anton Khirnov 2024-06-13 5:55 ` Wang, Fei W 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 38/39] lavc/hevcdec: do not unref current frame on frame_end() failure Anton Khirnov 2024-06-07 13:01 ` [FFmpeg-devel] [PATCH 39/39] lavc/hevcdec: constify source frame in hevc_ref_frame() Anton Khirnov 2024-06-08 12:48 ` Vittorio Giovara
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240607130135.9088-21-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git