From patchwork Mon Jan 24 17:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33798 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:e71a:0:0:0:0:0 with SMTP id b26csp494664ioh; Mon, 24 Jan 2022 09:00:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuiJCxOwqOZO26AP80fd9SUjPdd+9USefpvqQioFLdXvIEgbCibT7Zuu3ATV+axOLD1KuU X-Received: by 2002:a05:6402:3486:: with SMTP id v6mr17141500edc.390.1643043641230; Mon, 24 Jan 2022 09:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643043641; cv=none; d=google.com; s=arc-20160816; b=kcYKVK8/CuqIpATZjizBbtUW5YA8RdDjPden+vA0165CfEvSbORTa6B3OVNOHrsWXU PQkYWoZ05w9HGtkw/og6k/JjZKZtNk9o6ysh265L2PrHL4pmS3KDRncZg5Z6jY5EbuKn Ha2HNL8FAIYv2k8qQ6Cvrc0nZTw+UCzPulHYvWvtLG2AazKZeph5/Kl1yRv0G1WjR5uc zM8C769FTdhlO1NkCAga5kbig21Y90aqT9snoihaDkvUaJDQpz95LunXQtdpt2NYGGZS GCPXr+Udk4Oqty4Dp15YcDiQ50svTiJ0byS20YUHZ826xovzZUEw5f8S9oOryUXwg+2q r2Pg== 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 :delivered-to; bh=dnvEH+DnnJ7qoUJyG9+f/VwcDdEAnsdBuPgyluJgqK0=; b=LOxPXBr+jfWgLKOcRQv32AXg/epSqzaa00s/PiwYv1gJdJ5i3ecQwTdRHWNR/a824j Sln1Zutm64rP4A9wiAVccamQWYQs2vNsgw5sLYkdnhGDjSs+EMmmCFY5Is+w7H07a1CV oL31YWkH26IPgELiSS2u+/H0MGVAXq21zR0kRVPPjesFE7qcQiuaC40zgFnUVve9ua02 SVppxsEKkSg3rk6OA07CIZZr2PCLJAq4KHRgVQbYNEQro55x0KJWmEO8VJqAn5HuCrJz XdXSYQtvJry4bB+M3xMoY/tq1kXDn4ccvPwsggTX1+3CitTkGvJDkshCu744TQS+teGB j3hA== 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 js12si537240ejc.118.2022.01.24.09.00.40; Mon, 24 Jan 2022 09:00:41 -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 D200668B0DB; Mon, 24 Jan 2022 19:00:36 +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 F10EA68AF55 for ; Mon, 24 Jan 2022 19:00:30 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 657BD240590 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 pIGGjbsM3xyE for ; Mon, 24 Jan 2022 18:00:29 +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 CA83224017E for ; Mon, 24 Jan 2022 18:00:29 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 93BA23A045A; Mon, 24 Jan 2022 18:00:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 18:00:02 +0100 Message-Id: <20220124170014.17189-1-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/13] lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNT 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: heh3GVgSLjuu They apparently serve the same purpose; the latter is one larger and has a comment explaining how the value is derived, so seems more trustworthy. --- libavcodec/h264_parser.c | 2 +- libavcodec/h264_refs.c | 2 +- libavcodec/h264dec.h | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index bb84cea821..e3a11702c5 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -210,7 +210,7 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb, if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag int i; - for (i = 0; i < MAX_MMCO_COUNT; i++) { + for (i = 0; i < H264_MAX_MMCO_COUNT; i++) { MMCOOpcode opcode = get_ue_golomb_31(gb); if (opcode > (unsigned) MMCO_LONG) { av_log(logctx, AV_LOG_ERROR, diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index dae8bd278a..93526b11e2 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -849,7 +849,7 @@ int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb, } else { sl->explicit_ref_marking = get_bits1(gb); if (sl->explicit_ref_marking) { - for (i = 0; i < MAX_MMCO_COUNT; i++) { + for (i = 0; i < FF_ARRAY_ELEMS(sl->mmco); i++) { MMCOOpcode opcode = get_ue_golomb_31(gb); mmco[i].opcode = opcode; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 87c4e4e539..ca3001ec4b 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -53,8 +53,6 @@ #define H264_MAX_PICTURE_COUNT 36 -#define MAX_MMCO_COUNT 66 - #define MAX_DELAYED_PIC_COUNT 16 /* Compiling in interlaced support reduces the speed @@ -331,7 +329,7 @@ typedef struct H264SliceContext { uint8_t cabac_state[1024]; int cabac_init_idc; - MMCO mmco[MAX_MMCO_COUNT]; + MMCO mmco[H264_MAX_MMCO_COUNT]; int nb_mmco; int explicit_ref_marking; @@ -490,7 +488,7 @@ typedef struct H264Context { /** * memory management control operations buffer. */ - MMCO mmco[MAX_MMCO_COUNT]; + MMCO mmco[H264_MAX_MMCO_COUNT]; int nb_mmco; int mmco_reset; int explicit_ref_marking;