From patchwork Mon Aug 24 17:08:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 21881 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 091E244B34A for ; Mon, 24 Aug 2020 20:09:20 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D97FD689ED4; Mon, 24 Aug 2020 20:09:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 261BE68974F for ; Mon, 24 Aug 2020 20:09:13 +0300 (EEST) Received: by mail-qv1-f68.google.com with SMTP id x7so4063187qvi.5 for ; Mon, 24 Aug 2020 10:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=F9UdWfSQezQUFjUfV9CfuXmy4kjPiz0x823n1XYyBqQ=; b=jV4T6DVYAC5OPCp6F9T1Rfq9SWtahkVC+1qD27LwGcEOp6cI0GtJi7DNInuKoX76xe 8Y0t8Xh7lX4gAGsIfvj78rA/gSHaUGczqEvHXFxLTlm2MIyYpLbOgg8QB+doF0PC/6Pu mtFhfFon7zdM3PX8kO7P1+AZUR0XPoazbbc/Fh8Q6+iIjwabzYUHkagiHPkgQzbAnoCM NBEKPOvhYOVKxXbZrdUEKc0Ftz9sAAG38yiUSB6Ri67qmymsTf+nCnh6TsXExGTe9EnT 06AGa7O8HKaoFTOjxfKU9n4c8P4nMKvT7GCpxa9JNgjC6LIzf3shfwTfPrsO1VwvFyeP L/og== 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:mime-version :content-transfer-encoding; bh=F9UdWfSQezQUFjUfV9CfuXmy4kjPiz0x823n1XYyBqQ=; b=q0TB4wAnM5dHQ06l0bvhvVqjomognDOINBwi6uiMU/lXJicAyDaj5haniFDrI8sYYl hsZSVi8KlI3YrNCSkQv8a6IXf06KUQM0+/9f7DiV0Q3UCuaxCSfH8X7gp3eHe4DWZCVe ZFwKByDh0lwzjZrIhYpKIpv9JuU80pioSqJnCuQ3s9ym0rRErX1FuthMAIBIc1RS92rN BoETkEU4uD+QZamNeF4Ne2bs8ASzOIR1lDprY+ZQuVrQBxp3A4JHQ3kjcan5HcGBNjsx tGHw2m3zdyGZfZTvvfR8/9kpunsSQGqGDzQIyimeVMXyAN305gHj4Xa4IwZnZBgcnHdn H4wQ== X-Gm-Message-State: AOAM533s+XGSc7L5YU/DE/2BYkoTqCbscNFPRlGr0sG89Zmxv8Gzhq+3 ioF5TQPy53cQa4k3X2Ws2LECVlnzT1o= X-Google-Smtp-Source: ABdhPJxfnI4jy1eCCMUdpv0pLs5bpXN12lQ0fn/eQbZgekXR+mHInAshJztrun2/ODYnY4dTNiKSyg== X-Received: by 2002:ad4:55ca:: with SMTP id bt10mr5851097qvb.200.1598288947148; Mon, 24 Aug 2020 10:09:07 -0700 (PDT) Received: from localhost.localdomain ([181.23.70.159]) by smtp.gmail.com with ESMTPSA id b187sm9626911qkd.107.2020.08.24.10.09.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 10:09:06 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Aug 2020 14:08:48 -0300 Message-Id: <20200824170851.4289-1-jamrial@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/cbs_av1: add OrderHint to CodedBitstreamAV1Context 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" This follows the spec and will come in handy in a following commit. Signed-off-by: James Almer --- libavcodec/cbs_av1.h | 1 + libavcodec/cbs_av1_syntax_template.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h index 704a231209..913a6e5dea 100644 --- a/libavcodec/cbs_av1.h +++ b/libavcodec/cbs_av1.h @@ -429,6 +429,7 @@ typedef struct CodedBitstreamAV1Context { int operating_point_idc; int bit_depth; + int order_hint; int frame_width; int frame_height; int upscaled_width; diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index 28d9ab9817..6a0a105904 100644 --- a/libavcodec/cbs_av1_syntax_template.c +++ b/libavcodec/cbs_av1_syntax_template.c @@ -373,7 +373,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, RWContext *rw, for (i = 0; i < AV1_NUM_REF_FRAMES; i++) shifted_order_hints[i] = cur_frame_hint + cbs_av1_get_relative_dist(seq, priv->ref[i].order_hint, - current->order_hint); + priv->order_hint); latest_order_hint = shifted_order_hints[current->last_frame_idx]; earliest_order_hint = shifted_order_hints[current->golden_frame_idx]; @@ -1005,7 +1005,7 @@ static int FUNC(skip_mode_params)(CodedBitstreamContext *ctx, RWContext *rw, for (i = 0; i < AV1_REFS_PER_FRAME; i++) { ref_hint = priv->ref[current->ref_frame_idx[i]].order_hint; dist = cbs_av1_get_relative_dist(seq, ref_hint, - current->order_hint); + priv->order_hint); if (dist < 0) { if (forward_idx < 0 || cbs_av1_get_relative_dist(seq, ref_hint, @@ -1397,6 +1397,7 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, fb(order_hint_bits, order_hint); else infer(order_hint, 0); + priv->order_hint = current->order_hint; if (frame_is_intra || current->error_resilient_mode) infer(primary_ref_frame, AV1_PRIMARY_REF_NONE); @@ -1586,14 +1587,14 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, .subsampling_x = seq->color_config.subsampling_x, .subsampling_y = seq->color_config.subsampling_y, .bit_depth = priv->bit_depth, - .order_hint = current->order_hint, + .order_hint = priv->order_hint, }; } } av_log(ctx->log_ctx, AV_LOG_DEBUG, "Frame %d: size %dx%d " "upscaled %d render %dx%d subsample %dx%d " - "bitdepth %d tiles %dx%d.\n", current->order_hint, + "bitdepth %d tiles %dx%d.\n", priv->order_hint, priv->frame_width, priv->frame_height, priv->upscaled_width, priv->render_width, priv->render_height, seq->color_config.subsampling_x + 1,