From patchwork Mon Apr 1 23:39:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 12560 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0F835447ECB for ; Tue, 2 Apr 2019 02:45:34 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DF37168ABCE; Tue, 2 Apr 2019 02:45:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EC8B968AAA0 for ; Tue, 2 Apr 2019 02:45:27 +0300 (EEST) Received: by mail-wr1-f41.google.com with SMTP id j9so14206118wrn.6 for ; Mon, 01 Apr 2019 16:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=XZMFA4Vjw9dw6Arr/gVwrin2OYRzN1hLU42pqRGCSbk=; b=anKgKRMfOGC16gXb4s2FSeOyfvbmpKZP+HRRPhpTqlO5O5zbBic9Tzf2DCT2hQbc/X 8p8OPy/8sDjN74XsUgocgqym9R32tNzJjYjxpcofryYWibT+EXg56Dr9jqNi404xbY3F AyuWs+uiKXyRuv4l2Ld58QkhqweVJtEgJoD9dNS88Zv+/JfPL4XqHhiOvgbY2lqEU2/3 FIkPbm7Eeee22QGIRFWzNOPxMLl32jitbRb5WuB5dZHtL8FNq22Ekl1Tt4+jHwo9EWQ2 Mfrz/+4p88YyHrrxNcKuhC+DutbCB1+N4ivblSpa4PBLvP7Wrx4bHN76M1Nzi8oKEs/U jvoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XZMFA4Vjw9dw6Arr/gVwrin2OYRzN1hLU42pqRGCSbk=; b=G0eiJI4kqYxZU/lvBBeb1RzQIyu4aNtA9yz3WVLLwZakEN7VcOCrraXjGxIhdB0tAO ibnUYUbnha1Z6IPWoUXE3hhRolA+P9vft51s4ow0KylGSwVxJzNf3lkiTeAdEYzHW//y c8aEGfgvbMrth0b4BDWR2POGboL5ufOMTiuZBuWWwoT8Q1JN6eRGbftHPd4TAj1yWzi6 /aFfkXGozeuAboMNbIbyurBSvWpEGFHQ9pEsJeI2i1xsiUV/xlF262/gR38diRMFhYeo CuW/JSA+5mg5K3NueXtbcna30Lp/yqU6j/v2vPVMF7R3e/BaOFgjyZS02OvP5UgFjo1x OQLg== X-Gm-Message-State: APjAAAXW7Jx5gGnyxpnDIadVwq6MU14dWzBVmB4ax0YisfynqgP+4Hks MEFzADtqp0rA1p1nGEQVcOHqFZ3L670= X-Google-Smtp-Source: APXvYqw/utckpf4I2DdlPAk7yxV+t7EXG7dGT21V6mNN1r/LlB7Fv9LxT1JPVzRAwJtNJuW76irV1Q== X-Received: by 2002:adf:f30b:: with SMTP id i11mr17706601wro.297.1554161988274; Mon, 01 Apr 2019 16:39:48 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id r30sm27943044wrr.46.2019.04.01.16.39.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 16:39:47 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Apr 2019 00:39:34 +0100 Message-Id: <20190401233940.5941-3-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190401233940.5941-1-sw@jkqxz.net> References: <20190401233940.5941-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/9] cbs_vp9: Fill context information for show-existing-frame X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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, }; } }