History

avcodec/h264dec: Support skipping frames that used gray gap frames

Michael Niedermayer committed 3 years ago

Commit e56d91f1 parent 6364fa92 files · +8 −0Browse files

Unified · Split

2 files
  1. libavcodec/h264dec.c +7 −0
  2. libavcodec/h264dec.h +1 −0
libavcodec/h264dec.c+7−0
@@ -939,6 +939,12 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g · 938 unmodified lines
939939 (h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) ||
940940 out->recovered)) {
941941
942+ if (h->skip_gray > 0 &&
943+ h->non_gray && out->gray &&
944+ !(h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)
945+ )
946+ return 0;
947+
942948 if (!h->avctx->hwaccel &&
943949 (out->field_poc[0] == INT_MAX ||
944950 out->field_poc[1] == INT_MAX)
@@ -1091,6 +1097,7 @@ static const AVOption h264_options[] = { · 146 unmodified lines
10911097 { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VDX },
10921098 { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
10931099 { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
1100+ { "skip_gray", "Do not return gray gap frames", OFFSET(skip_gray), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VD },
10941101 { "noref_gray", "Avoid using gray gap frames as references", OFFSET(noref_gray), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, VD },
10951102 { NULL },
10961103 };
libavcodec/h264dec.h+1−0
@@ -572,6 +572,7 @@ typedef struct H264Context { · 571 unmodified lines
572572
573573 int non_gray; ///< Did we encounter a intra frame after a gray gap frame
574574 int noref_gray;
575+ int skip_gray;
575576 } H264Context;
576577
577578 extern const uint16_t ff_h264_mb_sizes[4];

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