History

avcodec/vvc: Add support for output_corrupt/showall flags

Zhao Zhili committed 1 year ago

Commit ea381281 parent a328b212 files · +20 −1Browse files

Unified · Split

2 files
  1. libavcodec/vvc/refs.c +19 −1
  2. libavcodec/vvc/refs.h +1 −0
libavcodec/vvc/refs.c+19−1
@@ -48,6 +48,8 @@ void ff_vvc_unref_frame(VVCFrameContext *fc, VVCFrame *frame, int flags) · 47 unmodified lines
4848 return;
4949
5050 frame->flags &= ~flags;
51+ if (!(frame->flags & ~VVC_FRAME_FLAG_CORRUPT))
52+ frame->flags = 0;
5153 if (!frame->flags) {
5254 av_frame_unref(frame->frame);
5355 av_refstruct_unref(&frame->sps);
@@ -280,6 +282,9 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, AVFrame *out, const · 226 unmodified lines
280282 if (nb_output) {
281283 VVCFrame *frame = &fc->DPB[min_idx];
282284
285+ if (frame->flags & VVC_FRAME_FLAG_CORRUPT)
286+ frame->frame->flags |= AV_FRAME_FLAG_CORRUPT;
287+
283288 ret = av_frame_ref(out, frame->frame);
284289 if (frame->flags & VVC_FRAME_FLAG_BUMPING)
285290 ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_BUMPING);
@@ -389,7 +394,7 @@ static VVCFrame *generate_missing_ref(VVCContext *s, VVCFrameContext *fc, int po · 103 unmodified lines
389394
390395 frame->poc = poc;
391396 frame->sequence = s->seq_decode;
392− frame->flags = 0;
397+ frame->flags = VVC_FRAME_FLAG_CORRUPT;
393398
394399 ff_vvc_report_frame_finished(frame);
395400
@@ -424,6 +429,19 @@ static int add_candidate_ref(VVCContext *s, VVCFrameContext *fc, RefPicList *lis · 28 unmodified lines
424429 if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES)
425430 return AVERROR_INVALIDDATA;
426431
432+ if (!IS_CVSS(s)) {
433+ const bool ref_corrupt = !ref || (ref->flags & VVC_FRAME_FLAG_CORRUPT);
434+ const bool recovering = s->no_output_before_recovery_flag && !GDR_IS_RECOVERED(s);
435+
436+ if (ref_corrupt && !recovering) {
437+ if (!(s->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&
438+ !(s->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL))
439+ return AVERROR_INVALIDDATA;
440+
441+ fc->ref->flags |= VVC_FRAME_FLAG_CORRUPT;
442+ }
443+ }
444+
427445 if (!ref) {
428446 ref = generate_missing_ref(s, fc, poc);
429447 if (!ref)
libavcodec/vvc/refs.h+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #define VVC_FRAME_FLAG_SHORT_REF (1 << 1)
3030 #define VVC_FRAME_FLAG_LONG_REF (1 << 2)
3131 #define VVC_FRAME_FLAG_BUMPING (1 << 3)
32+#define VVC_FRAME_FLAG_CORRUPT (1 << 4)
3233
3334 int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, struct AVFrame *out, int no_output_of_prior_pics_flag, int flush);
3435 void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t