From patchwork Sat Apr 13 19:05:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 48048 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp979777pzb; Sat, 13 Apr 2024 12:05:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4mR4QhZbpUxH9D+a3V2m67Wy+ylqr9qNS3C/EI/BD51PobptSbEio9U8TrAwM/I2y1AQ8xbaNYcK8tyld9edG3YnR+Lwwpvia6g== X-Google-Smtp-Source: AGHT+IFMme34HamV7lx0/4FDlkItqQoByRfFcO3UIaPxbD1evtQ046w2982AFEBvqYuKRx8lWMqA X-Received: by 2002:a2e:900f:0:b0:2d9:ec13:3356 with SMTP id h15-20020a2e900f000000b002d9ec133356mr3528234ljg.0.1713035116581; Sat, 13 Apr 2024 12:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713035116; cv=none; d=google.com; s=arc-20160816; b=KHxwNKuA0/Gb5TFn3dIom2BUKrqLTGhgCFpvegY9SxPkrcLpQ1AF1VdbtZMWxZtfM7 JgmHmN+Ga++MjyeDjAbcOiF2+9AUR1xUf3DX5xByGZu+cnfdBprt7EnP4hbGNWgGvbiI JhegMYMdTJ75PEQAxlmuavxBOkhc+cnj+uCWwlb3EUtvNpg4t9SgzxVU92UlpCqWWZtz ujtHwTfPj/NqTfALruRU/259lBJspF8AyzQ32wusGHLi9mg0AGI91LdDVtAQA/WnX7p3 ktA3YcTKFOzpi7QOnWnPrnwoz8R8gckpnV89lcSZ6TQHQ1+cAwyDvejlNgHCtQLa5t7a Oikw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:from:to:content-language:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=QWaP4LTnmbwxgRm4wX7YVdJgBPKh2gQbyya0JqSV8mk=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=rHVumXKVyIvbVNVNQ1ilrBkzBLCQJ8N7/YFfctzFdOVoD+M4xMzFcaUQm6M1oHVBcg 0Oiv5eX60DReiVd1NLcMqFY4sPRQcDdFPeMx/8nZLBb4EpsYLx/f8ygOAFFr56xc6E3d sMllJlqSeXICJlcc3dL4M5PsIXQyUTM6V3htgYSn2Y0z6oKsEGLbFLZFjfN5oU5IP8LG 4HGG6eIfXl8Z2Wi0uO0jSXUZoP90pmZ7Jrw+QVJE4DsyEF43Ic/0OwZV1CUkOEkKmk6U QXH6WZq8o5MD/wKL9BXLQcvNtTCWenHyexPZ6hlu9Cv3hphd9J3/Cp4lkwBojV6O/qXO eoGA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=q6P+3Kg1; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l7-20020a50d6c7000000b0056c4eeebe87si2762416edj.332.2024.04.13.12.05.15; Sat, 13 Apr 2024 12:05:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=q6P+3Kg1; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1682268D34A; Sat, 13 Apr 2024 22:05:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A65E568D264 for ; Sat, 13 Apr 2024 22:05:04 +0300 (EEST) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-346b09d474dso1848467f8f.2 for ; Sat, 13 Apr 2024 12:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1713035104; x=1713639904; darn=ffmpeg.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=czFQrj5OhgjtMGRmj/CbgkMnVJYVHXmu+0ipteCcbjc=; b=q6P+3Kg1Tp/0nhCqaVwsrhV/m6GCU0l+v35ZDE6E0V5NO1RIYLAg7wefpea21kUTvF QdRwlbgzmo3b38iwcWQ1s4U6peHbjGGHxwFg56bpB8p5AF58n7megv/cGv62RiXa+EDQ uyLe1a50aApkTiWnC6xmQH3xFauxOKpRj2c44uNOTzu1RP7tSKpohjHSoj88pxg/g7Fn PHiY7SmHNZvpobuSFhQ6+yQFVvjwaWsdMj0VESMMpcLtHdG9w+V85DyRQRoz1HS+eJmw 8yzJ9M25C8f4YvH0yZ8z8gXVXq6nGrEK7PU5xK6tDgDPB/5Jdl5MiESeeyG4FNxALi4e 88xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713035104; x=1713639904; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=czFQrj5OhgjtMGRmj/CbgkMnVJYVHXmu+0ipteCcbjc=; b=F4ya/b/5CJB6Ufj5Z7BqYZMnr+E+Eeztgb5cB+sUR+betlD7S5dclhoiDhRx570MFj l7bQgyeFZ2sKKpHTqiNdQt7XNyCLusC30yebw/DpzKnrnkbFKgrPPEdRfv3u592PTopM 0G/AHdfFThQllNIDrpwc7KQzAPWRTqFGTwOO8IK0DpPeP18z+/e3ESdqeRobaW10E6qB dPcYzurMNaBEWp83MN3aqFUeXR0f3njy8/ZDIN1Hxjp3rus+V5j2S5psXJxFtLVyvoFK Xi5PLoklbozQavSiFWRo93umCvjthbSH8EbjpuXc8kU53/kJhkqMdMmCPCrXpkNmo1Lf rykw== X-Gm-Message-State: AOJu0YyOSQvE6D7JP+mRCx4U1WfjGv8GZtRMMUyYdsXwyC4FQFrpoMmo RSgsr/yANw55JUvuEmYiURfhT28KM2Hand9/bTcx9PfEXqcDNvDUn3IlpXbkhfzhXwhYZgfinXC 5 X-Received: by 2002:a5d:4dcb:0:b0:33d:73de:cd95 with SMTP id f11-20020a5d4dcb000000b0033d73decd95mr4891208wru.17.1713035103665; Sat, 13 Apr 2024 12:05:03 -0700 (PDT) Received: from [192.168.0.15] (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id l14-20020a5d560e000000b00343cc702c56sm7153036wrv.47.2024.04.13.12.05.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Apr 2024 12:05:03 -0700 (PDT) Message-ID: <610f344b-28e7-40f7-ac13-112069a72563@jkqxz.net> Date: Sat, 13 Apr 2024 20:05:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: FFmpeg development discussions and patches From: Mark Thompson Subject: [FFmpeg-devel] [PATCH v2 1/2] lavc/av1: Record reference ordering information for each frame X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 1c/rgScb9DLJ This is needed by Vulkan. Constructing this can't be delegated to CBS because packets might contain multiple frames (when non-shown frames are present) but we need separate snapshots immediately before each frame for the decoder. --- Changes over v1: rename the order hint field and document exactly what the new fields contain. libavcodec/av1dec.c | 26 ++++++++++++++++++++++++++ libavcodec/av1dec.h | 8 ++++++++ 2 files changed, 34 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 824725c031..b4b741054a 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -359,6 +359,25 @@ static void coded_lossless_param(AV1DecContext *s) } } +static void order_hint_info(AV1DecContext *s) +{ + const AV1RawFrameHeader *header = s->raw_frame_header; + const AV1RawSequenceHeader *seq = s->raw_seq; + AV1Frame *frame = &s->cur_frame; + + frame->order_hint = header->order_hint; + + for (int i = 0; i < AV1_REFS_PER_FRAME; i++) { + int ref_name = i + AV1_REF_FRAME_LAST; + int ref_slot = header->ref_frame_idx[i]; + int ref_order_hint = s->ref[ref_slot].order_hint; + + frame->order_hints[ref_name] = ref_order_hint; + frame->ref_frame_sign_bias[ref_name] = + get_relative_dist(seq, ref_order_hint, frame->order_hint); + } +} + static void load_grain_params(AV1DecContext *s) { const AV1RawFrameHeader *header = s->raw_frame_header; @@ -701,6 +720,12 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s sizeof(dst->film_grain)); dst->coded_lossless = src->coded_lossless; + dst->order_hint = src->order_hint; + memcpy(dst->ref_frame_sign_bias, src->ref_frame_sign_bias, + sizeof(dst->ref_frame_sign_bias)); + memcpy(dst->order_hints, src->order_hints, + sizeof(dst->order_hints)); + return 0; fail: @@ -1257,6 +1282,7 @@ static int get_current_frame(AVCodecContext *avctx) global_motion_params(s); skip_mode_params(s); coded_lossless_param(s); + order_hint_info(s); load_grain_params(s); return ret; diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h index 336eb61359..79a0be510b 100644 --- a/libavcodec/av1dec.h +++ b/libavcodec/av1dec.h @@ -53,6 +53,14 @@ typedef struct AV1Frame { AV1RawFilmGrainParams film_grain; uint8_t coded_lossless; + + // OrderHint for this frame. + uint8_t order_hint; + // RefFrameSignBias[] used when decoding this frame. + uint8_t ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; + // OrderHints[] when this is the current frame, otherwise + // SavedOrderHints[s][] when is the reference frame in slot s. + uint8_t order_hints[AV1_TOTAL_REFS_PER_FRAME]; } AV1Frame; typedef struct TileGroupInfo { From patchwork Sat Apr 13 19:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 48049 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp980410pzb; Sat, 13 Apr 2024 12:06:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9G5UDrKNhhDk6BASHiZh/ZdQClMqmIoHWCR5yR33W5sPzaTfNxWet0DXi3EnKVmyprAy59lpPHkDM+na51eemcvRXp7ugbqQmRw== X-Google-Smtp-Source: AGHT+IEqSoL8Q5mP5deoGQe0DW/IMp3ZBbPJ4gzJe+gbBCDkYC7ZwHwbx2Cv2TNhPQ6Riufy70yE X-Received: by 2002:a50:d49c:0:b0:56c:1735:57a2 with SMTP id s28-20020a50d49c000000b0056c173557a2mr5291681edi.31.1713035203807; Sat, 13 Apr 2024 12:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713035203; cv=none; d=google.com; s=arc-20160816; b=D11YhYTFDsD0clYXDacspKH3bDs3IwDOQ88J8t1fK5+UFSGjPYx2zEZVsWu2BheTkU 2uOacGBXpWOSSf2xFUF7g0Sx4QjTAKz8lF25QbTPTZvwxpiDkU52Bj/YjuddZX6csMwA NaPM9hu2wCNYRWOgRK6ECJv4X9KUGpaEyS8oQwIEnGAnmZEX9Pj3Kv6fyPMcGhKLFM6S iJ86GMsvsdYzU41gAsLNobVn2STYSHFzLNZOe/Ct1oNPAZwCP2f0DY/vpCKzi4tsFmo2 MQhr0Ti0SdMyPeFpb7sB7IfPvy3+Hbj47M8OT2NwmwmOMNuRYhfeEf8KCl75DIcwzgvZ SAQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:in-reply-to:references:to:from:content-language :user-agent:mime-version:date:message-id:dkim-signature:delivered-to; bh=GAxJ7Wjv8A9TyRTYUSeEzj7OItOT51EKZppEmG1XfBU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=cCZ7pqBeFuYYqM3DkJhR8RT9u7iJIxkUWZ1KMdpJtIKHvGmNvTmgF6JBN6y7X+B/MR u30LqEDuk0fqp3C1rym6eRok3MIJtWwPX1hWyr7VXB5Lj/LEbkjb9X7lIZPei8dumglm aUtX90TrHSQCafZ2WDhW4IZwdhyIte5Sk3RAIzGDKrQRKEBgMPNXCoo4hMbS7dChFRvL aYGpoYAWJsi/tVgZQ/tR7chteihu4X3Y+1fQuAgAdJsovqaYFWygynr3fiVu45kvkukX 0GXPNeLlssWm5C4UbZWeynNs9BoGVSLl1ldo+YLdMB+EsyuMEC9NUzV6eCYaeC/ztHYA Homw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=20Mo3OOq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m19-20020a50d7d3000000b0056e09e70426si3016142edj.6.2024.04.13.12.06.43; Sat, 13 Apr 2024 12:06:43 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=20Mo3OOq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6075468D34F; Sat, 13 Apr 2024 22:06:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AC4A168D0CE for ; Sat, 13 Apr 2024 22:06:35 +0300 (EEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4183072951eso3018565e9.2 for ; Sat, 13 Apr 2024 12:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1713035195; x=1713639995; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=GmFNdXeekgBHoZBzXzJ+33H6q6sjgRwpk/uH72ZmUbU=; b=20Mo3OOqQZWJ4KG+UuJzAZbj4QifFji0Wh2SeEsjyRHvirl6R6d74zDcPjoFng0XBf 83OtAPkSxB4BXWysUtOQsDbO733T6YdBC6F0+XRYk76dVThL/9U0J7oDmqs6MFWwdGyE KH6r2NXEqtBwVrQQyDEvqtonZ6Wm/v6IIwNH27V8Y1mveht/Q5tr5Zyku4xNBH9Z/XRg c0DvbJp5YmZx+iv13JXIrshRuoOZRnFJ++2dnAdSs+HzJ2/hRW3vvAIqYNTcQGB+DapH jDg4pfaMgYQ04Z3zgQw9CO5TyvlzS5Dk0YZEDe9t+To6w403/17FTFnIiHFPMu9jYN+n vPiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713035195; x=1713639995; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GmFNdXeekgBHoZBzXzJ+33H6q6sjgRwpk/uH72ZmUbU=; b=Qlq2og+E+63hNPITe/NgpD4xo1dIsgnyy2dVDg5AspMqUicqKGGZ/dS/x9mBQ+Aj36 v6xmoi1lXKiWppMF1+eua8YWrzwzOLMUj1Ne9wclH7IOUsqZJ7zGNbshpRLOJqPUC6kj BwEZTqZ9TacpZeHLodWYbvad4nEkoYyB0in86m8xO1FF0BjqU8xC+do/XU03fXL19XuS PVupsKpFZQvB2moQihLE1ffjxz9LNHiEopbADzlWAYgrQ3OzHqhpbGBu3Car1Zsd7kEq tJdFhrhMKow9P/CTVMNCwcPAgBCMQJhTrfKiLr8/TRA9dNZv15A1N3lqPzeaIj35U1yL J++Q== X-Gm-Message-State: AOJu0YzXsxZZ9FQQxe85/0L51aD1PR66ffVskuF7qAhHxS0B4WEBsQGC Z4NVuZjCY3H3gpHf413CdNv1BAnLUx/+zYY+VzJTiggGvafXOsSM2WhwVdIQvV423AgoELM7KSx Y X-Received: by 2002:a05:600c:1d08:b0:416:a44e:5f70 with SMTP id l8-20020a05600c1d0800b00416a44e5f70mr5844701wms.30.1713035194638; Sat, 13 Apr 2024 12:06:34 -0700 (PDT) Received: from [192.168.0.15] (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id l14-20020a5d560e000000b00343cc702c56sm7153036wrv.47.2024.04.13.12.06.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Apr 2024 12:06:34 -0700 (PDT) Message-ID: <59cc87d5-df14-44fc-b7e4-a5e6728ab478@jkqxz.net> Date: Sat, 13 Apr 2024 20:06:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Mark Thompson To: FFmpeg development discussions and patches References: <610f344b-28e7-40f7-ac13-112069a72563@jkqxz.net> In-Reply-To: <610f344b-28e7-40f7-ac13-112069a72563@jkqxz.net> Subject: [FFmpeg-devel] [PATCH v2 2/2] lavc/vulkan_av1: Use av1dec reference order hint information X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: dKunE68Mwa/d --- Changes over v1: fix the OrderHints field as well; move things into the loop over reference names rather than the loop over reference slots. libavcodec/vulkan_av1.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index c9e398eaec..fcc9a4f03b 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -76,7 +76,7 @@ static int vk_av1_fill_pict(AVCodecContext *avctx, const AV1Frame **ref_src, StdVideoDecodeAV1ReferenceInfo *vkav1_std_ref, VkVideoDecodeAV1DpbSlotInfoKHR *vkav1_ref, /* Goes in ^ */ const AV1Frame *pic, int is_current, int has_grain, - int *saved_order_hints) + const uint8_t *saved_order_hints) { FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; AV1VulkanDecodePicture *hp = pic->hwaccel_picture_private; @@ -242,7 +242,6 @@ static int vk_av1_start_frame(AVCodecContext *avctx, const AV1RawFrameHeader *frame_header = s->raw_frame_header; const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain; - CodedBitstreamAV1Context *cbs_ctx = (CodedBitstreamAV1Context *)(s->cbc->priv_data); const int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain; @@ -272,7 +271,7 @@ static int vk_av1_start_frame(AVCodecContext *avctx, ap->ref_frame_sign_bias_mask = 0x0; for (int i = 0; i < STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME; i++) - ap->ref_frame_sign_bias_mask |= cbs_ctx->ref_frame_sign_bias[i] << i; + ap->ref_frame_sign_bias_mask |= pic->ref_frame_sign_bias[i] << i; for (int i = 0; i < STD_VIDEO_AV1_REFS_PER_FRAME; i++) { const int idx = pic->raw_frame_header->ref_frame_idx[i]; @@ -294,7 +293,7 @@ static int vk_av1_start_frame(AVCodecContext *avctx, err = vk_av1_fill_pict(avctx, &ap->ref_src[ref_count], &vp->ref_slots[ref_count], &vp->refs[ref_count], &ap->std_refs[ref_count], &ap->vkav1_refs[ref_count], - ref_frame, 0, 0, cbs_ctx->ref[idx].saved_order_hints); + ref_frame, 0, 0, ref_frame->order_hints); if (err < 0) return err; @@ -491,8 +490,14 @@ static int vk_av1_start_frame(AVCodecContext *avctx, } } - for (int i = 0; i < STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME; i++) + for (int i = 0; i < STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME; i++) { + ap->std_pic_info.OrderHints[i] = pic->order_hints[i]; ap->loop_filter.loop_filter_ref_deltas[i] = frame_header->loop_filter_ref_deltas[i]; + ap->global_motion.GmType[i] = s->cur_frame.gm_type[i]; + for (int j = 0; j < STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS; j++) { + ap->global_motion.gm_params[i][j] = s->cur_frame.gm_params[i][j]; + } + } for (int i = 0; i < STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS; i++) { ap->cdef.cdef_y_pri_strength[i] = frame_header->cdef_y_pri_strength[i]; @@ -501,14 +506,6 @@ static int vk_av1_start_frame(AVCodecContext *avctx, ap->cdef.cdef_uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i]; } - for (int i = 0; i < STD_VIDEO_AV1_NUM_REF_FRAMES; i++) { - ap->std_pic_info.OrderHints[i] = frame_header->ref_order_hint[i]; - ap->global_motion.GmType[i] = s->cur_frame.gm_type[i]; - for (int j = 0; j < STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS; j++) { - ap->global_motion.gm_params[i][j] = s->cur_frame.gm_params[i][j]; - } - } - if (apply_grain) { for (int i = 0; i < STD_VIDEO_AV1_MAX_NUM_Y_POINTS; i++) { ap->film_grain.point_y_value[i] = film_grain->point_y_value[i];