From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4148940975 for ; Tue, 1 Feb 2022 21:21:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D7BBC68B06F; Tue, 1 Feb 2022 23:21:17 +0200 (EET) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79E6568AF51 for ; Tue, 1 Feb 2022 23:21:10 +0200 (EET) Received: by mail-qv1-f54.google.com with SMTP id s6so17201690qvv.11 for ; Tue, 01 Feb 2022 13:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KICQncTemsfuvM5Sv3D7PxnsDlwbqR9+01/x1cqDRgE=; b=FmIHaR9WtxuI/WdfMKdm4+KaxAwywZu5l49vAOFSYprfgrdC4NLOBsGTesYCL/plbq XmnxOagONB1Cceyo04x9I4V9QhuIe/bRH8++GyXAjXdf6EitO0+nich+JRjnWtqU/g/d ZH/sx8yUuqMh3TgW1CWRHmjHmYPQKlgNmpN9j7mdPzan06gGFUACs46T8T44xOOgmHx3 n6oINMLTL17h7NOzuDUgMINV/E3j2EDzdt1R/3osU9DyThib9tDjfcyKklXXqy4EeVdh Hittn0YAf2Z4ySRAawFtMYj+2ZmLmGv1YYo8nhH5jZhfcFCeHB6Ss9fQQ1a9kj2LmNi6 grEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KICQncTemsfuvM5Sv3D7PxnsDlwbqR9+01/x1cqDRgE=; b=tNL+HWU1i+vM1X/2c4f4p0yKiOGEyetkTr9WhulBmdAkD9a0gBcN3iaqeYxWvF06cv cY5tqxeEry3VuQcqDc8k5HOeCJuumhWnDZGG4r2x3UqizBlD47EkFPHBz3BGhCeD0v+v ilANm1igvjaNQtBWd5yGEkoo1KaljEzcCtdeZTsFE1SYNcn2gVYi/qVaJMYhxdpTPF+Z Ew1xWxFUvpNUy6b9m9hCqLjyA6YYJgDzZ+VeoAQb6kDnFqsoUWF7AE1YB00RwS71JI13 DTXO4KeVAjK4TYifopSYCAjPpDAqkWJyKrl3SAEXIrUOrz6CHbrToCwHBp+8aTYKVRm/ Gnyg== X-Gm-Message-State: AOAM53157qNfyo7ECRbrcDgYdFoTwf35haOhbRvWQlvEdyPC+RU/ctaJ o1VkdQ04iEmrLE+bKFdPNsofUZTpWU+TUA== X-Google-Smtp-Source: ABdhPJxttgsiNrIY6GPwAu5CJpt1C6sw2iN5kWVUzPIyBBQui+e5Uttz1cdmtxtxz1DJjkeOF5pS5Q== X-Received: by 2002:a05:6214:27cd:: with SMTP id ge13mr24412661qvb.40.1643750469037; Tue, 01 Feb 2022 13:21:09 -0800 (PST) Received: from localhost.localdomain ([151.200.235.219]) by smtp.gmail.com with ESMTPSA id ay18sm2928225qkb.8.2022.02.01.13.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 13:21:08 -0800 (PST) From: Scott Theisen To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Feb 2022 16:20:52 -0500 Message-Id: <20220201212056.29712-5-scott.the.elm@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220201212056.29712-1-scott.the.elm@gmail.com> References: <20220201212056.29712-1-scott.the.elm@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] avpriv_find_start_code(): add doxygen comment and rename a parameter 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: Scott Theisen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavcodec/internal.h | 15 ++++++++++++++- libavcodec/utils.c | 10 +++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 72ca1553f6..07098e1522 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -285,9 +285,22 @@ int ff_thread_can_start_frame(AVCodecContext *avctx); int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx); +/** + * Find the first start code in the buffer p. A start code is a sequence of 4 + * bytes, with memory address increasing left to right and in hexadecimal, with + * the value 00 00 01 XX, where XX represents any value. + * + * @param[in] p A pointer to the start of the memory buffer to scan. + * @param[in] end A pointer to the past the end memory address for the buffer + * given by p. p must be <= end. + * + * @param[out] start_code The found start code if it exists, otherwise an invalid start code. + * @return A pointer to the memory address following the found start code, or end + * if no start code was found. + */ const uint8_t *avpriv_find_start_code(const uint8_t *p, const uint8_t *end, - uint32_t *state); + uint32_t *start_code); int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cf88e0a759..54c9dd056d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -942,7 +942,7 @@ void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, in const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, const uint8_t *end, - uint32_t *av_restrict state) + uint32_t *av_restrict start_code) { int i; @@ -950,10 +950,10 @@ const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, if (p >= end) return end; - *state = ~0; + *start_code = ~0; for (i = 0; i < 3; i++) { - uint32_t tmp = *state << 8; - *state = tmp + *(p++); + uint32_t tmp = *start_code << 8; + *start_code = tmp + *(p++); if (tmp == 0x100 || p == end) return p; } @@ -987,7 +987,7 @@ const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, // this will cause the last 4 bytes before end to be read, // i.e. no out of bounds memory access occurs - *state = AV_RB32(p - 4); + *start_code = AV_RB32(p - 4); // read the previous 4 bytes, i.e. bytes {p - 4, p - 3, p - 2, p - 1} return p; -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".