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
939 (h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) ||939 (h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) ||
940 out->recovered)) {940 out->recovered)) {
941 941
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
942 if (!h->avctx->hwaccel &&948 if (!h->avctx->hwaccel &&
943 (out->field_poc[0] == INT_MAX ||949 (out->field_poc[0] == INT_MAX ||
944 out->field_poc[1] == INT_MAX)950 out->field_poc[1] == INT_MAX)
@@ -1091,6 +1097,7 @@ static const AVOption h264_options[] = { · 146 unmodified lines
1091 { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VDX },1097 { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VDX },
1092 { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },1098 { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
1093 { "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 },1099 { "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 },
1094 { "noref_gray", "Avoid using gray gap frames as references", OFFSET(noref_gray), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, VD },1101 { "noref_gray", "Avoid using gray gap frames as references", OFFSET(noref_gray), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, VD },
1095 { NULL },1102 { NULL },
1096};1103};
libavcodec/h264dec.h+1−0
@@ -572,6 +572,7 @@ typedef struct H264Context { · 571 unmodified lines
572 572
573 int non_gray; ///< Did we encounter a intra frame after a gray gap frame573 int non_gray; ///< Did we encounter a intra frame after a gray gap frame
574 int noref_gray;574 int noref_gray;
575 int skip_gray;
575} H264Context;576} H264Context;
576 577
577extern const uint16_t ff_h264_mb_sizes[4];578extern 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