From patchwork Mon Jan 24 18:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 33811 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:e71a:0:0:0:0:0 with SMTP id b26csp577893ioh; Mon, 24 Jan 2022 10:49:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyOaLIId5bW8YmCKUqTzaPYUDLpKxEqq6RjRWDeZX8pYLUFRSo1gCMphhem4PHMw0QxGlj X-Received: by 2002:a05:6402:7cf:: with SMTP id u15mr17358026edy.325.1643050145781; Mon, 24 Jan 2022 10:49:05 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z22si5374368edd.620.2022.01.24.10.49.05; Mon, 24 Jan 2022 10:49:05 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=NPWD0iF9; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D995268B142; Mon, 24 Jan 2022 20:48:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069088.outbound.protection.outlook.com [40.92.69.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 207DC68B110 for ; Mon, 24 Jan 2022 20:48:47 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SUNIV/FZIiJr2ZB5MPaRBGbVQqzOin2QHy/2m30d+CMszfewcBlR7LpUp32FvGDMB+f3OuGVR0UjvJIAeeVq7ha9MUgZntvgHSoBsg4Uy+/kLecqoclsYocOC3JnEIPMgydKi18hU+LK1UOpBieLhUsWyOQkCjj7UscnurM2amNPAiw6zXWqiLw9fN8PSj8TLRgM+hSob9Ww8AYAdu3ov8TQNkS3hQIXHOLMzRPqHqHLGOirzuhaz02o8/AVNPINzVdbyqmqVY+ZhLiojKDTYhd4sNd/8JeOwEE9fjzLA+7s0M5X8Poi/6jgJryM142EvuPBGnP44GiOcMSeWvnyIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P45OvWp/EZ78y08EJQsbkeft6dvD+5qrvdgz90B9iWI=; b=IMTJ4ySRLvS5MCbHnOsL3Drffb9GYGy4RERJD/78Ee0AmmDJ7p13JwG98M5KpaYW/vcIeAyJglWePop3NCHcX7RFFQG3QOhRCkV0q+iWIIMka4ZotGg9J5CEqqddBxlT7H/jrgItxZgQJ8P5MLgJxehWo+pboKd62MfAX5cgwWhr75GGV/agRpuLcaf7pfLOQE3LBSEZ9BadD46cu4ORx387GmVBV0Ni6TYkIn9B+9yKnRH40fuBCMGQd8FhXOD4U3BeKU97DwWa7Zs7x/Oh0fJIFCwr8kcU3GwLLLIi02dHxXghBF71mTf7SxUraxC4HvOe8m2XVS+JkkQur5mEGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P45OvWp/EZ78y08EJQsbkeft6dvD+5qrvdgz90B9iWI=; b=NPWD0iF9feB5Gq7fsCvScdZ326czJs5d2Y7BIq3rhnNDt1J4hDYZwD6Hl9t/teW/heiEjOC+jNGcmOByVHiDoFFf/86E7Y/xBwKVQbbPLVjxpGwlDxfcT24fK2gaQjPOBe53tGKVF9K6OuJOaJML11jXTn6pKr6pNziZpnwdn4fiLJ69a5zL6SgD+BAdooW+OGdW1PZ6wssu4NchjTZzkUWLNI/a+a9WM92wrnapBWwpeoAbB/5rBXS1Uv5cCU4slIrQ7Xl0NU3vVwegkXQ7U/OQOexMTOdoHVCkZBn/F3uWkWFhE1BOP5S3OzI7PuJ3tHiPwPNp0EpuoZdWe5rYDA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by HE1PR0302MB2732.eurprd03.prod.outlook.com (2603:10a6:3:f0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17; Mon, 24 Jan 2022 18:48:42 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22%4]) with mapi id 15.20.4909.017; Mon, 24 Jan 2022 18:48:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 19:48:25 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220124170014.17189-1-anton@khirnov.net> References: <20220124170014.17189-1-anton@khirnov.net> X-TMN: [Etb4/6XtVmgQ31bBc09hkmEkNXAtazNx] X-ClientProxiedBy: AM4PR0701CA0016.eurprd07.prod.outlook.com (2603:10a6:200:42::26) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220124184827.584491-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8ad3340-ffb2-4e9f-0121-08d9df6a2466 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRuJzjo+afAgK4jr0IBXHTxrAVSSqOlntTx56IggyMXmxOOL5unfiFWenB19+B2gGuC2ZX1D63TMHNDhbFF4aj6B0x+ZsVUMzGSLdl34L3edPpLPmfFNzlSemi0H6VqtueInig0pX8ychh27wwYjhAbfMnSQEmdsqnSFvoFJVvVbJkJvSP3PjhHycrb2xVrNvNgM6/66EuPZUMVaIL/fDfBmcE3i3G7iRUrjw9i1xf7Ad+mAUtS0YmvgeZKblXG+9WLrsXpSmblF9k8NPO4sxQlrXACmURXbKy1Szx3vXCsuLE4vGiZ0cHyZwMVXK1pSqfRXN2YlpNYxFzHmkUheFzK2FvOoJcaRk7gwP1NZifRAg0mYn3SLV4woxX1fop0XlnaNQX1CLsppoTn/IlYl2T9cJqHe/cEwlWfGnleJgk3uIPVibGrLtnTDUxIboDYopAXRcefihiKCkWpVTPww6xzzcYHVowy3pNMWWRMeHEjIgx4YvyFPZL8UWtEocBfX1tt0WwmkDVBdezwPlY97RP7Ge0TP9iyCdxOITdQkKJTI6xIOONB8swTBaBiSQCcpwKhTsmQ/N6fDbdA6q/yiQFOvrSbixa7OIdwgYuc47VdvRpcrSQe5Rm60c4PIKp+UqjsVf9u2WBLGe6grGaGAPEMXw9/+W7DRx0TfHAztb9OKnnvb4QKDOacbPBW1JyoOj7oI1ToPbnYE0tI7NHwxfdSiYUyX/xE8B3y7YI3RpRypwkVykFEGcArLe9jy+r6o0Q= X-MS-TrafficTypeDiagnostic: HE1PR0302MB2732:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZGW9EuiQqblOxSf6Gbtt8JUhjN07einkXQcmFkNKtxS3EDHoFC5PNQ2Q4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J01PN+fT0LU1DOUCXkEJQl3TxjWUlPjTyQojDjJ0kFs6WRb0+fetw7qHCMaZPAIbKW961j9uDMelKS0vuMLnwqfzkh934syvWdbi90NlsQMJxkH2tKfPK2wiWgicamiq1pRLzemFk12IkZi+SLA/P5EmljIlshGoAxOz+ZE+JCzwBZBhhJdRNF5k3CFBWimDzNJhqV0lfywkzx1HoeCQI/cee+bIp4Jaa0LHrlJfBEuWnmXXCKK7ODM7/UZVUt9OhTloC77X/Af8/LnY1hUO+/G2Xj1XBpt5zY1U4ZwCCxYPMCSsq/IngnIR7TrUuiZWpsxar3Lc2SfxevE4sptbIM/A2j3WEckawRd0kyC512E77HU8O3VZDr56cnOJSFD6MBOfHq0brOyLQE8JjiFkMGWhDjDJEfxA85Qh/uw/EOTsuiws376YRfOZGE3t+qFvF1G6+q2fwcdKK7J1wiq+4ARnQ5RyqUIXZQnJp3KX/vJcMe8hPQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8ad3340-ffb2-4e9f-0121-08d9df6a2466 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2022 18:48:42.1701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0302MB2732 Subject: [FFmpeg-devel] [PATCH 16/18] avcodec/h264_parse: Move find_start_code() to its only user 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: o16KVJsaiblz Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_parse.h | 13 +------------ libavcodec/h264_parser.c | 9 +++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h index 9b6391edda..3901b46ac2 100644 --- a/libavcodec/h264_parse.h +++ b/libavcodec/h264_parse.h @@ -28,11 +28,10 @@ #include -#include "libavutil/common.h" +#include "libavutil/attributes.h" #include "get_bits.h" #include "h264_ps.h" -#include "internal.h" #define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit #define MB_TYPE_8x8DCT 0x01000000 @@ -130,16 +129,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps); -static inline int find_start_code(const uint8_t *buf, int buf_size, - int buf_index, int next_avc) -{ - uint32_t state = -1; - - buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1; - - return FFMIN(buf_index, buf_size); -} - static av_always_inline uint32_t pack16to32(unsigned a, unsigned b) { #if HAVE_BIGENDIAN diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index b221459c1b..d9cbb7d6d5 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -67,6 +67,15 @@ typedef struct H264ParseContext { int last_frame_num, last_picture_structure; } H264ParseContext; +static int find_start_code(const uint8_t *buf, int buf_size, + int buf_index, int next_avc) +{ + uint32_t state = -1; + + buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1; + + return FFMIN(buf_index, buf_size); +} static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size, void *logctx)