From patchwork Mon Jan 24 17:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33799 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:e71a:0:0:0:0:0 with SMTP id b26csp494828ioh; Mon, 24 Jan 2022 09:00:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUZbz2lQGI/ib/+DhZ471G8SFJKsTBm7QULt88A/ja3OL4W+bGpj0Cv20c/xd7P5aTsphA X-Received: by 2002:a17:906:5248:: with SMTP id y8mr12813850ejm.365.1643043652438; Mon, 24 Jan 2022 09:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643043652; cv=none; d=google.com; s=arc-20160816; b=h/sBlc5DRDCZXRfnROykKauCgGnATAWTveAiGaBwe0KkipcQAioPArvNzhdcPExkfC V7EEz88RiOofHxm4QsY2ygOndq1T8t9M4mrESrhwiUxcxup75uNS2tWPBC8U5qnTL351 0gxGwgoJvuzbVWqnnU0lSyq9Bhgyq5HDkL5HE5hABZFzBSAGM6YUrM1HquSWHXFREjZB N02j7PHVzEgU8qHUd4pgJKU3Ob5LO4cAJr7nWc6+fa3jkjfa3Qrqhx1xdF9I1d1wpG+m Uc7zskWP7H8aK+LeMtpyodONwF/neJ57CK8HglUmzrnIK8+uO8CKnhfRE+SkW2XIWGkt uTyQ== 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:delivered-to; bh=HqK+wT521lMA3iixIo3+1jPzXhc9DUbbB1trniJUAto=; b=hsP3qFE1TPd/CBDiB7C1M1s+l3J2M+CStzkx9NkqmzG5XBXHquNPX45sn4U7X2+Jgz E9w21R3ni7vxOUe595EY6p1rxxuQXx77p60xGyQAzktdTan94ftWWUJ2ZoikHU++/pN1 4xyzY8lIlc2JWcZPZHJZwQGXNU2ka/8ypLZrL0vkIOj5ksVSAZxWuXlY/AlziKVLQ7tr 8I4lnROEKz/XZW7z6eSk8wVg+k1xQpTYanv6LgxHEoodzPZqcYlqnZ7fitTgsoCyvyB2 jJ6knLcEf3GiAe+aMMIvGCKIirMXeL4ZCXWf36XyGRBSlxUDnxXNpxNsKD9pBi7Mp1Vz zrew== ARC-Authentication-Results: i=1; mx.google.com; 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 fy1si10168674ejc.492.2022.01.24.09.00.51; Mon, 24 Jan 2022 09:00:52 -0800 (PST) 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; 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 C3D5D68B0E7; Mon, 24 Jan 2022 19:00:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7883F68B094 for ; Mon, 24 Jan 2022 19:00:31 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E354B24017E for ; Mon, 24 Jan 2022 18:00:30 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id rOAhvudiPT_J for ; Mon, 24 Jan 2022 18:00:30 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C846A24017C for ; Mon, 24 Jan 2022 18:00:29 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 9CB193A0631; Mon, 24 Jan 2022 18:00:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 18:00:05 +0100 Message-Id: <20220124170014.17189-4-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124170014.17189-1-anton@khirnov.net> References: <20220124170014.17189-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/13] lavc/h264: replace MAX_DELAYED_PIC_COUNT with FF_ARRAY_ELEMS where appropriate 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: WdUFDHVdlgno --- libavcodec/h264_refs.c | 2 +- libavcodec/h264_slice.c | 2 +- libavcodec/h264dec.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 93526b11e2..94b473257f 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -729,7 +729,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) h->poc.frame_num = h->cur_pic_ptr->frame_num = 0; h->mmco_reset = 1; h->cur_pic_ptr->mmco_reset = 1; - for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++) + for (j = 0; j < FF_ARRAY_ELEMS(h->last_pocs); j++) h->last_pocs[j] = INT_MIN; break; default: av_assert0(0); diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 4833282191..d6d4497fc9 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -428,7 +428,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst, copy_picture_range(h->short_ref, h1->short_ref, 32, h, h1); copy_picture_range(h->long_ref, h1->long_ref, 32, h, h1); copy_picture_range(h->delayed_pic, h1->delayed_pic, - MAX_DELAYED_PIC_COUNT + 2, h, h1); + FF_ARRAY_ELEMS(h->delayed_pic), h, h1); h->frame_recovered = h1->frame_recovered; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 7f10026340..3706ae0e31 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -308,7 +308,7 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h->sei.unregistered.x264_build = -1; h->next_outputed_poc = INT_MIN; - for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) + for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; ff_h264_sei_uninit(&h->sei); @@ -445,7 +445,7 @@ static void idr(H264Context *h) h->poc.prev_frame_num_offset = 0; h->poc.prev_poc_msb = 1<<16; h->poc.prev_poc_lsb = -1; - for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) + for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; }