[FFmpeg-devel] [PATCH v2 3/9] cbs_vp9: Fill context information for show-existing-frame
Mark Thompson
sw at jkqxz.net
Tue Apr 2 02:39:34 EEST 2019
The frame being shown could have different properties to the last-decoded
one.
---
libavcodec/cbs_vp9.h | 3 +++
libavcodec/cbs_vp9_syntax_template.c | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h
index 4c9b2f880d..c637c0d346 100644
--- a/libavcodec/cbs_vp9.h
+++ b/libavcodec/cbs_vp9.h
@@ -182,11 +182,14 @@ typedef struct VP9RawSuperframe {
} VP9RawSuperframe;
typedef struct VP9ReferenceFrameState {
+ int valid;
int frame_width; // RefFrameWidth
int frame_height; // RefFrameHeight
int subsampling_x; // RefSubsamplingX
int subsampling_y; // RefSubsamplingY
int bit_depth; // RefBitDepth
+ int frame_type;
+ int intra_only;
} VP9ReferenceFrameState;
typedef struct CodedBitstreamVP9Context {
diff --git a/libavcodec/cbs_vp9_syntax_template.c b/libavcodec/cbs_vp9_syntax_template.c
index 898cede329..811f5c12ce 100644
--- a/libavcodec/cbs_vp9_syntax_template.c
+++ b/libavcodec/cbs_vp9_syntax_template.c
@@ -290,10 +290,30 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
f(1, show_existing_frame);
if (current->show_existing_frame) {
+ VP9ReferenceFrameState *ref;
+
f(3, frame_to_show_map_idx);
+ ref = &vp9->ref[current->frame_to_show_map_idx];
+ if (!ref->valid) {
+ av_log(ctx->log_ctx, AV_LOG_ERROR,
+ "Missing reference frame needed to show existing frame "
+ "(frame_to_show_map_idx = %d).\n",
+ current->frame_to_show_map_idx);
+ return AVERROR_INVALIDDATA;
+ }
+
+ vp9->frame_width = ref->frame_width;
+ vp9->frame_height = ref->frame_height;
+ vp9->subsampling_x = ref->subsampling_x;
+ vp9->subsampling_y = ref->subsampling_y;
+ vp9->bit_depth = ref->bit_depth;
+ infer(frame_type, ref->frame_type);
+ infer(intra_only, ref->intra_only);
+
infer(header_size_in_bytes, 0);
infer(refresh_frame_flags, 0x00);
infer(loop_filter_level, 0);
+
return 0;
}
@@ -374,11 +394,14 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
for (i = 0; i < VP9_NUM_REF_FRAMES; i++) {
if (current->refresh_frame_flags & (1 << i)) {
vp9->ref[i] = (VP9ReferenceFrameState) {
+ .valid = 1,
.frame_width = vp9->frame_width,
.frame_height = vp9->frame_height,
.subsampling_x = vp9->subsampling_x,
.subsampling_y = vp9->subsampling_y,
.bit_depth = vp9->bit_depth,
+ .frame_type = current->frame_type,
+ .intra_only = current->intra_only,
};
}
}
--
2.20.1
More information about the ffmpeg-devel
mailing list