From patchwork Sat Jun 26 20:24:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 28724 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp599096ios; Sat, 26 Jun 2021 13:50:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN5RmRyDAmnowqFDFNYxNUgwX70AjfDAV6zLPku0ZHhuJUNpVHAlB4XCnyFsLDJ/CdqVjL X-Received: by 2002:a17:906:2b01:: with SMTP id a1mr17306137ejg.133.1624740607046; Sat, 26 Jun 2021 13:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624740607; cv=none; d=google.com; s=arc-20160816; b=hb5pPULdZmimGVaduoqE7VxgM7UFg/lpwnZiwH30DrRwcgB/r1we+rcLTxM22X16+4 08sOAyakpsoVjFOaIBSotLP0IYzA3UfVvwLlg1c3BnvCqpBsRuSppATpMou2pb5d+/ud +9cWDRvbgTOb7HUcwVGhpplKAPxCQaH4ORD1rkSjLg4WiJ3mClUGrdK37ZW8raqV3Cva EbNKuauukD1Ou/NlIjbQh3b6flsxbsuAxGzBVC1cP6jIq6RxGxJ6SLv5wuIpohkb1hEE INDhVcaSz2t7E+tA0124VLDRA8Xx31bo8UPe698QGPB2rs7RTrCMNGSg8tKSTaJYBsm7 jdaw== 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:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=E9nM8IpVJmS/PHgyn4nrJfRkSdc7EgDyncj6pcHA2Fg=; b=Nh0TM/buV5puj/GN9HaB+xkZtymOfgDp/EUpzbxLdI40H6vZrefwr6dj1kSiF2xmBt k12QUbB4UeUxG+2GSOh8bvb/2ExDqzgE0JSpgBuD7iW8pzdJazZOV2Kiw3tbkbduoLSH 1IBf5Qvnom/D6WLwMruVJ7A45lbPqMzYryZf7ij22E35s4MVFBvpoaQGL1Ruw8I+uD8+ wfnxKsqB9Uo5jb1N8jvHpq4+qXK3PMMIJ+lsZWz3W9OpYIS/vyVuvDQWgA68IHQASOY5 HNftIFG4tRq+Xt3owN7+y6GtSLzDXvWPvZg71pbhQHZqDSLRJWf0ThkNHJQ7nKPTnA1y uXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=YMrP0O4U; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ze15si8478230ejb.641.2021.06.26.13.50.06; Sat, 26 Jun 2021 13:50:07 -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=@gmail.com header.s=20161025 header.b=YMrP0O4U; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ED609689DD1; Sat, 26 Jun 2021 23:50:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 283DB689DD1 for ; Sat, 26 Jun 2021 23:49:57 +0300 (EEST) Received: by mail-io1-f51.google.com with SMTP id a6so17054926ioe.0 for ; Sat, 26 Jun 2021 13:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IT+CTlKg6gwNWSVEr2lH0/PjTyiucJmbCTtW3H/PwUw=; b=YMrP0O4UQuJg60xWgEgCReFvp86O9aFZ18JSljwAy7naigs8bCv0wCBIUUR7U8L5vr a3/ulyqbEJi2VlSxkWLT+YH1oYlj7dvmmuaC2QykyaNslBT80C6IFmEOfL1VwE4ud4sz JMjYTypfnITJpdB1wIX56YvHTlCG+rRdLHiG821wykm8maV/V7OyDMX7mnQ2LUiRsW7O 9qs9MI+Pl2Pq1dtxZLZhaXNChXN9eViNl5IquGCFGct57XvmVCHVGQHroelR7W2f2cOt a3OkgW1mP3dEVildRfMOOpGJWau8dix85PF2lBi23Ttns02597hpnZLX97qXZT8RmMYw KIKA== 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=IT+CTlKg6gwNWSVEr2lH0/PjTyiucJmbCTtW3H/PwUw=; b=W2s4ADRPYyK364UtbbTyRHOWy+jnfV4y8DbST0wCO6Wu2zYUeq5d7AKBf7LPJub8PX sMZYj2GI6ULDa6uRnyc3D7K4gtd2/JG5zg9fh/vpYD7KjUxzy9FHtDW7yu0QPlk+bdAQ zFRWMhyYzLfRqmnWGrGBf/0tdTFQ+cvG/7fcAubP0/oaaxVTTKqgOqD2DPV301sysh26 etRaLq7s4nj6B33VU9Y9pgA+W2Ao8Ow2aYf0X/bAD0ZY4Q/xAYNhaPIw/CIB91fdc7Tf h1aza4FlIdAg/KO/g/bOUST5P4lPa4Oyn4VJZMQBWGK7BFntDf+7fMsNhNVmeiql9dWW XvgA== X-Gm-Message-State: AOAM531BvtHJ0pOZAAA44dI6/lnxdUkp9C/AQ+Rtb7AavF7+OHdCvplT wmmb/XcHGNii6VkfDXhzWOUyjVGffoA= X-Received: by 2002:a63:ea0e:: with SMTP id c14mr15690000pgi.117.1624739084574; Sat, 26 Jun 2021 13:24:44 -0700 (PDT) Received: from localhost.localdomain ([191.83.222.21]) by smtp.gmail.com with ESMTPSA id y34sm9448516pfa.181.2021.06.26.13.24.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jun 2021 13:24:44 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Jun 2021 17:24:15 -0300 Message-Id: <20210626202415.4227-2-jamrial@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210626202415.4227-1-jamrial@gmail.com> References: <20210626202415.4227-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/libdav1d: don't repeatedly parse the same sequence header 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: QPJUFnjmsKwr Look at the event flag that signals a new sequence header was found in the bitstream on supported libdav1d versions for this purpose. Signed-off-by: James Almer --- libavcodec/libdav1d.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 6370ae1fbf..faa1d242c8 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -220,6 +220,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) Libdav1dContext *dav1d = c->priv_data; Dav1dData *data = &dav1d->data; Dav1dPicture pic = { 0 }, *p = &pic; +#if DAV1D_API_VERSION_MAJOR >= 5 && DAV1D_API_VERSION_MINOR >= 1 + enum Dav1dEventFlags event_flags = 0; +#endif int res; if (!data->sz) { @@ -296,6 +299,10 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) frame->linesize[1] = p->stride[1]; frame->linesize[2] = p->stride[1]; +#if DAV1D_API_VERSION_MAJOR >= 5 && DAV1D_API_VERSION_MINOR >= 1 + dav1d_get_event_flags(dav1d->c, &event_flags); + if (event_flags & DAV1D_EVENT_FLAG_NEW_SEQUENCE) +#endif libdav1d_init_params(c, p->seq_hdr); res = ff_decode_frame_props(c, frame); if (res < 0)