From patchwork Sun Jan 9 11:44:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 33164 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp1875050iog; Sun, 9 Jan 2022 03:44:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIgrgUDMB40VqqPjCSeeDNhbKtZv+DRvbOpr11Ar0x6Yo1wpkbqQeoEB4QmouBhePLts2L X-Received: by 2002:a17:906:417:: with SMTP id d23mr4446147eja.469.1641728694428; Sun, 09 Jan 2022 03:44:54 -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 b10si2112289ejj.220.2022.01.09.03.44.53; Sun, 09 Jan 2022 03:44:54 -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=rq5Dv7Xm; 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 DEF8268020F; Sun, 9 Jan 2022 13:44:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2031.outbound.protection.outlook.com [40.92.90.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7D1F568020F for ; Sun, 9 Jan 2022 13:44:43 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CMBohNijRhAuVctDJJjO9xvJOx8cM/xA8x5+AJkhUpxo389dOjAxVKxqsVqCNLZBC9z3MiYlIeKcdNmvT2gSJcoJz5LSaK3pfX7yqqySZXcstzgpW7ccTqplVSQyPdkNlHuBQGWRziR8YwnC6bsNiJ+9ucciJf8XhsMiY99SJ05uuzTeyPcN4zoQPK1C4NcCL9oqfIoTAQQgOkAlNyQfRINqrO0naN0R3o0Uplhef0Dnn1cxrXF+a/smyZVV64Cl7aqhE1SttminKne2luZa16cTPoiAjeh61o+0HGjoVVZFStaxJ8qk0vemMwhytSWcWQ3/bYFJ7coGRiRue+KIyQ== 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=w/HdQKAGUqYB7Vp1ZsjcSUifWPAFSJJ2z59vpqAcfsk=; b=NR+g6SD+JzeyZsbJjDAcdn+Tn2wnhv7lFBeoaZ2if4o7iixRZVxADpMoaqT5PKXWnX9uFkxPtAi5XhRAfN0MFV6sAYGZWepPtv84YxljemNaOuegDfbN2BBkzCI+Bx9nMuGFSSaNcslc2ja8wNJVjuzgV18pJwnjcrHolgGt4A5EsSbNRzh6TvhMd3zqL+B1tJo85wUWhZhV8OQ8o4hbC4bKpgEiOnw0zRDTM7tPgSEYS8RkZQsewsnVZCkrlBpVspFNKCvcVm34qS7pDyJks5QOtKVCIg6qf7QpWe/rV8z8LRSZc49sSizwzjLMTtmIOfoiqb6VsVPLPGvQHzGi6Q== 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=w/HdQKAGUqYB7Vp1ZsjcSUifWPAFSJJ2z59vpqAcfsk=; b=rq5Dv7XmvdpAOO5HDEJsCtgMmfsUaBIAmTtjQWM4ipxtcjA7GqIB9LIPibcE7FmSJBiVn68gYMxToMP22RIM/NpLXXkw4Cs58HKchaRskAKDIUBDfCKe7JQeKQM0EHBR4agMR/RlwC+1cQcqEZrd2wyhDlWEKP9qejcYmKsNdIbHMz9gcUW9+Dl0AkSqhc/ADbn1AOjhHhE1EJirZ5sGlOV6LLvuLW47uhiXyFsrqpiLX4hFEr6UIxzM2b9qXIMdrLkdlB+0eEFQURseZUe8zxlQycm+swjUgnkgdu9CiKGpBIEQHfsvjTJvgtAXHjuSqvDuM/CVQ95FClcTqE+FeQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5544.eurprd03.prod.outlook.com (2603:10a6:20b:f2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Sun, 9 Jan 2022 11:44:41 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::19fc:be9f:2c9c:53f5]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::19fc:be9f:2c9c:53f5%9]) with mapi id 15.20.4867.011; Sun, 9 Jan 2022 11:44:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jan 2022 12:44:33 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 X-TMN: [9zxEbvHzt7IDotBU5p8iwkiFoGyGznaY] X-ClientProxiedBy: AM5PR0502CA0013.eurprd05.prod.outlook.com (2603:10a6:203:91::23) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220109114434.4018068-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 951b98cf-0da5-44a8-32f5-08d9d3656c82 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JjN4v9/x/ItmTjHyjcttvkYH6hYgtGdpRKcvBALzybumfKBN+E4l2fTEcwLdNIKfZJMm16YdrcyE9lqFl1Rzw4M3zSS4E+LiiiwY9nyasTI7OaQOLGS3+Rt8f+fgV5EPR6Bg24RXsv9k5u+jI7klfHNIl5j/OaW+HtDAE5h5H8Bk9IpH7Ny1Y0cDSlta19hNe9V0Sjv/Hl6a1tS7ZXGD9BTwkikpncO4qi2nUMM07Cb2VSbwBL8Bx5OI934X0GpRUY886PFmcPNVqJjGAYY7EbF0DXVkIuu+/dvaQdCOUjAvnLc6kOVoAhABkYSC2lOvs1kdfVfDq/EthfCyRgorv4JAzQGTDlJMhbrc3xBx4jz/gR7FnbORmSpniHSYnV2gIOuWuXdys4tc3ExVNqAaMBe6ycMRMqNF6W1vVU2ljHy9fXWFsLzcOmITS1ndtiGNuSA/XGOtop0KpwRnHV3gwK77UYN4kWPVzxJFnSdJfPpLBhxV0XqokpOwY38006OY2UQfNUe52JYciNzzCiUmjWdeDdB7GqufTAwrocykkrL3Vm0zO0VIAsOXdXTOlI8sj0I3dXk7sVUri81zLwWt92xwU5eC1fL4K4xrhSj7yYrItYBkvQDkaDlBlB1qLuYgSMB1veX3cyr6YP5EvqU/LWkmkVaFQca5htQH0/Q+WyBX68jv3MxRtktYjlIUdqHzK682daqK3S3UDBxVrWCpvvYerrnRw278Mw9p/QAJ69iQ= X-MS-TrafficTypeDiagnostic: AM6PR03MB5544:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S14yg41gwbrA1qg/YNSNbpvQtDOzCjZEBS9o7TtEKe11bOUKTMofko0oPyggwmlukoRmL8nYsGJJshdgTGyrBpZrfqiEC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IUP5bwyDt+4uN5Lz3wI5F6Rhbt82+er2r+lzZQRXCsXlz9UUo619Xd1HuumnRJvh+BVEsuPNSdao/sfu9AzUV8UkwdZlQJ3xpKseUV6uG0Q6yF2uUhlsHrd9UjtRmxY31/1870EBCBQut7wcZKrX9XnGckh4eIo+tzkTQPt5DHGQdQ0wQSEa9dTvDP4wACBh7ynfkbk1GoLmjn25Xzf+LlR+uPtU82SCVb9duRQe8cYiCWZogVlOlor23bPH51kGA1Qg8svi9nvaZdS4nFFUuqTs2U5f31OF0JDjF7uymKakMztMCQh9Ng498TNIPwxvEqhqEVvfQ+m+HVpFJuDEsko3g++LuuX/04SVE8pvjJQ9zMuVODXVARvk05wzBXqfrSWZbVjA8aYVWPa4fEqVnkGO0bOWFZlRwuPQudeDOzdlwIsTJpIDgSO9TLQ6NYrLtypW8UnTLzKGIsJXg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 951b98cf-0da5-44a8-32f5-08d9d3656c82 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2022 11:44:41.8703 (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: AM6PR03MB5544 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/mpeg4video: Split off data in a header of its own 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: 7WWhktAAwRXp Signed-off-by: Andreas Rheinhardt --- libavcodec/ituh263enc.c | 1 - libavcodec/mpeg4data.h | 3 +- libavcodec/mpeg4video.h | 35 --------------------- libavcodec/mpeg4videodata.h | 61 +++++++++++++++++++++++++++++++++++++ libavcodec/mpeg4videodec.c | 3 ++ libavcodec/mpeg4videoenc.c | 1 + libavcodec/mpegvideo_enc.c | 1 + libavcodec/msmpeg4.c | 2 +- libavcodec/msmpeg4data.c | 2 +- 9 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 libavcodec/mpeg4videodata.h diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index d944c4879f..5a7791111e 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -39,7 +39,6 @@ #include "mathops.h" #include "mpegutils.h" #include "flv.h" -#include "mpeg4video.h" #include "internal.h" /** diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h index 30179d9801..c5a2b14721 100644 --- a/libavcodec/mpeg4data.h +++ b/libavcodec/mpeg4data.h @@ -28,8 +28,7 @@ #ifndef AVCODEC_MPEG4DATA_H #define AVCODEC_MPEG4DATA_H -#include -#include "mpegvideo.h" +#include "mpeg4videodata.h" /* dc encoding for MPEG-4 */ const uint8_t ff_mpeg4_DCtab_lum[13][2] = diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index cec8b30c32..87d9c9996e 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -27,7 +27,6 @@ #include "get_bits.h" #include "mpegvideo.h" -#include "rl.h" // shapes #define RECT_SHAPE 0 @@ -118,40 +117,6 @@ typedef struct Mpeg4DecContext { int rgb; } Mpeg4DecContext; -static const uint8_t mpeg4_block_count[4] = {0, 6, 8, 12}; - -/* dc encoding for MPEG-4 */ -extern const uint8_t ff_mpeg4_DCtab_lum[13][2]; -extern const uint8_t ff_mpeg4_DCtab_chrom[13][2]; - -extern const uint16_t ff_mpeg4_intra_vlc[103][2]; -extern const int8_t ff_mpeg4_intra_level[102]; -extern const int8_t ff_mpeg4_intra_run[102]; - -extern RLTable ff_mpeg4_rl_intra; -void ff_mpeg4_init_rl_intra(void); - -/* Note this is identical to the intra rvlc except that it is reordered. */ -extern RLTable ff_rvlc_rl_inter; -extern RLTable ff_rvlc_rl_intra; - -extern const uint8_t ff_sprite_trajectory_lens[15]; -extern const uint8_t ff_mb_type_b_tab[4][2]; - -/* these matrixes will be permuted for the idct */ -extern const int16_t ff_mpeg4_default_intra_matrix[64]; -extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; - -extern const uint8_t ff_mpeg4_y_dc_scale_table[32]; -extern const uint8_t ff_mpeg4_c_dc_scale_table[32]; -extern const uint16_t ff_mpeg4_resync_prefix[8]; - -extern const uint8_t ff_mpeg4_dc_threshold[8]; - -extern const uint8_t ff_mpeg4_studio_dc_luma[19][2]; -extern const uint8_t ff_mpeg4_studio_dc_chroma[19][2]; -extern const uint8_t ff_mpeg4_studio_intra[12][24][2]; - void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y); diff --git a/libavcodec/mpeg4videodata.h b/libavcodec/mpeg4videodata.h new file mode 100644 index 0000000000..b20096067a --- /dev/null +++ b/libavcodec/mpeg4videodata.h @@ -0,0 +1,61 @@ +/* + * MPEG-4 encoder/decoder data. + * Copyright (c) 2000,2001 Fabrice Bellard + * Copyright (c) 2002-2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MPEG4VIDEODATA_H +#define AVCODEC_MPEG4VIDEODATA_H + +#include +#include "rl.h" + +/* dc encoding for MPEG-4 */ +extern const uint8_t ff_mpeg4_DCtab_lum[13][2]; +extern const uint8_t ff_mpeg4_DCtab_chrom[13][2]; + +extern const uint16_t ff_mpeg4_intra_vlc[103][2]; +extern const int8_t ff_mpeg4_intra_level[102]; +extern const int8_t ff_mpeg4_intra_run[102]; + +extern RLTable ff_mpeg4_rl_intra; +void ff_mpeg4_init_rl_intra(void); + +/* Note this is identical to the intra rvlc except that it is reordered. */ +extern RLTable ff_rvlc_rl_inter; +extern RLTable ff_rvlc_rl_intra; + +extern const uint8_t ff_sprite_trajectory_lens[15]; +extern const uint8_t ff_mb_type_b_tab[4][2]; + +/* these matrixes will be permuted for the idct */ +extern const int16_t ff_mpeg4_default_intra_matrix[64]; +extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; + +extern const uint8_t ff_mpeg4_y_dc_scale_table[32]; +extern const uint8_t ff_mpeg4_c_dc_scale_table[32]; +extern const uint16_t ff_mpeg4_resync_prefix[8]; + +extern const uint8_t ff_mpeg4_dc_threshold[8]; + +extern const uint8_t ff_mpeg4_studio_dc_luma[19][2]; +extern const uint8_t ff_mpeg4_studio_dc_chroma[19][2]; +extern const uint8_t ff_mpeg4_studio_intra[12][24][2]; + +#endif /* AVCODEC_MPEG4VIDEO_H */ diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 325593a795..37088b7a6b 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -34,6 +34,7 @@ #include "mpegvideo.h" #include "mpegvideodata.h" #include "mpeg4video.h" +#include "mpeg4videodata.h" #include "h263.h" #include "profiles.h" #include "thread.h" @@ -56,6 +57,8 @@ static VLC studio_intra_tab[12]; static VLC studio_luma_dc; static VLC studio_chroma_dc; +static const uint8_t mpeg4_block_count[4] = { 0, 6, 8, 12 }; + static const int mb_type_b_map[4] = { MB_TYPE_DIRECT2 | MB_TYPE_L0L1, MB_TYPE_L0L1 | MB_TYPE_16x16, diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index b77653d453..8871d83281 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -28,6 +28,7 @@ #include "mpegvideo.h" #include "h263.h" #include "mpeg4video.h" +#include "mpeg4videodata.h" #include "profiles.h" /* The uni_DCtab_* tables below contain unified bits+length tables to encode DC diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 15b6669e46..afad9c8be1 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -64,6 +64,7 @@ #include "aandcttab.h" #include "flv.h" #include "mpeg4video.h" +#include "mpeg4videodata.h" #include "internal.h" #include "bytestream.h" #include "wmv2.h" diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index e76aec6dfc..f12586dd64 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -34,7 +34,7 @@ #include "mpegvideo.h" #include "msmpeg4.h" #include "libavutil/x86/asm.h" -#include "mpeg4video.h" +#include "mpeg4videodata.h" #include "msmpeg4data.h" #include "mpegvideodata.h" #include "vc1data.h" diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c index a3a8144664..63f30ac544 100644 --- a/libavcodec/msmpeg4data.c +++ b/libavcodec/msmpeg4data.c @@ -28,7 +28,7 @@ */ #include "h263data.h" -#include "mpeg4video.h" +#include "mpeg4videodata.h" #include "msmpeg4data.h" uint32_t ff_v2_dc_lum_table[512][2];