From patchwork Mon Jan 24 17:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33802 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:e71a:0:0:0:0:0 with SMTP id b26csp495492ioh; Mon, 24 Jan 2022 09:01:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvOq635De7Vg6HQA4nVTMbMczECIGbPeL2GSOu25XWwlzKoN1XjxjUZT5OuOiq8Bill5b8 X-Received: by 2002:a17:907:7291:: with SMTP id dt17mr200732ejc.521.1643043686166; Mon, 24 Jan 2022 09:01:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643043686; cv=none; d=google.com; s=arc-20160816; b=Ta5qyO+UTRYfCyMObBRgiJ6TiWiXrL2PnhILiyeXytb8KqdXDG01i9SoajWpkf1dOU 2Ot1VAIwh9JE0kXJjgUHu81wAORXaz3yjZgnoaCvJdjHqgj9a5haXo+oC8q0S1KYwjIC pEKMmLKQbQQf0tnsJ/2isZDZdsXOsjU/P8/hH18BU93xMaAfc9PGwrWm4q1R7gLxl3yM S640hG9wDIMjCKsYirIUQCTgKfNbU1o60i9ujFM3hlrM10fao5SbdR33Lt9tuk/ClmFx TGlca2E4lhEgRgxX49YKs4rjBDFFVnLVSSXvkM8VodOAPODu5O1QUKZoTnxII3OlpX/0 qUig== 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=xRpK3X8G5wKJKYzdscjo3QScM14dgK6xxZK2PtXF7nY=; b=1HXLUG+mJUxePXt0jOu4hNt6MG8zTZiwyPCm+O8VMxao6CtVI+nqXZcu4tlvkKsvMo ex7NwCvq06vYpUT1i8p2Gfq/YIiNu383vRNCCNumzHeRqnkpKBEY6+l3h6Qh2znQeaNi TassP6SKRibv1pwY/YIQ9gwotmCW/nHR2B5Bqusg3xvRLCmaQrMvfxiSLMrbXSuSAnCy l4tMZjq5YL5z0MR9Fi9IjEF2LEALx6JUDWQxP3yQz9WRim2So7xFE7FKxQaEXXo+75HA bvPrR8aiNCNSH8q/mNx69iwl5N/UrNEQ1ranSH5Fhtjd5U/Wj3kEolybf2OH3DTaNlWF yDpw== 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 w4si5317719edt.364.2022.01.24.09.01.25; Mon, 24 Jan 2022 09:01:26 -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 31CB268B0E6; Mon, 24 Jan 2022 19:00:42 +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 8ED0C68B0E7 for ; Mon, 24 Jan 2022 19:00:33 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 09A192404FE for ; Mon, 24 Jan 2022 18:00:33 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id LXTgX2wJFpP3 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 BC2EE240179 for ; Mon, 24 Jan 2022 18:00:29 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 976FD3A047E; Mon, 24 Jan 2022 18:00:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 18:00:04 +0100 Message-Id: <20220124170014.17189-3-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 03/13] lavc/h264dec.h: move find_start_code and MMCOOpcode to h264_parse.h 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: cD6ZzaWPmuiD Both parser and decoder use these, so h264_parse is the proper place for them. --- libavcodec/h264_parse.h | 28 ++++++++++++++++++++++++++++ libavcodec/h264dec.h | 23 ----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h index 4d01620125..9f329db77a 100644 --- a/libavcodec/h264_parse.h +++ b/libavcodec/h264_parse.h @@ -24,8 +24,26 @@ #ifndef AVCODEC_H264_PARSE_H #define AVCODEC_H264_PARSE_H +#include + +#include "libavutil/common.h" + #include "get_bits.h" #include "h264_ps.h" +#include "internal.h" + +/** + * Memory management control operation opcode. + */ +typedef enum MMCOOpcode { + MMCO_END = 0, + MMCO_SHORT2UNUSED, + MMCO_LONG2UNUSED, + MMCO_SHORT2LONG, + MMCO_SET_MAX_LONG, + MMCO_RESET, + MMCO_LONG, +} MMCOOpcode; typedef struct H264PredWeightTable { int use_weight; @@ -90,4 +108,14 @@ 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); +} + #endif /* AVCODEC_H264_PARSE_H */ diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index ca3001ec4b..1e1f84ef33 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -103,19 +103,6 @@ #define IS_REF0(a) ((a) & MB_TYPE_REF0) #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT) -/** - * Memory management control operation opcode. - */ -typedef enum MMCOOpcode { - MMCO_END = 0, - MMCO_SHORT2UNUSED, - MMCO_LONG2UNUSED, - MMCO_SHORT2LONG, - MMCO_SET_MAX_LONG, - MMCO_RESET, - MMCO_LONG, -} MMCOOpcode; - /** * Memory management control operation. */ @@ -831,16 +818,6 @@ static av_always_inline int get_dct8x8_allowed(const H264Context *h, H264SliceCo 0x0001000100010001ULL)); } -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); -} - int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup); int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src);