History

avcodec/vvc: Add support for output_corrupt/showall flags

Zhao Zhili committed 1 year ago

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

Showing the changes to libavcodec (2 of 2 files). Show all

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
48 return;48 return;
49 49
50 frame->flags &= ~flags;50 frame->flags &= ~flags;
51 if (!(frame->flags & ~VVC_FRAME_FLAG_CORRUPT))
52 frame->flags = 0;
51 if (!frame->flags) {53 if (!frame->flags) {
52 av_frame_unref(frame->frame);54 av_frame_unref(frame->frame);
53 av_refstruct_unref(&frame->sps);55 av_refstruct_unref(&frame->sps);
@@ -280,6 +282,9 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, AVFrame *out, const · 226 unmodified lines
280 if (nb_output) {282 if (nb_output) {
281 VVCFrame *frame = &fc->DPB[min_idx];283 VVCFrame *frame = &fc->DPB[min_idx];
282 284
285 if (frame->flags & VVC_FRAME_FLAG_CORRUPT)
286 frame->frame->flags |= AV_FRAME_FLAG_CORRUPT;
287
283 ret = av_frame_ref(out, frame->frame);288 ret = av_frame_ref(out, frame->frame);
284 if (frame->flags & VVC_FRAME_FLAG_BUMPING)289 if (frame->flags & VVC_FRAME_FLAG_BUMPING)
285 ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_BUMPING);290 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
389 394
390 frame->poc = poc;395 frame->poc = poc;
391 frame->sequence = s->seq_decode;396 frame->sequence = s->seq_decode;
392 frame->flags = 0;397 frame->flags = VVC_FRAME_FLAG_CORRUPT;
393 398
394 ff_vvc_report_frame_finished(frame);399 ff_vvc_report_frame_finished(frame);
395 400
@@ -424,6 +429,19 @@ static int add_candidate_ref(VVCContext *s, VVCFrameContext *fc, RefPicList *lis · 28 unmodified lines
424 if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES)429 if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES)
425 return AVERROR_INVALIDDATA;430 return AVERROR_INVALIDDATA;
426 431
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
427 if (!ref) {445 if (!ref) {
428 ref = generate_missing_ref(s, fc, poc);446 ref = generate_missing_ref(s, fc, poc);
429 if (!ref)447 if (!ref)
libavcodec/vvc/refs.h+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
29#define VVC_FRAME_FLAG_SHORT_REF (1 << 1)29#define VVC_FRAME_FLAG_SHORT_REF (1 << 1)
30#define VVC_FRAME_FLAG_LONG_REF (1 << 2)30#define VVC_FRAME_FLAG_LONG_REF (1 << 2)
31#define VVC_FRAME_FLAG_BUMPING (1 << 3)31#define VVC_FRAME_FLAG_BUMPING (1 << 3)
32#define VVC_FRAME_FLAG_CORRUPT (1 << 4)
32 33
33int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, struct AVFrame *out, int no_output_of_prior_pics_flag, int flush);34int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, struct AVFrame *out, int no_output_of_prior_pics_flag, int flush);
34void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc);35void 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