From patchwork Sun Aug 8 22:56:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 29367 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2364598ioh; Sun, 8 Aug 2021 15:57:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWEPstYdtxFC85BGTerYSgNaAaaNIKzEyCLSpl/qnDffqqCPBWqd5MMTIoCXOwkSXIHwgB X-Received: by 2002:a05:6402:648:: with SMTP id u8mr26849404edx.162.1628463434473; Sun, 08 Aug 2021 15:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628463434; cv=none; d=google.com; s=arc-20160816; b=gdEh3g4o9QdBV4Damf/PRiznCigBNOU73LFJ6kA5ps5hXX2lTfLhtOil/PzilauBiv WLU82DIAv+CsLWowMQWjmExL1F9OlyVzbLBjdME3grH1QDo5awilcdXY0StQULwTwRNP limL9cQWVuQYb4dlBeJLCPsPWjKPHFCDfOiumGvpXVN2NB4Jh9XrIqtwzuU0fi+uCzL/ IV9fZashJ6hzpPIYNs08+EcW9G8314PBT7DhbaQf4dZ5p1YDX1hWwldXN1k5SvF+Rt+p Oj01oce6UxybjNO32vIGpiahxqGEl9Ijzx0+aB8Q5mwr8zmVTc2PNm5MkamsxYTEodxk OD+w== 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=QBrAoatphOuSGiXY28p8yo2883MgdLp9OukJT7pUntU=; b=XI3AkjsxtPg9OmC+l7O+gS+YYhYGLBUDfiguJyrG8aeS8O8hi2D79a4DUQbZeW1SiW pLwa5CZDFKWVy6CmiBDFynMSCf4Fq6e11C6zGbPLuLIXAwgM3joculND+Ms4YE38PeIA 0ukEKA8ExZlfTT+BatEOEPJ0TPmozYSD9kWRyBLYSeH4uAvzO4DVH+WNiAjH62VLbSG5 bI0LgYC5oVPL9Y3kkdjuxX1N/IxbGnJoaOiy22zYkvHzro2Mqim+0FslFAuBoXHstXWG 0WH8cG1edqF4X3N5GCjsuUjd983Df1PeS/Bv4/q2f0ig43zmD8OrVRwdh/YmMsPfvRrE LwDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rUAKfHzK; 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 dk3si9115253edb.202.2021.08.08.15.57.13; Sun, 08 Aug 2021 15:57:14 -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=rUAKfHzK; 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 528AC68A44A; Mon, 9 Aug 2021 01:56:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 07F3668A408 for ; Mon, 9 Aug 2021 01:56:49 +0300 (EEST) Received: by mail-pj1-f53.google.com with SMTP id a8so25025659pjk.4 for ; Sun, 08 Aug 2021 15:56:48 -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=lx6HfkDvIGNvpuFg/n+L/RLRDF2wWTLHq1QdGfW+Aic=; b=rUAKfHzKVNOrgW4XgdTtFHadk7qA703HOYFvgqYN2Sdmoz6W3fw7WMHVtm0TsEA81G MES39ptc/07lbeyZoBZmLj+oEHFSkhkRUaPC6ch55LbTZXOQJ1oDqlGx84fp9XcNElRr XaVVbnC++WNEUm7iXChO37BzpsXqS6rYLQwgra/zsxatjv4sp7P9WfgQP0kSzTfo8FrZ qCNSltCSWszpKyPhLhziDWc+HzjWsWyHp5kO2AIOHNov9RLCZB8kFjRtGtOouhPp0/lp kE3NNxZkbQbMC0lFNOswRdmBWJB4WJx0RKC4FV5lpS2/Rf2Xm3/g453hagy6VpsjlJ0q k08Q== 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=lx6HfkDvIGNvpuFg/n+L/RLRDF2wWTLHq1QdGfW+Aic=; b=AO83VV0M+EM+7V6kKEGTniGZGTogIjIc7+gug51mce2w+QLTqXisQQdlyy2Fq4VAnY Rn1x+uOynmT8G0MAvTITBNBg8nKJ3wPqh22bS14Ig0WU3iQd+PV1JT5vSwEIErHeoEcI NaKw+l1zvETxJDm795Dtl3bzI8POjL5baFJeElJIAkTQ4fFTQ5vLFpDaTxKmvxl4D4lz sB8VDM1z6Gr5h3sFx0Qivs90uxp2ibx88CVvphZrJTLJP+N2+bAz5XDxju4zZs8M+u5M W2fW88EQgXQrTYHotshR/TIlS1nHTAkz+M/vB0g8SojjaiV+XQW2KF3PgFBzNOk9PL0T 5S4Q== X-Gm-Message-State: AOAM532opxZo8TJ9uXXE7qJcSgMzsBhdxCvPpsPR0HOP0h1lK95mr1NJ 3lCnm8V91C3T/YFxMUzGIjjwBwR+TeM= X-Received: by 2002:a63:100e:: with SMTP id f14mr51578pgl.188.1628463407134; Sun, 08 Aug 2021 15:56:47 -0700 (PDT) Received: from localhost.localdomain ([191.84.233.71]) by smtp.gmail.com with ESMTPSA id t9sm22337491pgc.81.2021.08.08.15.56.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Aug 2021 15:56:46 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Aug 2021 19:56:12 -0300 Message-Id: <20210808225612.11600-3-jamrial@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210808225612.11600-1-jamrial@gmail.com> References: <20210808225612.11600-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/h264_slice: use ff_h264_replace_picture when updating thread contexts 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: FfEiTsYWWv5H Signed-off-by: James Almer --- libavcodec/h264_slice.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index a31e804620..0d7107d455 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -379,19 +379,15 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->droppable = h1->droppable; for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) { - ff_h264_unref_picture(h, &h->DPB[i]); - if (h1->DPB[i].f->buf[0] && - (ret = ff_h264_ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0) + ret = ff_h264_replace_picture(h, &h->DPB[i], &h1->DPB[i]); + if (ret < 0) return ret; } h->cur_pic_ptr = REBASE_PICTURE(h1->cur_pic_ptr, h, h1); - ff_h264_unref_picture(h, &h->cur_pic); - if (h1->cur_pic.f->buf[0]) { - ret = ff_h264_ref_picture(h, &h->cur_pic, &h1->cur_pic); - if (ret < 0) - return ret; - } + ret = ff_h264_replace_picture(h, &h->cur_pic, &h1->cur_pic); + if (ret < 0) + return ret; h->enable_er = h1->enable_er; h->workaround_bugs = h1->workaround_bugs;