diff mbox

[FFmpeg-devel,v2,7/9] cbs_av1: Fill context information for show-existing-frame

Message ID 20190401233940.5941-7-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson April 1, 2019, 11:39 p.m. UTC
---
 libavcodec/cbs_av1_syntax_template.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

James Almer April 3, 2019, 2 a.m. UTC | #1
On 4/1/2019 8:39 PM, Mark Thompson wrote:
> ---
>  libavcodec/cbs_av1_syntax_template.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
> index 76eb90b279..a9bf78e4ad 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1146,6 +1146,22 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
>  
>              fb(3, frame_to_show_map_idx);
>              frame = &priv->ref[current->frame_to_show_map_idx];
> +            if (!frame->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;
> +            }
> +
> +            priv->bit_depth      = frame->bit_depth;
> +            priv->frame_width    = frame->frame_width;
> +            priv->frame_height   = frame->frame_height;

Right, so if you use the frame header returned by
ff_cbs_parse_headers(), then frames with show_existing_frame == 1 would
not have the relevant values set. Hence using CodedBitstreamAV1Context
in patch 8/9.

Using infer() for these like you're doing for frame_type below would be
a solution, i think.

> +            priv->upscaled_width = frame->upscaled_width;
> +            priv->render_width   = frame->render_width;
> +            priv->render_height  = frame->render_height;
> +
> +            infer(frame_type, frame->frame_type);
>  
>              if (seq->decoder_model_info_present_flag &&
>                  !seq->timing_info.equal_picture_interval) {
>
diff mbox

Patch

diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index 76eb90b279..a9bf78e4ad 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1146,6 +1146,22 @@  static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
 
             fb(3, frame_to_show_map_idx);
             frame = &priv->ref[current->frame_to_show_map_idx];
+            if (!frame->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;
+            }
+
+            priv->bit_depth      = frame->bit_depth;
+            priv->frame_width    = frame->frame_width;
+            priv->frame_height   = frame->frame_height;
+            priv->upscaled_width = frame->upscaled_width;
+            priv->render_width   = frame->render_width;
+            priv->render_height  = frame->render_height;
+
+            infer(frame_type, frame->frame_type);
 
             if (seq->decoder_model_info_present_flag &&
                 !seq->timing_info.equal_picture_interval) {