From: "J. Dekker" <jdek@itanimul.li> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 4/7] lavc: set decode_error_flags when ec active Date: Fri, 21 Jul 2023 15:37:43 +0200 Message-ID: <20230721133746.33335-4-jdek@itanimul.li> (raw) In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> FF_DECODE_ERROR_CONCEALMENT_ACTIVE should be set when ec is active on supported decoders. Co-Authored-By: Thomas Guillem <thomas@gllm.fr> Signed-off-by: J. Dekker <jdek@itanimul.li> --- libavcodec/h263dec.c | 6 ++++-- libavcodec/mpeg12dec.c | 3 ++- libavcodec/mss2.c | 8 +++++--- libavcodec/rv10.c | 10 ++++++++-- libavcodec/rv34.c | 12 +++++++++--- libavcodec/vc1dec.c | 6 ++++-- 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 68a618a7ed..f3b9f09303 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -620,8 +620,10 @@ retry: av_assert1(s->bitstream_buffer_size == 0); frame_end: - if (!s->studio_profile) - ff_er_frame_end(&s->er); + if (!s->studio_profile) { + if (ff_er_frame_end(&s->er) > 0) + s->current_picture.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } if (avctx->hwaccel) { ret = avctx->hwaccel->end_frame(avctx); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 27b45c6fc4..82a1e56b67 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2038,7 +2038,8 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (/* s->mb_y << field_pic == s->mb_height && */ !s->first_field && !s1->first_slice) { /* end of image */ - ff_er_frame_end(&s->er); + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; ff_mpv_frame_end(s); diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 98103f7fed..851346b0ad 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -421,8 +421,12 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_vc1_decode_blocks(v); + f = s->current_picture.f; + if (v->end_mb_x == s->mb_width && s->end_mb_y == s->mb_height) { - ff_er_frame_end(&s->er); + if (ff_er_frame_end(&s->er) > 0) + f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } else { av_log(v->s.avctx, AV_LOG_WARNING, "disabling error correction due to block count mismatch %dx%d != %dx%d\n", @@ -431,8 +435,6 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_mpv_frame_end(s); - f = s->current_picture.f; - if (v->respic == 3) { ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h); ctx->dsp.upsample_plane(f->data[1], f->linesize[1], w+1 >> 1, h+1 >> 1); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index bb1ead5002..09a1d4dba6 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -440,6 +440,12 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx) return 0; } +static void rv10_er_frame_end(MpegEncContext *s) +{ + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; +} + static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int buf_size2, int whole_size) { @@ -477,7 +483,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { // FIXME write parser so we always have complete frames? if (s->current_picture_ptr) { - ff_er_frame_end(&s->er); + rv10_er_frame_end(s); ff_mpv_frame_end(s); s->mb_x = s->mb_y = s->resync_mb_x = s->resync_mb_y = 0; } @@ -649,7 +655,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if (s->current_picture_ptr && s->mb_y >= s->mb_height) { - ff_er_frame_end(&s->er); + rv10_er_frame_end(s); ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 51f18147af..c6231adf5f 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1554,13 +1554,19 @@ static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n, in return buf_size; } +static void rv34_er_frame_end(MpegEncContext *s) +{ + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; +} + static int finish_frame(AVCodecContext *avctx, AVFrame *pict) { RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; int got_picture = 0, ret; - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); s->mb_num_left = 0; @@ -1655,7 +1661,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); if (!s->context_reinit) - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); } @@ -1790,7 +1796,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_INFO, "marking unfished frame as finished\n"); /* always mark the current frame as finished, frame-mt supports * only complete frames */ - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 9e343d003f..d930502176 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1321,8 +1321,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if ( !v->field_mode && avctx->codec_id != AV_CODEC_ID_WMV3IMAGE - && avctx->codec_id != AV_CODEC_ID_VC1IMAGE) - ff_er_frame_end(&s->er); + && avctx->codec_id != AV_CODEC_ID_VC1IMAGE) { + if (ff_er_frame_end(&s->er) > 0) + s->current_picture.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } } ff_mpv_frame_end(s); -- 2.41.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:[~2023-07-21 13:38 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-21 13:37 [FFmpeg-devel] [PATCH 1/7] lavu: add ecinfo sidedata J. Dekker 2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 2/7] lavc: add AV_CODEC_EXPORT_DATA_ERROR J. Dekker 2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 3/7] lavc/error_resilience: fill ecinfo J. Dekker 2023-07-21 13:37 ` J. Dekker [this message] 2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 5/7] lavc/h264: export ecinfo J. Dekker 2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 6/7] tools/ffprobe: add ecinfo frame side data J. Dekker 2023-07-21 13:47 ` [FFmpeg-devel] [PATCH 6/7 v1.1] " J. Dekker 2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 7/7] fate: add ecinfo sidedata test J. Dekker 2023-07-21 14:44 ` [FFmpeg-devel] [PATCH 1/7] lavu: add ecinfo sidedata Devin Heitmueller 2023-07-25 12:05 ` J. Dekker 2023-07-25 22:00 ` Michael Niedermayer 2023-07-21 23:49 ` Michael Niedermayer [not found] ` <20230721133746.33335-1-jdek@itanimul.li-N_sf260--B-9> 2023-07-22 0:12 ` Lynne
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=20230721133746.33335-4-jdek@itanimul.li \ --to=jdek@itanimul.li \ --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