From patchwork Thu May 18 14:10:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 41713 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp532077pzb; Thu, 18 May 2023 07:11:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5m7xwL/EB3HYCYHyfkN3KXqHpGrNJTI1TSfljePulJ+q9p8Vo7UVq28oofyqIWV9CEQ7d0 X-Received: by 2002:aa7:df8b:0:b0:50a:276f:a3ba with SMTP id b11-20020aa7df8b000000b0050a276fa3bamr2738412edy.34.1684419064483; Thu, 18 May 2023 07:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684419064; cv=none; d=google.com; s=arc-20160816; b=rbNxMn3TnHDLgGMjKlt4jMGDx6lK3o2dXitncCDKK6SPcwWbyCtDYj9iLuG9T2VuDD 7phMsQRkjyk/97eGNQuWW8zFZFgA9wI+t3qFs5i4iz9Efi8aE4MxMZelI8uDKzCoJNGK 9UEj3NSZ+A5Ql4Bt0svhOCqxkwnXamgv0afqgUTLSnPtMwVVhPYqNZKSHlHB/ssFSFaF SLwhYhkQDFFl61nweG/fva99HbjIYGrzx+GIA/yhAgV7nhK4OdHgAKfdHeHWYtCsZKNu MOnmFMuY27QFh+4xTuzscMAcRBtp2oKWZJVeeMrU3pxCQVpWDeME47Vn3r5G4efEHMq5 KT0g== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=4iuQfaDhvTys9KmrsUTyTdEznKV5qnFegYHnppCsnSM=; b=FMkLkdIC01uNY92jihk+jkVy1fgiW8qvRdJ3TZ45NIEpKiarY6kSEVLMXjfAqKenPN 6vbMLf+dOx1dZ4/wWrvehFFfLO0AM4fnL0oZzqQyy8q7o2wg2R5qNmvU3nx4lAlc0PS4 Be/NisiE2kiOvTAe8gLnbsbMdeR51aMVGTVGaR5JvN62IEwSsk97poT6jKbOHkIIHelk oqUpCJcF44VfVtW5fjmvQE6tR/osmlUQOxPfxnZAKMJD6eIlwu3Svp4jDpiRVPLM9tgG X9q6VDdRqDy3OZOE5Ark8hHQZ5yHfWsc0Dloi4fvE/PozklUzYCyCvjJ0dPIbzLOdBla ipNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=XP2HogQJ; 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 p25-20020a056402075900b0050bc951060fsi1060890edy.597.2023.05.18.07.11.03; Thu, 18 May 2023 07:11:04 -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=20221208 header.b=XP2HogQJ; 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 EA7FA68BA65; Thu, 18 May 2023 17:10:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CCF7668BA65 for ; Thu, 18 May 2023 17:10:52 +0300 (EEST) Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6aaf52ff35bso2103942a34.2 for ; Thu, 18 May 2023 07:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684419051; x=1687011051; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=kzVYnMkFFWlrJpwxLVAHBYfK+R7G0R601JSWwy1u0HY=; b=XP2HogQJRSa8uK1MekAO0lbg+9ARmm99EBasMr5W0BCjJV26BK/mIHk3nz026FHciX q77tyUK6u5xgTUiqyMT2PV4XRzCtwr0T/e+E4YyKSJr2roAqf8Z/RXmKp5oxW20yOtr+ Mjc6dJD7aLN2D6Gc75KDrrSP4S5VV6ONvR7yfcYraNEFHkXqyu3GM7FrQdc71GqHC13Z pQsG91iZ+/j7tmcUZgmhzB9rhosfeT4bG2wUy+WkyqvhdXIuzlIYhHr+mscRk4aqZaPP eR3YVSBVyO4CCHfpLV4ft4QL2N5Xv10OW6UZ2blpMR0Q41DLVZGDTz3jtv6sfZCVHg1a LIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684419051; x=1687011051; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kzVYnMkFFWlrJpwxLVAHBYfK+R7G0R601JSWwy1u0HY=; b=GNx99jdZlmzjujghrnUGH4+QteK+5Xu2onBuusBfjX93QgOYIjLmk8+HKDrz+x8FHC MzxBLgARbsIhZWJey6V6FdCtFe9CckhFI4a3HkrgC468/1RR731e8wqDsSAWzTbVXQ2W Fl/axEwW9irM51KjfzuxeUzOt+bEZooQU8N+woCBBryx5cEBWyCdwjJ8FdrF60sDcUq3 4p9zr9HcfLn98LfCWaY1h4g7K+f3CyMfc7rRB6ZhOcB6Z//p6izO3j3SQksYAbZUnl6U naysYr6ZGyicawo7nfgu8WjldCJdl/oDPJI01CBrWkN2H68Yu3PfhkXoKCKhPf3rtHTo R7oA== X-Gm-Message-State: AC+VfDylQgBHNjSVaIU7KEaC7c3lkJ1KU0Ba7iqZZZYGxR6pyJ+O/Euy Y4MZKJq6ktWW7pkGPZPYSgpZkfF9m+o= X-Received: by 2002:a05:6830:11c2:b0:6a6:4220:70b4 with SMTP id v2-20020a05683011c200b006a6422070b4mr1268995otq.21.1684419050660; Thu, 18 May 2023 07:10:50 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id h12-20020a9d61cc000000b006addf2a4110sm679450otk.55.2023.05.18.07.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 07:10:50 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 May 2023 11:10:50 -0300 Message-Id: <20230518141051.59761-1-jamrial@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/av1dec: use av_frame_replace() 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: 98AWZ9HiBZks Signed-off-by: James Almer --- libavcodec/av1dec.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index d46ee48335..f900a6d0ed 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -596,10 +596,13 @@ static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f) f->coded_lossless = 0; } -static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *src) +static int av1_frame_replace(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *src) { int ret; + if (!src->f->buf[0]) + av1_frame_unref(avctx, dst); + ret = av_buffer_replace(&dst->header_ref, src->header_ref); if (ret < 0) return ret; @@ -609,13 +612,13 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s if (!src->f->buf[0]) return 0; - ret = av_frame_ref(dst->f, src->f); + ret = av_frame_replace(dst->f, src->f); if (ret < 0) goto fail; if (src->hwaccel_picture_private) { - dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf); - if (!dst->hwaccel_priv_buf) + ret = av_buffer_replace(&dst->hwaccel_priv_buf, src->hwaccel_priv_buf); + if (ret < 0) goto fail; dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; } @@ -1092,8 +1095,7 @@ static int update_reference_list(AVCodecContext *avctx) for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) { if (header->refresh_frame_flags & (1 << i)) { - av1_frame_unref(avctx, &s->ref[i]); - if ((ret = av1_frame_ref(avctx, &s->ref[i], &s->cur_frame)) < 0) { + if ((ret = av1_frame_replace(avctx, &s->ref[i], &s->cur_frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to update frame %d in reference list\n", i); return ret; @@ -1236,10 +1238,8 @@ static int av1_decode_frame(AVCodecContext *avctx, AVFrame *frame, s->raw_frame_header = &obu->obu.frame_header; if (s->raw_frame_header->show_existing_frame) { - av1_frame_unref(avctx, &s->cur_frame); - - ret = av1_frame_ref(avctx, &s->cur_frame, - &s->ref[s->raw_frame_header->frame_to_show_map_idx]); + ret = av1_frame_replace(avctx, &s->cur_frame, + &s->ref[s->raw_frame_header->frame_to_show_map_idx]); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to get reference frame.\n"); goto end; From patchwork Thu May 18 14:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 41714 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp532433pzb; Thu, 18 May 2023 07:11:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7dxWvDUrkLr1BPHJ71S3qZ+iYJoN8L5Ke5BJA0oopc3k5ZApunK6E1k7yEeVsz91/IpolN X-Received: by 2002:a17:907:944d:b0:94e:fa56:a74f with SMTP id dl13-20020a170907944d00b0094efa56a74fmr39301317ejc.14.1684419083698; Thu, 18 May 2023 07:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684419083; cv=none; d=google.com; s=arc-20160816; b=m+vOXS/H0KDvTy7O5nOGfnLbp264C92doNZ2G/lKlIdro9wbicl0Rt3AC0/GzT0K3y YvqxJ+4GvHg89EkhhqT6Z0vIehIQNe2yYUc3sKndXdtfc+sS7liFGF6rk+xpvzC0zC5M MlPAI1XgVWjXvmU1ro6VQAFQde0AYVK+xX0+684t9Bd/+TUDyj1DsTHaCuKJFdQAhWZp MSQUMCd5QNDvM3zqErciWDYU/s47HSr6crAPNV89LwOwpM+12v11J1DGdy7j5lCkSrhU BP0XjcyVtGnpFTdrasOyZ9xqONm3Z2r2BYm8HovT19d0hcHrhPqGW0HBVkidQmPzkots JK5g== 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=Y1IMDGloYe5OVJMnJL0iiOxrh6EyhQCoMPV6zpoGBnE=; b=x59ZAKGjCQdcwtc7JGMZqGYP7SRRu+a0sI/gpEpWcp19FQuFbjfoYVB1s+GR6NYPoq Ps/AoLz6KbQo/wmqtZY191lfbn0jCXjUx6VO/ELFx2JGgGUKUpckH4eSYZTgN75kr8eK zPUEX8ZEbYq3MRBc5eNzxr/Ti5gI1FfHXgnvOkvY9a7ibkyATb+GrOpcPwj4cj5aIv68 0dqdUsevndy6qBZlwRJzF86P4FJGjUW0xTcoj33lmYNHyDf8F5tQRF3ymfuit9R6cLGu 3DkjQ0NaxGuxBN3w/BuXYbpAKlsrpliz5c1vX0uEQMmvUDgbg2dhgC3Etr150L9vvwAU pHwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=hl2JmDLW; 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 s20-20020a170906c31400b0094efb4f4271si701825ejz.434.2023.05.18.07.11.14; Thu, 18 May 2023 07:11:23 -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=20221208 header.b=hl2JmDLW; 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 43D2B68C174; Thu, 18 May 2023 17:11:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 803BC68BEE0 for ; Thu, 18 May 2023 17:10:53 +0300 (EEST) Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6ab113d8589so1791266a34.3 for ; Thu, 18 May 2023 07:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684419052; x=1687011052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Wm/967PSEYbVQyIAQTOtAv6PruIBMOKlohk2udTjOKI=; b=hl2JmDLWKvbaif0CxYLgt1J4uB5SMlJ64qoKZ56BF+0ie7jdsUrZWJMtUDS+0RF3et 4bno6X5XTTHfj6dh/AA2c1sgJdAYebCJ2GlIeV0TMILU0M7O8TcnFn/z+gO/f064k3xO 8y98/HF+XuV7btcgF+fagxz/pXYtH6hLdlilmwY8W+K7UpnUCFBnafBovFDPOF8zM1jD uAViBwJBH9W2BHrZrtW1DBU+yTEEDitkhEuLmNsZ7dgnmi3pizBRYSMPc3PK0Wotu7EA RDkF9iWG/sFYwTByf0O0mBNlOY2dOSKA+FqKK5cUWneHHoHJ7dC9Hvg7sp7iaimOaOOd I9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684419052; x=1687011052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wm/967PSEYbVQyIAQTOtAv6PruIBMOKlohk2udTjOKI=; b=Xad505n9gH1bdDUgAVgy71fQdQRW4tSdO+Sivj2KB/NajxTlN5xPVRVF53Hdx3H3Xj 1Ml4oUU2jcHJaWDRQIOsLWcUe78qi0g69fkDZdPn39h5LNm+bZbCWRUG7hdB845vMIui ziTq0nCGlxnDZrQslBEKle3trNH8rB3zlu8DHISbHpvu/Hfg3rTnifZAErYz+3VXovMl a1ZOUApTc3z/fFBpAF17AVQYWuyb6iRjXHNOG2x9uXBCGwyjYJEcjuQx8yBrtufBpKXJ WQcv+mLdLU6H4Jt/JVzXpYJm2ipmYsCvtTjIyaLl/vEEzH0U7zn+ftCYXCTe3wdJr3A7 ivKA== X-Gm-Message-State: AC+VfDz01Hup9//ZIs9H9+FCig57AdZW5np7sfs4aUCSCiU21t9uruG0 O+cMui93Iy0NtbKHb4fwj5k2a3utaHA= X-Received: by 2002:a9d:6ac9:0:b0:6a6:82f:6189 with SMTP id m9-20020a9d6ac9000000b006a6082f6189mr1443459otq.36.1684419051849; Thu, 18 May 2023 07:10:51 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id h12-20020a9d61cc000000b006addf2a4110sm679450otk.55.2023.05.18.07.10.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 07:10:51 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 May 2023 11:10:51 -0300 Message-Id: <20230518141051.59761-2-jamrial@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230518141051.59761-1-jamrial@gmail.com> References: <20230518141051.59761-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/h264dec: remove the last few ff_h264_ref_picture() calls 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: daehBgg3eWLD Replace them with ff_h264_replace_picture(). Signed-off-by: James Almer --- libavcodec/h264_picture.c | 53 --------------------------------------- libavcodec/h264_refs.c | 3 +-- libavcodec/h264_slice.c | 3 +-- libavcodec/h264dec.h | 1 - 4 files changed, 2 insertions(+), 58 deletions(-) diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index dcaf0fdb0a..9da3b06ce1 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -89,59 +89,6 @@ static void h264_copy_picture_params(H264Picture *dst, const H264Picture *src) dst->needs_fg = src->needs_fg; } -int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) -{ - int ret, i; - - av_assert0(!dst->f->buf[0]); - av_assert0(src->f->buf[0]); - av_assert0(src->tf.f == src->f); - - dst->tf.f = dst->f; - ret = ff_thread_ref_frame(&dst->tf, &src->tf); - if (ret < 0) - goto fail; - - if (src->needs_fg) { - ret = av_frame_ref(dst->f_grain, src->f_grain); - if (ret < 0) - goto fail; - } - - dst->qscale_table_buf = av_buffer_ref(src->qscale_table_buf); - dst->mb_type_buf = av_buffer_ref(src->mb_type_buf); - dst->pps_buf = av_buffer_ref(src->pps_buf); - if (!dst->qscale_table_buf || !dst->mb_type_buf || !dst->pps_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - - for (i = 0; i < 2; i++) { - dst->motion_val_buf[i] = av_buffer_ref(src->motion_val_buf[i]); - dst->ref_index_buf[i] = av_buffer_ref(src->ref_index_buf[i]); - if (!dst->motion_val_buf[i] || !dst->ref_index_buf[i]) { - ret = AVERROR(ENOMEM); - goto fail; - } - } - - if (src->hwaccel_picture_private) { - dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf); - if (!dst->hwaccel_priv_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; - } - - h264_copy_picture_params(dst, src); - - return 0; -fail: - ff_h264_unref_picture(h, dst); - return ret; -} - int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture *src) { int ret, i; diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 50bbe94917..d876a19f73 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -571,8 +571,7 @@ void ff_h264_remove_all_refs(H264Context *h) assert(h->long_ref_count == 0); if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) { - ff_h264_unref_picture(h, &h->last_pic_for_ec); - ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]); + ff_h264_replace_picture(h, &h->last_pic_for_ec, h->short_ref[0]); } for (i = 0; i < h->short_ref_count; i++) { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index be7a8e0b5a..0520473dc7 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -521,12 +521,11 @@ FF_ENABLE_DEPRECATION_WARNINGS return ret; h->cur_pic_ptr = pic; - ff_h264_unref_picture(h, &h->cur_pic); if (CONFIG_ERROR_RESILIENCE) { ff_h264_set_erpic(&h->er.cur_pic, NULL); } - if ((ret = ff_h264_ref_picture(h, &h->cur_pic, h->cur_pic_ptr)) < 0) + if ((ret = ff_h264_replace_picture(h, &h->cur_pic, h->cur_pic_ptr)) < 0) return ret; for (i = 0; i < h->nb_slice_ctx; i++) { diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 9a1ec1bace..f9b806e7c6 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -781,7 +781,6 @@ static av_always_inline int get_dct8x8_allowed(const H264Context *h, H264SliceCo int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup); -int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src); int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture *src); void ff_h264_unref_picture(H264Context *h, H264Picture *pic);