From patchwork Tue Jan 25 17:41:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 33841 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp832031iov; Tue, 25 Jan 2022 09:42:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYnlt6XAdsr7n8nGQ3oZrxxttZU7qfhEJT0La8q+XiTqyb3bG7e+43UfZCINNR9RHOH49A X-Received: by 2002:a17:906:d54d:: with SMTP id cr13mr2471334ejc.567.1643132527204; Tue, 25 Jan 2022 09:42:07 -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 jg3si3895874ejc.30.2022.01.25.09.42.06; Tue, 25 Jan 2022 09:42:07 -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=X6WhSFRi; 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 9535668AEED; Tue, 25 Jan 2022 19:42:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074047.outbound.protection.outlook.com [40.92.74.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC5DE68A58C for ; Tue, 25 Jan 2022 19:41:56 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JeCakk4FyRTWDMJQmrOz/lIF0VIbd1Tu1JGydqIbfu2JbCLGwPGpur7ZKp1Gz8AidYozHFy84NUwZ8jnAIoZRfKddAfYxKJPVmt831y6MUxUouOTxPoGfDiwNJoRQ05TPiIhtkZ+RtEDN6y2rtL/Th1mngl3NHqoAyBwNewo9bJZEoyVzNgS4HR61KMRUgPGxwYfqGU0Zg3jqnYzfce+pMWVD5Y1/3lXgEghwIhbNoLhGrJI6rkYcdcvdi+IinExFglEdtyHd92U3/v2VELT8QzKVNpIBvOmvPl3G+EGdSArR6m8U8AaPRmsn6aOo5/2NUjOXx8sK1/Lf4KVw17pwg== 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=/IFjkXD1E2ALnCNfrMgb9kZQpFO5XfS0tYK/+Qa77Qo=; b=jKcdUseoEi1yjc/EDSOw426BTurmvSSlMAUHrkyxQqaCNjx0n0WgXMOOqjtkdnGAMJG0K6EjUo6VVz91oQmimbnrEPaPm/kwG9ftzhqUkjRTg3OQY9WVm2pBfLz8h+B8GD1EWj5THP1LJ2FQiuIHj7xg0/p7efgpcCr9aUKjUGaK2gSnlgCT0CrdIOurRwVoZjIrAJIhcTUnCtlEaxECCjnapaEnXFRM+BN2OaTea7Ze3Z4A62ZtMFWBCYswHuH++DwHsw1mmNYv0p3qPpmh8OzSSbFDHq5+PICl42DjFFSunL0G2cf0iQuupsgkw1nf+DDJdAW4raUeGxQ6XkWpRA== 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=/IFjkXD1E2ALnCNfrMgb9kZQpFO5XfS0tYK/+Qa77Qo=; b=X6WhSFRieaqkjNQnVU5I8s9mh8FZj9pS2rTcZU1vnw6wXT/E/oNuoEhumYdfPgVVg7W9Ibp4uuYCV7Z7nTlRAebD0/0d5e/4BOtaDV+yS72DkV4n/LRGajr+VLlsnS9GK46gFbgeq68N+YaGRNzrCqPlbQvX25QNHdawH/knoETuNebX6bxKGQ5CQxkuRPC0dOBWP4DZiWg4og9qIkVpUDPGlRvGKlNevqeEc0cmC7B3eSSAmDkLtjdfJLzTxeseMk6XFAMZg+uDSgUt8dsw+S/s2xpiA0bAHbpm4jgSyHUL8lOVKu5fyQjp/ekO3QbvUy0vuoljJAu7zXAq4os8KQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM9PR03MB6977.eurprd03.prod.outlook.com (2603:10a6:20b:2d8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.19; Tue, 25 Jan 2022 17:41:55 +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.4930.015; Tue, 25 Jan 2022 17:41:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Jan 2022 18:41:29 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [L7fVCoEs17YlX7JUPyNHD4UcGtG1JyW6] X-ClientProxiedBy: AM6P193CA0061.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::38) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220125174148.994967-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b082fee-3248-4a55-600e-08d9e029faa1 X-MS-TrafficTypeDiagnostic: AM9PR03MB6977:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WrCpnRFwY+aFzxKRsFV7kkrN9zB48Uq0N/B9VU3QFVLqtrCjvWUP0tbAlCoPn08WaXyh5UpzdQ0HOLkVakuN/4ky+U1HfuDFiA82xA8NzxGDwC/IkNKvnpKFltMvuEnmYKsO28354brwquNkS2w2JKrvTPHRHm+Ahppj+OW117PjzKcj5kGcM5i5DiXFJy/h35/NOdjJb1EMl6ypYvodzzo6bIo+3OCbiZO4FecGPvTWbyFOHFFnTco7cibBl0lL0p9+KDIY9SF4EulGNx0UZYrku39NIfaPPkWC+c4AqRIrgbZrSXRz1GP7SRNlVY3a2SF9ik7ZMmEWGuCbO28/9yvae8IblA4NiSi/MZRrwi7KKSiluAtOH9gAEqvzaL+fGlaxcm2J2ScSSRUj/+KaBSDTlQT2PjGpjWCwwFJsdE/OSlhAhhzn7+e/FmcdcOyq9OOChrujCFHrF+osVY+V3U4x2zIlgtWSXEgAgZC0SStcqCX3QNyDxVrkirK5evMvfpn5q/Antp0ySgTEQBROCBu3CwlL02xxU5Q+CuU/kt9Q/K6pBdA7BpUkFr3jTM99 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iJOjTISbhJdGOYh+tFn5bsjm/taSxI771wBBcseC34PfI7VoOeKnz4y7kbfftx5C8sXg67UeqaalPj3qTJ8inrxBKZjq/5EAYL3hJzvr3z1uUiG9URgxfrQt51Et6/4hng408MFud51/9dxoEseElt988LT387gZ+hdTSrM1sjBzo51R9NVKYayCWFnCZTP65o0Ed5YhGG9CFYcHVaAOOrweYD0GCodopVkL38gUCFpG+zuhnidWR3XXNbPZIXJVLaYnG9+Iy2f6jideF9qc5UcGqxj0s1cadO6/59jZ8lscvq+Kk32N04HURs0DgZo713bSHU/ExAbltVQZXgIFQGawn8fL0w9m3jLrPb20etXc+VfnqPqn2G05gtt6WfB9cDBKqG6iIMsmGm2hH1QTr+co49Na1hCT2rvlwKtohRwvzbC1zdaiZATo0f3g0qB8tP11Vn9kLy7rBLNbYJUuf65nGjwUoywxwWGhBV4VfVtV8izwSKOgV75OGrfSeWaex4A8IOzVcRKg+4G1tARWLfdfqLs/FmNw3hXgquT1m25jVWzGlxEYFVQdIbAKahaG1eVVnCn+x8Jomlw5cMBc7xTtgnKUVz/xKiOvykkr8WacAy0uJ8xlk0NvdpvB8vXiA7jMEeyiHRtOFfs0lVxVLC+Mf5Y0F1zftbhvm2Tcde2UY1ldXkyMc/M7yzZaE7pV06h/9LxiJurkqMe/44idJBa34WXWudBs55jBLnaKTW/lB7HAfZXQxPaPNn5zaLXmx7djmMaECsOYChqAL/mMYdYcVNPScJMKtPhDQWKc5HVrUye0pjRecrJtSQSMHKixvEmsLvDOSc4YWdaZZpbgDtYfP9dPJC7E5KB0pRiDwbT0F4BRntfU2UkYubNgOqoA1+GFATVhhVEeQFQqyDDF3sZ6QMmBHg8GMGEBVRQ/hsTv524e1+By0Jw5cjhHIQnoTah1scOaWQuKEXNHoR6+Hg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b082fee-3248-4a55-600e-08d9e029faa1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 17:41:55.4202 (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: AM9PR03MB6977 Subject: [FFmpeg-devel] [PATCH 02/21] avcodec/h263: Move decoding-only stuff to a new header h263dec.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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7nsRAEVqQLJy Signed-off-by: Andreas Rheinhardt --- Soon to be followed by a H263DecContext. libavcodec/flvdec.c | 2 +- libavcodec/h263.h | 40 ----------------------- libavcodec/h263dec.c | 1 + libavcodec/h263dec.h | 65 ++++++++++++++++++++++++++++++++++++++ libavcodec/intelh263dec.c | 3 +- libavcodec/ituh263dec.c | 1 + libavcodec/mpeg4videodec.c | 1 + libavcodec/msmpeg4dec.c | 1 + libavcodec/rv10.c | 1 + libavcodec/wmv2dec.c | 2 +- 10 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 libavcodec/h263dec.h diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index 2ddcf021fd..2bd86b5b47 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -21,7 +21,7 @@ #include "libavutil/imgutils.h" #include "flv.h" -#include "h263.h" +#include "h263dec.h" #include "mpegvideo.h" #include "mpegvideodata.h" diff --git a/libavcodec/h263.h b/libavcodec/h263.h index 31836ebb95..6dd5d2295a 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -22,41 +22,14 @@ #include #include "libavutil/rational.h" -#include "get_bits.h" #include "mpegvideo.h" #include "h263data.h" -#include "rl.h" #define FF_ASPECT_EXTENDED 15 -#define INT_BIT (CHAR_BIT * sizeof(int)) - -// The defines below define the number of bits that are read at once for -// reading vlc values. Changing these may improve speed and data cache needs -// be aware though that decreasing them may need the number of stages that is -// passed to get_vlc* to be increased. -#define H263_MV_VLC_BITS 9 -#define INTRA_MCBPC_VLC_BITS 6 -#define INTER_MCBPC_VLC_BITS 7 -#define CBPY_VLC_BITS 6 -#define TEX_VLC_BITS 9 #define H263_GOB_HEIGHT(h) ((h) <= 400 ? 1 : (h) <= 800 ? 2 : 4) -extern VLC ff_h263_intra_MCBPC_vlc; -extern VLC ff_h263_inter_MCBPC_vlc; -extern VLC ff_h263_cbpy_vlc; -extern VLC ff_h263_mv_vlc; - -extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]; - - -int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code); av_const int ff_h263_aspect_to_info(AVRational aspect); -int ff_h263_decode_init(AVCodecContext *avctx); -int ff_h263_decode_frame(AVCodecContext *avctx, - void *data, int *got_frame, - AVPacket *avpkt); -int ff_h263_decode_end(AVCodecContext *avctx); void ff_h263_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y); @@ -65,27 +38,14 @@ void ff_h263_encode_gob_header(MpegEncContext * s, int mb_line); int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir, int *px, int *py); void ff_h263_encode_init(MpegEncContext *s); -void ff_h263_decode_init_vlc(void); void ff_h263_init_rl_inter(void); -int ff_h263_decode_picture_header(MpegEncContext *s); void ff_h263_update_motion_val(MpegEncContext * s); void ff_h263_loop_filter(MpegEncContext * s); -int ff_h263_decode_mba(MpegEncContext *s); void ff_h263_encode_mba(MpegEncContext *s); void ff_init_qscale_tab(MpegEncContext *s); -/** - * Print picture info if FF_DEBUG_PICT_INFO is set. - */ -void ff_h263_show_pict_info(MpegEncContext *s); - -int ff_intel_h263_decode_picture_header(MpegEncContext *s); -int ff_h263_decode_mb(MpegEncContext *s, - int16_t block[6][64]); - void ff_clean_h263_qscales(MpegEncContext *s); -int ff_h263_resync(MpegEncContext *s); void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code); diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index ac48acf47a..3466027286 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -33,6 +33,7 @@ #include "error_resilience.h" #include "flv.h" #include "h263.h" +#include "h263dec.h" #if FF_API_FLAG_TRUNCATED #include "h263_parser.h" #endif diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h new file mode 100644 index 0000000000..8d5f9a7add --- /dev/null +++ b/libavcodec/h263dec.h @@ -0,0 +1,65 @@ +/* + * H.263 decoder internal header + * + * 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_H263DEC_H +#define AVCODEC_H263DEC_H + +#include "mpegvideo.h" +#include "vlc.h" + +// The defines below define the number of bits that are read at once for +// reading vlc values. Changing these may improve speed and data cache needs +// be aware though that decreasing them may need the number of stages that is +// passed to get_vlc* to be increased. +#define H263_MV_VLC_BITS 9 +#define INTRA_MCBPC_VLC_BITS 6 +#define INTER_MCBPC_VLC_BITS 7 +#define CBPY_VLC_BITS 6 +#define TEX_VLC_BITS 9 + +extern VLC ff_h263_intra_MCBPC_vlc; +extern VLC ff_h263_inter_MCBPC_vlc; +extern VLC ff_h263_cbpy_vlc; +extern VLC ff_h263_mv_vlc; + +extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]; + +int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code); +int ff_h263_decode_init(AVCodecContext *avctx); +int ff_h263_decode_frame(AVCodecContext *avctx, + void *data, int *got_frame, + AVPacket *avpkt); +int ff_h263_decode_end(AVCodecContext *avctx); +void ff_h263_decode_init_vlc(void); +int ff_h263_decode_picture_header(MpegEncContext *s); +int ff_h263_decode_gob_header(MpegEncContext *s); +int ff_h263_decode_mba(MpegEncContext *s); + +/** + * Print picture info if FF_DEBUG_PICT_INFO is set. + */ +void ff_h263_show_pict_info(MpegEncContext *s); + +int ff_intel_h263_decode_picture_header(MpegEncContext *s); +int ff_h263_decode_mb(MpegEncContext *s, + int16_t block[6][64]); + +int ff_h263_resync(MpegEncContext *s); + +#endif diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 58c1b63c0a..9dde247298 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -20,7 +20,8 @@ #include "mpegutils.h" #include "mpegvideo.h" -#include "h263.h" +#include "h263data.h" +#include "h263dec.h" #include "mpegvideodata.h" /* don't understand why they choose a different header ! */ diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 5329e62a5e..0a032ea54c 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -39,6 +39,7 @@ #include "mpegvideo.h" #include "h263.h" #include "h263data.h" +#include "h263dec.h" #include "internal.h" #include "mathops.h" #include "mpegutils.h" diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 737689b35b..162048b604 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -36,6 +36,7 @@ #include "mpeg4video.h" #include "mpeg4videodata.h" #include "h263.h" +#include "h263dec.h" #include "profiles.h" #include "thread.h" #include "xvididct.h" diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index f302509589..3d2dcb9429 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -29,6 +29,7 @@ #include "msmpeg4.h" #include "libavutil/imgutils.h" #include "h263.h" +#include "h263dec.h" #include "mpeg4video.h" #include "msmpeg4data.h" #include "vc1data.h" diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 0dc2c87335..4dfaa3460d 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -34,6 +34,7 @@ #include "error_resilience.h" #include "h263.h" #include "h263data.h" +#include "h263dec.h" #include "internal.h" #include "mpeg_er.h" #include "mpegutils.h" diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index f7745c5a83..7518088b6a 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -19,7 +19,7 @@ */ #include "avcodec.h" -#include "h263.h" +#include "h263dec.h" #include "internal.h" #include "intrax8.h" #include "mathops.h"