From patchwork Thu Feb 3 01:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 34081 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp2043167iov; Wed, 2 Feb 2022 17:07:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDE5uOp1cS6sisZeytWwRETXD1UzWLyZe7u6EEYQ7RWtFDk0rUaISiHt2UcnPDHR8S5na/ X-Received: by 2002:a17:907:3d9f:: with SMTP id he31mr26852527ejc.605.1643850424726; Wed, 02 Feb 2022 17:07:04 -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 z7si11258929edr.286.2022.02.02.17.07.03; Wed, 02 Feb 2022 17:07:04 -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=ETyFYHyX; 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 685AA68B0E4; Thu, 3 Feb 2022 03:06:55 +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-oln040092074042.outbound.protection.outlook.com [40.92.74.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 44DAB68AEC7 for ; Thu, 3 Feb 2022 03:06:49 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nbX8WoBvb/PaVWgorLfAujGuuXwZFgzenGRhePA4BUcHmi1owZEXyb8hqikVGILlMy8h+/0k9Cbs/50Qns9rsZD4dMwgCBjaygA5FTECJ0eCWoBycvDF+1swKpijYgtuHN+MhZLlHRQfYpOuzrAhK/EX1CVm7CiKowPQmzlKnCj3ZKi0SzEGu6zkUTueikuCJA8luIhEs8TTMBlyYSIvYT2c8bMj//DmJb7HD1cF2ghCQQJqLKMvVSocH9glejzLoI1IVFDTCUmzjA3zrdVD0/8dhqPr1PReKDozCbCgt+VHEQFUIJap6t6Bil0NuB35RgwpYAS5qREZ9PAyQQU3qw== 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=oY8/A/gi1w5rUHdGQjjI04e+kUV4W4aS7H7Y7EpkOxE=; b=IHmdIZs2PJgXR7pIH11yvg5EYfshu7cIxMB+600c55eYkY0roj/KmFExInzxnJvU7flG4w+Fq0VOBeUCkQyDsuazBZxteDnQcDryQ6o0VW71l2vWxW2CLYuMLUEzr9kyhjturhYgJ3IUA+sjhmBaML00ViW8rd27+0TZjjzutTEDvbfZamseOdJTNl9FADJpQFDIabyJPn/jMTseqfoi0tzdt0ntIp4tAaZr8pxRVvvHmOt4FgA0jvGAY7WGi6/vaAP+cpIyggKWfmHc+FtSIgH9v5E+s4Ua4lXZiX49DMSitLbGSkcU2OCmDluU1ByOGy14ShAGIUMvF+bbrwRYxg== 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=oY8/A/gi1w5rUHdGQjjI04e+kUV4W4aS7H7Y7EpkOxE=; b=ETyFYHyXYTfVbjjo/+d/3uL6tUzrXdyUw6pc14booToUPl0WE0wpacN5zjgJ7asSkNHgb8sleJLaYjL4IyEAUCm5LDUDgJaV628tCs/8IR1QPgRBN6tIdUmMoJkSFl1aK1kHC3k9Wmy0Q31pUnCb8fDZtoPBMrGt4Yz9gpB1F0o9tiWdohg9r+KnNt5rpNE74YfdefzrTjqPXsAAQMDbNcmVC1iCR0WM+XOGRMVN+RSFHhytHg5M4mUNTJXOllQAcdFwPArjUxUR+mScB1y+L/o5IZ1Va48Vvu/1BZ06Ot5WnQWYGv3lTvw75YUubSvYg1vmuMxNDV8mZlgP6tpMEw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM0PR0302MB3203.eurprd03.prod.outlook.com (2603:10a6:208:11::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.22; Thu, 3 Feb 2022 01:06:40 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22%6]) with mapi id 15.20.4951.011; Thu, 3 Feb 2022 01:06:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Feb 2022 02:06:24 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [I6cAn1FhmU88aMzPsDt/zF1NkOMt5qrK] X-ClientProxiedBy: AS8PR04CA0125.eurprd04.prod.outlook.com (2603:10a6:20b:127::10) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220203010631.1929837-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7e945ef-6fa9-4b2c-7810-08d9e6b16eb3 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEs6bi2B2Md8122fePlSqn4e/SWDZso4xSgsF9PDrLsy9iMrWI+d6ofSnWBNsGTo6KxGHeS4H1eWdMsIIpzz0AdO/SE1t3HTEYCrtAMI74X3QW/+pbjbIhLoBZcH3rnK3GC4bcd7Ump/lf5a7CtCSIrTweP9ACP223KC+XF58iI2h0Z76eqCqmaVND/k0iDokmHpIxHP672MuQ1JwIufPoItBktlDWXLG8gyVuwIAlsfIDI6SvM+0p8pk3NUvinHiz6MhHUeHNNUSqHT/Av9eV9d+4rWkMHKQaVu7HxUAL7gMl6Ja3PTnGG+8hwqt62cTy0XDULiI+9DAV3wf/vTFVl4XOY8ip/BpSmL3qGtJAdK76fT4cJGulE6xE39DmDHRVEoxtCuWIrGomMCDKMFnj7tJERf7Z++nKpdFaz7fWvWkxeswoDgiOCluqq8XgfPxqJMyb1otgjNP/W1Ab0S/YfWBrM8Y96OGZdyK2tFmwYbUtF0dxIO55US+7buI0v1RN1fayUAaSmMd4r9EbtSUlL4B34Dtej6Y+4ZdrtY92PIwuNoa18tITmmxe2btLI8G+M+kba49mvUAnQ7XBw+6vJsRqQdrIExq4xyEBsF24ziV59uSVT+VqzkJ9xXV+a7bOu+rSZoa7P828smAHwEAFsmZrP0KwlI6McTf54cIf/irxpOIqSVCDRHjnR/3qWZwevp56tWbIF+d97sG6Xr3OuaoM9vrwEKiMebrask/KBTebYwUW7qMXNSkbT6JKXOwXXYEqylJR4nRmuMT58h85uz X-MS-TrafficTypeDiagnostic: AM0PR0302MB3203:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V0iot54/PJWQuf9NfxVHsd8WlJ/8ZSThpwpdRYH6arTYUo0qIv88rhwaz8srnaV948GN5NB8USCIwYK5oHF2f6+JG43m6qiysHrRZ+6yVAkzWawawee9lgbsGHVFyLzGdkbJq+Wbg8H0JNvYs9fIJ78szunodcjXlOHKGdHApuUYMHgR1leUVjFjq8kK2Z8YxGX6wFI/ldStnmZCa1VHkHqdCqWMBPUJt7ZDSfq6MUZvmlabJcBWIencBOz3TpwLMXxQLna6DrQYlVTuW50yUCuQwY9BJ5xCN6j1QzPvz+ahzkzmJFnN/Kr26AlEiqK1qOaUSwM4HbhVbveXoeMK3FsNK5GQaQCMK6K79aZmsvQwP8sGfV85bG6VdIc/drU4BJJ/wPchnXxBf6T/1DQNJ9Bqpd3djJ8GfFme0AjxAAOAtsda8LSUFOjmG29ysLX3SAVoDgD6FfR+aH05lZ1TB9w8ov17CvxdCcHqJjiChOKFPHWmKDtMCP+HvXdugDOdHJBG7yL7AwaoeSdv7r5jBLdWo8OCmKbjxReLxX1bJbXboYDLSnXByldkShe3oa3FXhM30qTPIf31ByZ+ADiLBg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OL5xSiUSYin3h/SsVNo7A4U5+DnrnyWzsdwZ3wvL0p30WGKLV3P0Y+6QSU8WIvUo6p4z5FA/W2MDobPWIppINJT+OpFpzw+/J+PJcIh6GUWm8u/WPJ4LgHeNKH+9DFYABUB7nM2kwLO44t1jBzjCBrTFmhebzxzU4OxGaEtMBBtdra3uWMIPEAOU8aTAXCatVhs0EoiEV90rDSaBnNjoyqK6NXm0ARryRb3mwG55PdCehKTn+FOJLVbptdX6+X6yMaqH9jJhQwjdLf9vW7cmJf2C3BlX/IplJzTq4DtPUJdk6lsYpzyro2/pdCqMkY7/kpnNfWPxBodkbDmEoR9gv8rN25VCsAp3L+qRnSB/PE/pJJxoRgRd8EVQx0QTdNsGPy/Hc7l32M/wS6N1hDRDEzAVAzb2lD1Czu524g7iWnMX7TOmbpZW54FTkMrkQEFjJDJvrIWDC2nxuVwHM53H8tzghepGKVvT1D+cgEtXQKqOpTinsWETlqoYleygCS2FIQszmszcbc2hII9T32/rnYb+x+5Gpu0eI/hzz7+CRD2bc+w7u3kim4E/U7qGELnY5toiFdud6nLuMZ5y6ZeF2qpld2VjOrUG3Vobjy6GFoZAb2fMv4auiD0wOp8F6D4HG77PdUONv0bZvUDyMj79JdCN5t7tPm0Ndj/3Vr9q81JFcnD9ofo2FBdYt01GfVz2Gp8MouEk9P90BLhrMBU7os/N5G5Q0Ys48KYyE0ilNgy0oF3PQRxiyuzvIMAZhx2GP4XILEOWwYeTPfPPNNZ2Tq5Ca60twrxHuOqRdRfOnFmNx9cQr0Pfl0R6tgNiYtjL4YWLdF5/99Lw2LrQSKPggP/ItkrGlxzk4hTdnoyiXynqI9SSvQw85DFsDYj1k1VEFoHvQgjbE3IqpPZlUlNt26eLkbF0uON8CQzafrOYMFsdOYktkX+ONLwo0IgfE9ufHzn52FlnOqTkxD9YsnBKhw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7e945ef-6fa9-4b2c-7810-08d9e6b16eb3 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2022 01:06:40.4383 (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: AM0PR0302MB3203 Subject: [FFmpeg-devel] [PATCH 73/80] avcodec/h263dec.h: Add H263DecContext 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: S63GaVGtIwGl This is in preparation for moving fields only used by h263dec-based decoders from MPVContext. Signed-off-by: Andreas Rheinhardt --- libavcodec/dxva2_vc1.c | 16 +++++------ libavcodec/flvdec.c | 6 ++-- libavcodec/flvdec.h | 4 +-- libavcodec/h263dec.c | 34 ++++++++++++----------- libavcodec/h263dec.h | 10 +++++-- libavcodec/intelh263dec.c | 8 +++--- libavcodec/ituh263dec.c | 10 +++---- libavcodec/mpeg4video_parser.c | 6 ++-- libavcodec/mpeg4videodec.c | 51 +++++++++++++++++++--------------- libavcodec/mpeg4videodec.h | 3 +- libavcodec/msmpeg4dec.c | 21 +++++++------- libavcodec/msmpeg4dec.h | 5 ++-- libavcodec/mss2.c | 8 +++--- libavcodec/nvdec_mpeg4.c | 3 +- libavcodec/nvdec_vc1.c | 4 +-- libavcodec/rv10.c | 10 ++++--- libavcodec/vaapi_mpeg4.c | 2 +- libavcodec/vaapi_vc1.c | 50 ++++++++++++++++----------------- libavcodec/vc1.c | 24 ++++++++-------- libavcodec/vc1.h | 4 +-- libavcodec/vc1_block.c | 40 +++++++++++++------------- libavcodec/vc1_loopfilter.c | 28 +++++++++---------- libavcodec/vc1_mc.c | 14 +++++----- libavcodec/vc1_parser.c | 8 +++--- libavcodec/vc1_pred.c | 22 +++++++-------- libavcodec/vc1dec.c | 16 +++++------ libavcodec/vdpau_mpeg4.c | 2 +- libavcodec/vdpau_vc1.c | 6 ++-- libavcodec/wmv2dec.c | 28 +++++++++---------- libavcodec/wmv2dec.h | 5 ++-- 30 files changed, 234 insertions(+), 214 deletions(-) diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index d901f023df..e30b432fc6 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -41,7 +41,7 @@ static void fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, const VC1Context *v, DXVA_PictureParameters *pp) { - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; const Picture *current_picture = s->current_picture_ptr; int intcomp = 0; @@ -164,7 +164,7 @@ static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size) { const VC1Context *v = avctx->priv_data; - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; memset(slice, 0, sizeof(*slice)); slice->wHorizontalPosition = 0; @@ -186,7 +186,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; static const uint8_t start_code[] = { 0, 0, 1, 0x0d }; @@ -313,7 +313,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); - struct dxva2_picture_context *ctx_pic = v->s.s.current_picture_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->h.m.s.current_picture_ptr->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; @@ -332,7 +332,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, uint32_t size) { const VC1Context *v = avctx->priv_data; - const Picture *current_picture = v->s.s.current_picture_ptr; + const Picture *current_picture = v->h.m.s.current_picture_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; unsigned position; @@ -360,18 +360,18 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, static int dxva2_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - struct dxva2_picture_context *ctx_pic = v->s.s.current_picture_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->h.m.s.current_picture_ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, v->s.s.current_picture_ptr->f, + ret = ff_dxva2_common_end_frame(avctx, v->h.m.s.current_picture_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, commit_bitstream_and_slice_buffer); if (!ret) - ff_mpeg_draw_horiz_band(&v->s.s, 0, avctx->height); + ff_mpeg_draw_horiz_band(&v->h.m.s, 0, avctx->height); return ret; } diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index 469a8ceae9..3c14f2c54c 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -26,9 +26,9 @@ #include "mpegvideodata.h" #include "mpegvideodec.h" -int ff_flv_decode_picture_header(MPVMainDecContext *m) +int ff_flv_decode_picture_header(H263DecContext *h) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int format, width, height; /* picture header */ @@ -119,7 +119,7 @@ const AVCodec ff_flv_decoder = { .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_FLV1, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_h263_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, diff --git a/libavcodec/flvdec.h b/libavcodec/flvdec.h index 9cbd178192..7a9c9ff5c0 100644 --- a/libavcodec/flvdec.h +++ b/libavcodec/flvdec.h @@ -21,8 +21,8 @@ #ifndef AVCODEC_FLVDEC_H #define AVCODEC_FLVDEC_H -#include "mpegvideodec.h" +#include "h263dec.h" -int ff_flv_decode_picture_header(MPVMainDecContext *m); +int ff_flv_decode_picture_header(H263DecContext *m); #endif /* AVCODEC_FLVDEC_H */ diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index dc09d2e15c..4327aec54d 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -75,7 +75,8 @@ static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) av_cold int ff_h263_decode_init(AVCodecContext *avctx) { - MPVMainDecContext *const m = avctx->priv_data; + H263DecContext *const h = avctx->priv_data; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int ret; @@ -168,9 +169,9 @@ av_cold int ff_h263_decode_end(AVCodecContext *avctx) /** * Return the number of bytes consumed for building the current frame. */ -static int get_consumed_bytes(MPVMainDecContext *m, int buf_size) +static int get_consumed_bytes(H263DecContext *h, int buf_size) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int pos = (get_bits_count(&s->gb) + 7) >> 3; if (s->divx_packed || s->avctx->hwaccel) { @@ -430,6 +431,7 @@ static int decode_slice(MPVMainDecContext *m) int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { + H263DecContext *const h = avctx->priv_data; MPVMainDecContext *const m = avctx->priv_data; MPVMainContext *const m2 = m; MPVDecContext *const s = &m2->s; @@ -505,9 +507,9 @@ retry: /* let's go :-) */ if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { - ret = ff_wmv2_decode_picture_header(m); + ret = ff_wmv2_decode_picture_header(h); } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) { - ret = ff_msmpeg4_decode_picture_header(m); + ret = ff_msmpeg4_decode_picture_header(h); } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { if (s->avctx->extradata_size && s->picture_number == 0) { GetBitContext gb; @@ -517,11 +519,11 @@ retry: } ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0); } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { - ret = ff_intel_h263_decode_picture_header(m); + ret = ff_intel_h263_decode_picture_header(h); } else if (CONFIG_FLV_DECODER && s->h263_flv) { - ret = ff_flv_decode_picture_header(m); + ret = ff_flv_decode_picture_header(h); } else { - ret = ff_h263_decode_picture_header(m); + ret = ff_h263_decode_picture_header(h); } if (ret < 0 || ret == FRAME_SKIPPED) { @@ -533,7 +535,7 @@ retry: } } if (ret == FRAME_SKIPPED) - return get_consumed_bytes(m, buf_size); + return get_consumed_bytes(h, buf_size); /* skip if the header was thrashed */ if (ret < 0) { @@ -601,13 +603,13 @@ retry: /* skip B-frames if we don't have reference frames */ if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) - return get_consumed_bytes(m, buf_size); + return get_consumed_bytes(h, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) - return get_consumed_bytes(m, buf_size); + return get_consumed_bytes(h, buf_size); if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; @@ -636,7 +638,7 @@ retry: * are stored in current_picture->mb_type which is not available before * ff_mpv_frame_start() */ if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { - ret = ff_wmv2_decode_secondary_picture_header(m); + ret = ff_wmv2_decode_secondary_picture_header(h); if (ret < 0) return ret; if (ret == 1) @@ -671,7 +673,7 @@ retry: if (s->msmpeg4_version && s->msmpeg4_version < 4 && s->pict_type == AV_PICTURE_TYPE_I) if (!CONFIG_MSMPEG4_DECODER || - ff_msmpeg4_decode_ext_header(m, buf_size) < 0) + ff_msmpeg4_decode_ext_header(h, buf_size) < 0) s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR; av_assert1(s->bitstream_buffer_size == 0); @@ -729,7 +731,7 @@ frame_end: if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) return slice_ret; else - return get_consumed_bytes(m, buf_size); + return get_consumed_bytes(h, buf_size); } const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = { @@ -770,7 +772,7 @@ const AVCodec ff_h263_decoder = { .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_H263, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_h263_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, @@ -791,7 +793,7 @@ const AVCodec ff_h263p_decoder = { .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_H263P, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_h263_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h index bab3e03fb3..b007372f64 100644 --- a/libavcodec/h263dec.h +++ b/libavcodec/h263dec.h @@ -40,6 +40,10 @@ extern VLC ff_h263_mv_vlc; extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]; +typedef struct H263DecContext { + MPVMainDecContext m; +} H263DecContext; + int ff_h263_decode_motion(MPVDecContext *s, int pred, int f_code); int ff_h263_decode_init(AVCodecContext *avctx); int ff_h263_decode_frame(AVCodecContext *avctx, @@ -47,15 +51,15 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVPacket *avpkt); int ff_h263_decode_end(AVCodecContext *avctx); void ff_h263_decode_init_vlc(void); -int ff_h263_decode_picture_header(MPVMainDecContext *m); +int ff_h263_decode_picture_header(H263DecContext *h); int ff_h263_decode_mba(MPVDecContext *s); /** * Print picture info if FF_DEBUG_PICT_INFO is set. */ -void ff_h263_show_pict_info(MPVMainDecContext *m); +void ff_h263_show_pict_info(H263DecContext *h); -int ff_intel_h263_decode_picture_header(MPVMainDecContext *m); +int ff_intel_h263_decode_picture_header(H263DecContext *h); int ff_h263_decode_mb(MPVDecContext *s, int16_t block[6][64]); diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index e26d45ec20..deed9152ea 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -26,9 +26,9 @@ #include "mpegvideodata.h" /* don't understand why they choose a different header ! */ -int ff_intel_h263_decode_picture_header(MPVMainDecContext *m) +int ff_intel_h263_decode_picture_header(H263DecContext *h) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int format; if (get_bits_left(&s->gb) == 64) { /* special dummy frames */ @@ -125,7 +125,7 @@ int ff_intel_h263_decode_picture_header(MPVMainDecContext *m) s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; - ff_h263_show_pict_info(m); + ff_h263_show_pict_info(h); return 0; } @@ -135,7 +135,7 @@ const AVCodec ff_h263i_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_H263I, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_h263_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 9cfdac63d6..9e92ed94ce 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -73,9 +73,9 @@ static const int h263_mb_type_b_map[15]= { MB_TYPE_INTRA4x4 | MB_TYPE_CBP | MB_TYPE_QUANT, }; -void ff_h263_show_pict_info(MPVMainDecContext *m) +void ff_h263_show_pict_info(H263DecContext *h) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n", s->qscale, av_get_picture_type_char(s->pict_type), @@ -1088,9 +1088,9 @@ end: } /* Most is hardcoded; should extend to handle all H.263 streams. */ -int ff_h263_decode_picture_header(MPVMainDecContext *m) +int ff_h263_decode_picture_header(H263DecContext *h) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int format, width, height, i, ret; uint32_t startcode; @@ -1369,7 +1369,7 @@ int ff_h263_decode_picture_header(MPVMainDecContext *m) s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } - ff_h263_show_pict_info(m); + ff_h263_show_pict_info(h); if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c index a7909d92ec..fc6fffdf99 100644 --- a/libavcodec/mpeg4video_parser.c +++ b/libavcodec/mpeg4video_parser.c @@ -92,7 +92,7 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, { struct Mp4vParseContext *pc = s1->priv_data; Mpeg4DecContext *dec_ctx = &pc->dec_ctx; - MPVDecContext *const s = &dec_ctx->m.s; + MPVDecContext *const s = &dec_ctx->h.m.s; GetBitContext gb1, *gb = &gb1; int ret; @@ -131,8 +131,8 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s) struct Mp4vParseContext *pc = s->priv_data; pc->first_picture = 1; - pc->dec_ctx.m.s.quant_precision = 5; - pc->dec_ctx.m.slice_context_count = 1; + pc->dec_ctx.h.m.s.quant_precision = 5; + pc->dec_ctx.h.m.slice_context_count = 1; pc->dec_ctx.showed_packed_warning = 1; return 0; } diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index ca6988fc48..854ccd5ade 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -195,7 +195,7 @@ void ff_mpeg4_pred_ac(MPVDecContext *s, int16_t *block, int n, int dir) */ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int bits_count = get_bits_count(&s->gb); int v = show_bits(&s->gb, 16); @@ -245,7 +245,7 @@ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int a = 2 << s->sprite_warping_accuracy; int rho = 3 - s->sprite_warping_accuracy; int r = 16 / a; @@ -497,7 +497,7 @@ overflow: } static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int len = FFMIN(ctx->time_increment_bits + 3, 15); get_bits(gb, len); @@ -514,7 +514,7 @@ static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb) { */ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int mb_num_bits = av_log2(s->mb_num - 1) + 1; int header_extension = 0, mb_num, len; @@ -615,7 +615,7 @@ static void reset_studio_dc_predictors(MPVDecContext *s) */ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; GetBitContext *gb = &s->gb; unsigned vlc_len; uint16_t mb_num; @@ -657,7 +657,7 @@ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx) */ static inline int get_amv(Mpeg4DecContext *ctx, int n) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int x, y, mb_v, sum, dx, dy, shift; int len = 1 << (s->f_code + 4); const int a = s->sprite_warping_accuracy; @@ -757,7 +757,7 @@ static inline int mpeg4_decode_dc(MPVDecContext *s, int n, int *dir_ptr) */ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int mb_num = 0; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; @@ -1044,7 +1044,7 @@ static int mpeg4_decode_partition_b(MPVDecContext *s, int mb_count) */ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int mb_num; int ret; const int part_a_error = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_ERROR | ER_MV_ERROR) : ER_MV_ERROR; @@ -1111,7 +1111,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, int n, int coded, int intra, int use_intra_dc_vlc, int rvlc) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int level, i, last, run, qmul, qadd; int av_uninit(dc_pred_dir); RLTable *rl; @@ -2288,7 +2288,7 @@ static void extension_and_user_data(MPVDecContext *s, GetBitContext *gb, int id) static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVMainDecContext *const m = &ctx->m; + MPVMainDecContext *const m = &ctx->h.m; MPVDecContext *const s = &m->s; int width, height, aspect_ratio_info; int bits_per_raw_sample; @@ -2375,7 +2375,8 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int width, height, vo_ver_id, aspect_ratio_info; @@ -2751,7 +2752,8 @@ no_cplx_est: */ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVDecContext *const s = &ctx->m.s; + H263DecContext *const h = &ctx->h; + MPVDecContext *const s = &h->m.s; char buf[256]; int i; int e; @@ -2809,7 +2811,7 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) { Mpeg4DecContext *ctx = avctx->priv_data; - MPVMainDecContext *const m = &ctx->m; + MPVMainDecContext *const m = &ctx->h.m; MPVDecContext *const s = &m->s; if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == -1) { @@ -2928,7 +2930,8 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, int parse_only) { - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int time_incr, time_increment; int64_t pts; @@ -3211,7 +3214,7 @@ end: static void decode_smpte_tc(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; skip_bits(gb, 16); /* Time_code[63..48] */ check_marker(s->avctx, gb, "after Time_code[63..48]"); @@ -3230,7 +3233,8 @@ static void decode_smpte_tc(Mpeg4DecContext *ctx, GetBitContext *gb) */ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; if (get_bits_left(gb) <= 32) @@ -3286,7 +3290,7 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb) { - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; int visual_object_type; skip_bits(gb, 4); /* visual_object_verid */ @@ -3315,7 +3319,8 @@ static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb) int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb, int header, int parse_only) { - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; unsigned startcode, v; int ret; @@ -3474,7 +3479,8 @@ end: int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { Mpeg4DecContext *ctx = avctx->priv_data; - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; /* divx 5.01+ bitstream reorder stuff */ @@ -3527,7 +3533,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, { Mpeg4DecContext *s = dst->priv_data; const Mpeg4DecContext *s1 = src->priv_data; - int init = s->m.context_initialized; + int init = s->h.m.context_initialized; int ret = ff_mpeg_update_thread_context(dst, src); @@ -3563,7 +3569,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj)); if (CONFIG_MPEG4_DECODER && !init && s1->xvid_build >= 0) - ff_xvid_idct_init(&s->m.s.idsp, dst); + ff_xvid_idct_init(&s->h.m.s.idsp, dst); return 0; } @@ -3632,7 +3638,8 @@ static av_cold int decode_init(AVCodecContext *avctx) { static AVOnce init_static_once = AV_ONCE_INIT; Mpeg4DecContext *ctx = avctx->priv_data; - MPVMainDecContext *const m = &ctx->m; + H263DecContext *const h = &ctx->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int ret; diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h index 191fe53836..2d682c0c78 100644 --- a/libavcodec/mpeg4videodec.h +++ b/libavcodec/mpeg4videodec.h @@ -26,11 +26,12 @@ #include #include "get_bits.h" +#include "h263dec.h" #include "mpegvideodec.h" typedef struct Mpeg4DecContext { - MPVMainDecContext m; + H263DecContext h; /// number of bits to represent the fractional part of time int time_increment_bits; diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index f02181e075..b1f4df7aa9 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -296,7 +296,8 @@ static int msmpeg4v34_decode_mb(MPVDecContext *s, int16_t block[6][64]) /* init all vlc decoding tables */ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) { - MPVMainDecContext *const m = avctx->priv_data; + H263DecContext *const h = avctx->priv_data; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; static volatile int done = 0; int ret; @@ -400,9 +401,9 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) return 0; } -int ff_msmpeg4_decode_picture_header(MPVMainDecContext *m) +int ff_msmpeg4_decode_picture_header(H263DecContext *h) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int code; // at minimum one bit per macroblock is required at least in a valid frame, @@ -469,7 +470,7 @@ int ff_msmpeg4_decode_picture_header(MPVMainDecContext *m) s->dc_table_index = get_bits1(&s->gb); break; case 4: - ff_msmpeg4_decode_ext_header(m, (2+5+5+17+7)/8); + ff_msmpeg4_decode_ext_header(h, (2+5+5+17+7)/8); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); else s->per_mb_rl_table= 0; @@ -557,9 +558,9 @@ int ff_msmpeg4_decode_picture_header(MPVMainDecContext *m) return 0; } -int ff_msmpeg4_decode_ext_header(MPVMainDecContext *m, int buf_size) +int ff_msmpeg4_decode_ext_header(H263DecContext *h, int buf_size) { - MPVDecContext *const s = &m->s; + MPVDecContext *const s = &h->m.s; int left= buf_size*8 - get_bits_count(&s->gb); int length= s->msmpeg4_version>=3 ? 17 : 16; /* the alt_bitstream reader could read over the end so we need to check it */ @@ -866,7 +867,7 @@ const AVCodec ff_msmpeg4v1_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_MSMPEG4V1, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_msmpeg4_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, @@ -884,7 +885,7 @@ const AVCodec ff_msmpeg4v2_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_MSMPEG4V2, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_msmpeg4_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, @@ -902,7 +903,7 @@ const AVCodec ff_msmpeg4v3_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_MSMPEG4V3, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_msmpeg4_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, @@ -920,7 +921,7 @@ const AVCodec ff_wmv1_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_WMV1, - .priv_data_size = sizeof(MPVMainDecContext), + .priv_data_size = sizeof(H263DecContext), .init = ff_msmpeg4_decode_init, .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, diff --git a/libavcodec/msmpeg4dec.h b/libavcodec/msmpeg4dec.h index 37f0f090e1..d3b18bbe05 100644 --- a/libavcodec/msmpeg4dec.h +++ b/libavcodec/msmpeg4dec.h @@ -24,6 +24,7 @@ #include "config.h" #include "avcodec.h" +#include "h263dec.h" #include "mpegvideodec.h" #define INTER_INTRA_VLC_BITS 3 @@ -34,8 +35,8 @@ extern VLC ff_mb_non_intra_vlc[4]; extern VLC ff_inter_intra_vlc; int ff_msmpeg4_decode_init(AVCodecContext *avctx); -int ff_msmpeg4_decode_picture_header(MPVMainDecContext *m); -int ff_msmpeg4_decode_ext_header(MPVMainDecContext *m, int buf_size); +int ff_msmpeg4_decode_picture_header(H263DecContext *h); +int ff_msmpeg4_decode_ext_header(H263DecContext *h, int buf_size); void ff_msmpeg4_decode_motion(MPVDecContext *s, int *mx_ptr, int *my_ptr); int ff_msmpeg4_decode_block(MPVDecContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table); diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index f650a84e8d..5ee156d56a 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -382,7 +382,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, MSS2Context *ctx = avctx->priv_data; MSS12Context *c = &ctx->c; VC1Context *v = avctx->priv_data; - MPVMainDecContext *const m = &v->s; + MPVMainDecContext *const m = &v->h.m; MPVDecContext *const s = &m->s; AVFrame *f; int ret; @@ -751,7 +751,7 @@ static av_cold int wmv9_init(AVCodecContext *avctx) VC1Context *v = avctx->priv_data; int ret; - v->s.s.avctx = avctx; + v->h.m.s.avctx = avctx; ff_vc1_init_common(v); @@ -797,8 +797,8 @@ static av_cold int wmv9_init(AVCodecContext *avctx) return ret; /* error concealment */ - v->s.s.me.qpel_put = v->s.s.qdsp.put_qpel_pixels_tab; - v->s.s.me.qpel_avg = v->s.s.qdsp.avg_qpel_pixels_tab; + v->h.m.s.me.qpel_put = v->h.m.s.qdsp.put_qpel_pixels_tab; + v->h.m.s.me.qpel_avg = v->h.m.s.qdsp.avg_qpel_pixels_tab; return 0; } diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c index 5c37dba3e4..6d5ac8cd07 100644 --- a/libavcodec/nvdec_mpeg4.c +++ b/libavcodec/nvdec_mpeg4.c @@ -30,7 +30,8 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { Mpeg4DecContext *m = avctx->priv_data; - MPVDecContext *const s = &m->m.s; + H263DecContext *const h = &m->h; + MPVDecContext *const s = &h->m.s; NVDECContext *ctx = avctx->internal->hwaccel_priv_data; CUVIDPICPARAMS *pp = &ctx->pic_params; diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c index e8cae4d724..78b3213e04 100644 --- a/libavcodec/nvdec_vc1.c +++ b/libavcodec/nvdec_vc1.c @@ -28,7 +28,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { VC1Context *v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; NVDECContext *ctx = avctx->internal->hwaccel_priv_data; CUVIDPICPARAMS *pp = &ctx->pic_params; @@ -87,7 +87,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u .extended_mv = v->extended_mv, .dquant = v->dquant, .vstransform = v->vstransform, - .loopfilter = v->s.s.loop_filter, + .loopfilter = v->h.m.s.loop_filter, .fastuvmc = v->fastuvmc, .overlap = v->overlap, .quantizer = v->quantizer_mode, diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 27e17c8677..1fbd99a965 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -52,7 +52,7 @@ #define DC_VLC_BITS 9 typedef struct RVDecContext { - MPVMainDecContext m; + H263DecContext h; int sub_id; int orig_width, orig_height; } RVDecContext; @@ -157,7 +157,7 @@ static int rv10_decode_picture_header(MPVDecContext *s) static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) { - MPVMainDecContext *const m = &rv->m; + MPVMainDecContext *const m = &rv->h.m; MPVDecContext *const s = &m->s; int seq, mb_pos, i, ret; int rpr_max; @@ -368,7 +368,8 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) { static AVOnce init_static_once = AV_ONCE_INIT; RVDecContext *rv = avctx->priv_data; - MPVMainDecContext *const m = &rv->m; + H263DecContext *const h = &rv->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int major_ver, minor_ver, micro_ver, ret; @@ -445,7 +446,8 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int buf_size2, int whole_size) { RVDecContext *rv = avctx->priv_data; - MPVMainDecContext *const m = &rv->m; + H263DecContext *const h = &rv->h; + MPVMainDecContext *const m = &h->m; MPVDecContext *const s = &m->s; int mb_count, mb_pos, left, start_mb_x, active_bits_size, ret; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 0a0c2d0f8e..ccee6fb06e 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -47,7 +47,7 @@ static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s) static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; VAPictureParameterBufferMPEG4 pic_param; int i, err; diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index fd3b963e33..e8dc79ba62 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -46,7 +46,7 @@ static inline int vc1_has_MVTYPEMB_bitplane(const VC1Context *v) if (v->mv_type_is_raw) return 0; return v->fcm == PROGRESSIVE && - (v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && + (v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && (v->mv_mode == MV_PMODE_MIXED_MV || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV)); @@ -58,8 +58,8 @@ static inline int vc1_has_SKIPMB_bitplane(const VC1Context *v) if (v->skip_is_raw) return 0; return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && - ((v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || - (v->s.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)); + ((v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)); } /** Check whether the DIRECTMB bitplane is present */ @@ -68,7 +68,7 @@ static inline int vc1_has_DIRECTMB_bitplane(const VC1Context *v) if (v->dmb_is_raw) return 0; return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && - (v->s.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); } /** Check whether the ACPRED bitplane is present */ @@ -77,8 +77,8 @@ static inline int vc1_has_ACPRED_bitplane(const VC1Context *v) if (v->acpred_is_raw) return 0; return v->profile == PROFILE_ADVANCED && - (v->s.s.pict_type == AV_PICTURE_TYPE_I || - (v->s.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); + (v->h.m.s.pict_type == AV_PICTURE_TYPE_I || + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); } /** Check whether the OVERFLAGS bitplane is present */ @@ -87,8 +87,8 @@ static inline int vc1_has_OVERFLAGS_bitplane(const VC1Context *v) if (v->overflg_is_raw) return 0; return v->profile == PROFILE_ADVANCED && - (v->s.s.pict_type == AV_PICTURE_TYPE_I || - (v->s.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)) && + (v->h.m.s.pict_type == AV_PICTURE_TYPE_I || + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)) && (v->overlap && v->pq <= 8) && v->condover == CONDOVER_SELECT; } @@ -99,8 +99,8 @@ static inline int vc1_has_FIELDTX_bitplane(const VC1Context *v) if (v->fieldtx_is_raw) return 0; return v->fcm == ILACE_FRAME && - (v->s.s.pict_type == AV_PICTURE_TYPE_I || - (v->s.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); + (v->h.m.s.pict_type == AV_PICTURE_TYPE_I || + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); } /** Check whether the FORWARDMB bitplane is present */ @@ -109,13 +109,13 @@ static inline int vc1_has_FORWARDMB_bitplane(const VC1Context *v) if (v->fmb_is_raw) return 0; return v->fcm == ILACE_FIELD && - (v->s.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); } /** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */ static int vc1_get_PTYPE(const VC1Context *v) { - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; switch (s->pict_type) { case AV_PICTURE_TYPE_I: return 0; case AV_PICTURE_TYPE_P: return v->p_frame_skipped ? 4 : 1; @@ -127,7 +127,7 @@ static int vc1_get_PTYPE(const VC1Context *v) /** Reconstruct bitstream FPTYPE (9.1.1.42, index into Table-105) */ static int vc1_get_FPTYPE(const VC1Context *v) { - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; switch (s->pict_type) { case AV_PICTURE_TYPE_I: return 0; case AV_PICTURE_TYPE_P: return 3; @@ -140,8 +140,8 @@ static int vc1_get_FPTYPE(const VC1Context *v) static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v) { if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) && - ((v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || - (v->s.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))) + ((v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || + (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))) return get_VAMvModeVC1(v->mv_mode); return 0; } @@ -150,7 +150,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v) static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v) { if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) && - (v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && + (v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && v->mv_mode == MV_PMODE_INTENSITY_COMP) return get_VAMvModeVC1(v->mv_mode2); return 0; @@ -158,7 +158,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v) av_unused static inline int vc1_get_INTCOMPFIELD(const VC1Context *v) { - if ((v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && + if ((v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP) switch (v->intcompfield) { @@ -171,7 +171,7 @@ av_unused static inline int vc1_get_INTCOMPFIELD(const VC1Context *v) static inline int vc1_get_LUMSCALE(const VC1Context *v) { - if (v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) { + if (v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) { if ((v->fcm == PROGRESSIVE && v->mv_mode == MV_PMODE_INTENSITY_COMP) || (v->fcm == ILACE_FRAME && v->intcomp)) return v->lumscale; @@ -187,7 +187,7 @@ static inline int vc1_get_LUMSCALE(const VC1Context *v) static inline int vc1_get_LUMSHIFT(const VC1Context *v) { - if (v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) { + if (v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) { if ((v->fcm == PROGRESSIVE && v->mv_mode == MV_PMODE_INTENSITY_COMP) || (v->fcm == ILACE_FRAME && v->intcomp)) return v->lumshift; @@ -203,7 +203,7 @@ static inline int vc1_get_LUMSHIFT(const VC1Context *v) av_unused static inline int vc1_get_LUMSCALE2(const VC1Context *v) { - if ((v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && + if ((v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP && v->intcompfield == 3) @@ -213,7 +213,7 @@ av_unused static inline int vc1_get_LUMSCALE2(const VC1Context *v) av_unused static inline int vc1_get_LUMSHIFT2(const VC1Context *v) { - if ((v->s.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && + if ((v->h.m.s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP && v->intcompfield == 3) @@ -251,7 +251,7 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const VC1Context *v = avctx->priv_data; - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; VAPictureParameterBufferVC1 pic_param; int err; @@ -367,7 +367,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t .frame_level_transform_type = vc1_get_TTFRM(v), .transform_ac_codingset_idx1 = v->c_ac_table_index, .transform_ac_codingset_idx2 = v->y_ac_table_index, - .intra_transform_dc_table = v->s.s.dc_table_index, + .intra_transform_dc_table = v->h.m.s.dc_table_index, }, }; @@ -448,7 +448,7 @@ fail: static int vaapi_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; int ret; @@ -465,7 +465,7 @@ fail: static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const VC1Context *v = avctx->priv_data; - const MPVDecContext *const s = &v->s.s; + const MPVDecContext *const s = &v->h.m.s; VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; VASliceParameterBufferVC1 slice_param; int mb_height; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 13a211e916..b923daf732 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -97,7 +97,7 @@ static void decode_colskip(uint8_t* plane, int width, int height, int stride, */ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int imode, x, y, code, offset; @@ -231,7 +231,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) */ static int vop_dquant_decoding(VC1Context *v) { - GetBitContext *gb = &v->s.s.gb; + GetBitContext *gb = &v->h.m.s.gb; int pqdiff; //variable size @@ -277,7 +277,7 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); */ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits_long(gb, 32)); v->profile = get_bits(gb, 2); @@ -400,7 +400,7 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; v->res_rtm_flag = 1; v->level = get_bits(gb, 3); @@ -522,9 +522,9 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex v->closed_entry = get_bits1(gb); v->panscanflag = get_bits1(gb); v->refdist_flag = get_bits1(gb); - v->s.s.loop_filter = get_bits1(gb); - if (v->s.s.avctx->skip_loop_filter >= AVDISCARD_ALL) - v->s.s.loop_filter = 0; + v->h.m.s.loop_filter = get_bits1(gb); + if (v->h.m.s.avctx->skip_loop_filter >= AVDISCARD_ALL) + v->h.m.s.loop_filter = 0; v->fastuvmc = get_bits1(gb); v->extended_mv = get_bits1(gb); v->dquant = get_bits(gb, 2); @@ -565,7 +565,7 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n" "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n" "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n", - v->broken_link, v->closed_entry, v->panscanflag, v->refdist_flag, v->s.s.loop_filter, + v->broken_link, v->closed_entry, v->panscanflag, v->refdist_flag, v->h.m.s.loop_filter, v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode); return 0; @@ -597,7 +597,7 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex static void rotate_luts(VC1Context *v) { #define ROTATE(DEF, L, N, C, A) do { \ - if (v->s.s.pict_type == AV_PICTURE_TYPE_BI || v->s.s.pict_type == AV_PICTURE_TYPE_B) { \ + if (v->h.m.s.pict_type == AV_PICTURE_TYPE_BI || v->h.m.s.pict_type == AV_PICTURE_TYPE_B) { \ C = A; \ } else { \ DEF; \ @@ -621,7 +621,7 @@ static int read_bfraction(VC1Context *v, GetBitContext* gb) { int bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); if (bfraction_lut_index == 21 || bfraction_lut_index < 0) { - av_log(v->s.s.avctx, AV_LOG_ERROR, "bfraction invalid\n"); + av_log(v->h.m.s.avctx, AV_LOG_ERROR, "bfraction invalid\n"); return AVERROR_INVALIDDATA; } v->bfraction_lut_index = bfraction_lut_index; @@ -631,7 +631,7 @@ static int read_bfraction(VC1Context *v, GetBitContext* gb) { int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pqindex, lowquant, status; v->field_mode = 0; @@ -856,7 +856,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pqindex, lowquant; int status; int field_mode, fcm; diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 6aa1a32352..850bf05d2c 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -24,8 +24,8 @@ #define AVCODEC_VC1_H #include "avcodec.h" +#include "h263dec.h" #include "h264chroma.h" -#include "mpegvideodec.h" #include "intrax8.h" #include "vc1_common.h" #include "vc1dsp.h" @@ -171,7 +171,7 @@ enum Imode { * Many members are only used for Advanced Profile */ typedef struct VC1Context{ - MPVMainDecContext s; + H263DecContext h; IntraX8Context x8; H264ChromaContext h264chroma; VC1DSPContext vc1dsp; diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 081c47894f..6284b75991 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -59,7 +59,7 @@ static const int block_map[6] = {0, 2, 1, 3, 4, 5}; static inline void init_block_index(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; ff_init_block_index(s); if (v->field_mode && !(v->second_field ^ v->tff)) { s->dest[0] += s->current_picture_ptr->f->linesize[0]; @@ -72,7 +72,7 @@ static inline void init_block_index(VC1Context *v) static void vc1_put_blocks_clamped(VC1Context *v, int put_signed) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; uint8_t *dest; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; int fieldtx = 0; @@ -263,9 +263,9 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed) static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, int *dmv_y, int *pred_flag) { + GetBitContext *const gb = &v->h.m.s.gb; int index, index1; int extend_x, extend_y; - GetBitContext *const gb = &v->s.s.gb; int bits, esc; int val, sign; @@ -512,7 +512,7 @@ static inline int vc1_coded_block_pred(MPVDecContext * s, int n, static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, int codingset) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int index, run, level, lst, sign; @@ -580,7 +580,7 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, int coded, int codingset) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; @@ -718,7 +718,7 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, int coded, int codingset, int mquant) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; @@ -910,7 +910,7 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, int coded, int mquant, int codingset) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; @@ -1120,7 +1120,7 @@ static int vc1_decode_p_block(VC1Context *v, int16_t block[64], int n, uint8_t *dst, int linesize, int skip_block, int *ttmb_out) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i, j; int subblkpat = 0; @@ -1289,7 +1289,7 @@ static const uint8_t size_table[6] = { 0, 2, 3, 4, 5, 8 }; */ static int vc1_decode_p_mb(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -1521,7 +1521,7 @@ end: static int vc1_decode_p_mb_intfr(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -1731,7 +1731,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) static int vc1_decode_p_mb_intfi(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -1855,7 +1855,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) */ static int vc1_decode_b_mb(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -2013,7 +2013,7 @@ static int vc1_decode_b_mb(VC1Context *v) */ static int vc1_decode_b_mb_intfi(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -2180,7 +2180,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) */ static int vc1_decode_b_mb_intfr(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -2530,7 +2530,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) */ static void vc1_decode_i_blocks(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int k, j; int cbp, val; uint8_t *coded_val; @@ -2655,7 +2655,7 @@ static void vc1_decode_i_blocks(VC1Context *v) */ static int vc1_decode_i_blocks_adv(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int k; int cbp, val; uint8_t *coded_val; @@ -2798,7 +2798,7 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) static void vc1_decode_p_blocks(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int apply_loop_filter; /* select coding mode used for VLC tables selection */ @@ -2890,7 +2890,7 @@ static void vc1_decode_p_blocks(VC1Context *v) static void vc1_decode_b_blocks(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; /* select coding mode used for VLC tables selection */ switch (v->c_ac_table_index) { @@ -2974,7 +2974,7 @@ static void vc1_decode_b_blocks(VC1Context *v) static void vc1_decode_skip_blocks(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; if (!s->last_picture.f->data[0]) return; @@ -2996,7 +2996,7 @@ static void vc1_decode_skip_blocks(VC1Context *v) void ff_vc1_decode_blocks(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; s->esc3_level_length = 0; if (v->x8_type) { diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c index d664392fc4..1438c073e8 100644 --- a/libavcodec/vc1_loopfilter.c +++ b/libavcodec/vc1_loopfilter.c @@ -104,7 +104,7 @@ static av_always_inline void vc1_v_overlap_filter(VC1Context *v, int16_t (*top_b void ff_vc1_i_overlap_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int16_t (*topleft_blk)[64], (*top_blk)[64], (*left_blk)[64], (*cur_blk)[64]; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -160,7 +160,7 @@ void ff_vc1_i_overlap_filter(VC1Context *v) void ff_vc1_p_overlap_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int16_t (*topleft_blk)[64], (*top_blk)[64], (*left_blk)[64], (*cur_blk)[64]; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; @@ -206,7 +206,7 @@ void ff_vc1_p_overlap_filter(VC1Context *v) static av_always_inline void vc1_i_h_loop_filter(VC1Context *v, uint8_t *dest, uint32_t flags, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint8_t *dst; @@ -239,7 +239,7 @@ static av_always_inline void vc1_i_v_loop_filter(VC1Context *v, uint8_t *dest, uint32_t flags, uint8_t fieldtx, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint8_t *dst; @@ -270,7 +270,7 @@ static av_always_inline void vc1_i_v_loop_filter(VC1Context *v, uint8_t *dest, void ff_vc1_i_loop_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; uint8_t *dest, fieldtx; @@ -364,7 +364,7 @@ static av_always_inline void vc1_p_h_loop_filter(VC1Context *v, uint8_t *dest, u uint8_t *is_intra, int16_t (*mv)[2], uint8_t *mv_f, int *ttblk, uint32_t flags, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint32_t left_cbp = cbp[0] >> (block_num * 4), right_cbp; uint8_t left_is_intra, right_is_intra; @@ -417,7 +417,7 @@ static av_always_inline void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, u uint8_t *is_intra, int16_t (*mv)[2], uint8_t *mv_f, int *ttblk, uint32_t flags, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint32_t top_cbp = cbp[0] >> (block_num * 4), bottom_cbp; uint8_t top_is_intra, bottom_is_intra; @@ -469,7 +469,7 @@ static av_always_inline void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, u void ff_vc1_p_loop_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; uint8_t *dest; uint32_t *cbp; @@ -802,7 +802,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk, uint32_t flags, uint8_t fieldtx, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; int tt; int linesize = block_num > 3 ? s->uvlinesize : s->linesize; @@ -852,7 +852,7 @@ static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *d static av_always_inline void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk, uint32_t flags, uint8_t fieldtx, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; int tt; int linesize = block_num > 3 ? s->uvlinesize : s->linesize; @@ -908,7 +908,7 @@ static av_always_inline void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *d void ff_vc1_p_intfr_loop_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; uint8_t *dest; @@ -1112,7 +1112,7 @@ void ff_vc1_p_intfr_loop_filter(VC1Context *v) static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp, int *ttblk, uint32_t flags, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint8_t *dst; uint32_t block_cbp = cbp[0] >> (block_num * 4); @@ -1144,7 +1144,7 @@ static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *d static av_always_inline void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp, int *ttblk, uint32_t flags, int block_num) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int pq = v->pq; uint8_t *dst; uint32_t block_cbp = cbp[0] >> (block_num * 4); @@ -1171,7 +1171,7 @@ static av_always_inline void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *d void ff_vc1_b_intfi_loop_filter(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; uint8_t *dest; uint32_t *cbp; diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 7942f6f373..b188a3e307 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -107,7 +107,7 @@ static const uint8_t popcount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, static av_always_inline int get_luma_mv(VC1Context *v, int dir, int16_t *tx, int16_t *ty) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int idx = v->mv_f[dir][s->block_index[0] + v->blocks_off] | (v->mv_f[dir][s->block_index[1] + v->blocks_off] << 1) | (v->mv_f[dir][s->block_index[2] + v->blocks_off] << 2) | @@ -139,7 +139,7 @@ static av_always_inline int get_luma_mv(VC1Context *v, int dir, int16_t *tx, int static av_always_inline int get_chroma_mv(VC1Context *v, int dir, int16_t *tx, int16_t *ty) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int idx = !v->mb_type[0][s->block_index[0]] | (!v->mb_type[0][s->block_index[1]] << 1) | (!v->mb_type[0][s->block_index[2]] << 2) | @@ -171,7 +171,7 @@ static av_always_inline int get_chroma_mv(VC1Context *v, int dir, int16_t *tx, i */ void ff_vc1_mc_1mv(VC1Context *v, int dir) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; @@ -451,7 +451,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) */ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; uint8_t *srcY; int dxy, mx, my, src_x, src_y; int off; @@ -633,7 +633,7 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) */ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcU, *srcV; int uvmx, uvmy, uvsrc_x, uvsrc_y; @@ -838,7 +838,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) */ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcU, *srcV; int uvsrc_x, uvsrc_y; @@ -1003,7 +1003,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) */ void ff_vc1_interp_mc(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index af5ff5028a..513f2ce192 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -65,7 +65,7 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx, VC1ParseContext *vpc = s->priv_data; GetBitContext gb; int ret; - vpc->v.s.s.avctx = avctx; + vpc->v.h.m.s.avctx = avctx; vpc->v.parse_only = 1; init_get_bits8(&gb, buf, buf_size); switch (vpc->prev_start_code) { @@ -85,10 +85,10 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx, break; /* keep AV_PICTURE_TYPE_BI internal to VC1 */ - if (vpc->v.s.s.pict_type == AV_PICTURE_TYPE_BI) + if (vpc->v.h.m.s.pict_type == AV_PICTURE_TYPE_BI) s->pict_type = AV_PICTURE_TYPE_B; else - s->pict_type = vpc->v.s.s.pict_type; + s->pict_type = vpc->v.h.m.s.pict_type; if (avctx->ticks_per_frame > 1){ // process pulldown flags @@ -259,7 +259,7 @@ static int vc1_parse(AVCodecParserContext *s, static av_cold int vc1_parse_init(AVCodecParserContext *s) { VC1ParseContext *vpc = s->priv_data; - vpc->v.s.slice_context_count = 1; + vpc->v.h.m.slice_context_count = 1; vpc->v.first_pic_header_flag = 1; vpc->prev_start_code = 0; vpc->bytes_to_skip = 0; diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index 2924aff9e6..85f3ba8b13 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -40,7 +40,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di int scalezone1_x, zone1offset_x; int table_index = dir ^ v->second_field; - if (v->s.s.pict_type != AV_PICTURE_TYPE_B) + if (v->h.m.s.pict_type != AV_PICTURE_TYPE_B) refdist = v->refdist; else refdist = dir ? v->brfd : v->frfd; @@ -73,7 +73,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, int scalezone1_y, zone1offset_y; int table_index = dir ^ v->second_field; - if (v->s.s.pict_type != AV_PICTURE_TYPE_B) + if (v->h.m.s.pict_type != AV_PICTURE_TYPE_B) refdist = v->refdist; else refdist = dir ? v->brfd : v->frfd; @@ -165,10 +165,10 @@ static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, int dim, int dir) { int brfd, scalesame; - int hpel = 1 - v->s.s.quarter_sample; + int hpel = 1 - v->h.m.s.quarter_sample; n >>= hpel; - if (v->s.s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) { + if (v->h.m.s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) { if (dim) n = scaleforsame_y(v, i, n, dir) * (1 << hpel); else @@ -186,17 +186,17 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, int dim, int dir) { int refdist, scaleopp; - int hpel = 1 - v->s.s.quarter_sample; + int hpel = 1 - v->h.m.s.quarter_sample; n >>= hpel; - if (v->s.s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) { + if (v->h.m.s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) { if (dim) n = scaleforopp_y(v, n, dir) * (1 << hpel); else n = scaleforopp_x(v, n) * (1 << hpel); return n; } - if (v->s.s.pict_type != AV_PICTURE_TYPE_B) + if (v->h.m.s.pict_type != AV_PICTURE_TYPE_B) refdist = v->refdist; else refdist = dir ? v->brfd : v->frfd; @@ -213,7 +213,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra, int pred_flag, int dir) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int xy, wrap, off = 0; int16_t *A, *B, *C; int px, py; @@ -470,7 +470,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, int dir) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int xy, wrap, off = 0; int A[2], B[2], C[2]; int px = 0, py = 0; @@ -691,7 +691,7 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int xy, wrap, off = 0; int16_t *A, *B, *C; int px, py; @@ -892,7 +892,7 @@ void ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y, int mv1, int *pred_flag) { int dir = (v->bmvtype == BMV_TYPE_BACKWARD) ? 1 : 0; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; if (v->bmvtype == BMV_TYPE_DIRECT) { diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 995761700b..7f97e962d9 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -104,7 +104,7 @@ static void vc1_sprite_parse_transform(GetBitContext* gb, int c[7]) static int vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) { - AVCodecContext *avctx = v->s.s.avctx; + AVCodecContext *avctx = v->h.m.s.avctx; int sprite, i; for (sprite = 0; sprite <= v->two_sprites; sprite++) { @@ -175,7 +175,7 @@ static int vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int i, plane, row, sprite; int sr_cache[2][2] = { { -1, -1 }, { -1, -1 } }; uint8_t* src_h[2][2]; @@ -272,7 +272,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int ret; AVCodecContext *avctx = s->avctx; SpriteData sd; @@ -305,7 +305,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; AVFrame *f = s->current_picture.f; int plane, i; @@ -324,7 +324,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) { - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; int i, ret = AVERROR(ENOMEM); int mb_height = FFALIGN(s->mb_height, 2); @@ -423,7 +423,7 @@ av_cold void ff_vc1_init_transposed_scantables(VC1Context *v) static av_cold int vc1_decode_init(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; GetBitContext gb; int ret; @@ -595,7 +595,7 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx) for (i = 0; i < 4; i++) av_freep(&v->sr_rows[i >> 1][i & 1]); - ff_mpv_common_end(&v->s); + ff_mpv_common_end(&v->h.m); av_freep(&v->mv_type_mb_plane); av_freep(&v->direct_mb_plane); av_freep(&v->forward_mb_plane); @@ -625,7 +625,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i, ret; VC1Context *v = avctx->priv_data; - MPVMainDecContext *const m = &v->s; + MPVMainDecContext *const m = &v->h.m; MPVDecContext *const s = &m->s; AVFrame *pict = data; uint8_t *buf2 = NULL; diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index e9483168aa..88e9abefd8 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -33,7 +33,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; - MPVDecContext *const s = &ctx->m.s; + MPVDecContext *const s = &ctx->h.m.s; Picture *pic = s->current_picture_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4; diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index b91b158511..7cb626eb61 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -33,7 +33,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { VC1Context * const v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; Picture *pic = s->current_picture_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoVC1 *info = &pic_ctx->info.vc1; @@ -80,7 +80,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, info->extended_dmv = v->extended_dmv; info->overlap = v->overlap; info->vstransform = v->vstransform; - info->loopfilter = v->s.s.loop_filter; + info->loopfilter = v->h.m.s.loop_filter; info->fastuvmc = v->fastuvmc; info->range_mapy_flag = v->range_mapy_flag; info->range_mapy = v->range_mapy; @@ -101,7 +101,7 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { VC1Context * const v = avctx->priv_data; - MPVDecContext *const s = &v->s.s; + MPVDecContext *const s = &v->h.m.s; Picture *pic = s->current_picture_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 7c4dc51782..58830f935c 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -37,7 +37,7 @@ #include "wmv2dec.h" typedef struct WMV2DecContext { - MPVMainDecContext s; + H263DecContext h; WMV2Context common; IntraX8Context x8; int j_type_bit; @@ -60,7 +60,7 @@ typedef struct WMV2DecContext { static void wmv2_add_block(WMV2DecContext *w, int16_t *block1, uint8_t *dst, int stride, int n) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; if (s->block_last_index[n] >= 0) { switch (w->abt_type_table[n]) { @@ -102,7 +102,7 @@ void ff_wmv2_add_mb(MPVDecContext *s, int16_t block1[6][64], static int parse_mb_skip(WMV2DecContext *w) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; int mb_x, mb_y; int coded_mb_count = 0; uint32_t *const mb_type = s->current_picture_ptr->mb_type; @@ -167,7 +167,7 @@ static int parse_mb_skip(WMV2DecContext *w) static int decode_ext_header(WMV2DecContext *w) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; GetBitContext gb; int fps; int code; @@ -203,10 +203,10 @@ static int decode_ext_header(WMV2DecContext *w) return 0; } -int ff_wmv2_decode_picture_header(MPVMainDecContext *m) +int ff_wmv2_decode_picture_header(H263DecContext *h) { - WMV2DecContext *const w = (WMV2DecContext *)m; - MPVDecContext *const s = &m->s; + WMV2DecContext *const w = (WMV2DecContext *)h; + MPVDecContext *const s = &h->m.s; int code; if (s->picture_number == 0) @@ -239,10 +239,10 @@ int ff_wmv2_decode_picture_header(MPVMainDecContext *m) return 0; } -int ff_wmv2_decode_secondary_picture_header(MPVMainDecContext *m) +int ff_wmv2_decode_secondary_picture_header(H263DecContext *h) { - WMV2DecContext *const w = (WMV2DecContext *)m; - MPVDecContext *const s = &m->s; + WMV2DecContext *const w = (WMV2DecContext *)h; + MPVDecContext *const s = &h->m.s; if (s->pict_type == AV_PICTURE_TYPE_I) { if (w->j_type_bit) @@ -352,7 +352,7 @@ int ff_wmv2_decode_secondary_picture_header(MPVMainDecContext *m) static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr); @@ -364,7 +364,7 @@ static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_pt static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; int xy, wrap, diff, type; int16_t *A, *B, *C, *mot_val; @@ -410,7 +410,7 @@ static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py) static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, int n, int cbp) { - MPVDecContext *const s = &w->s.s; + MPVDecContext *const s = &w->h.m.s; static const int sub_cbp_table[3] = { 2, 3, 1 }; int sub_cbp, ret; @@ -567,7 +567,7 @@ int ff_wmv2_decode_mb(MPVDecContext *s, int16_t block[6][64]) static av_cold int wmv2_decode_init(AVCodecContext *avctx) { WMV2DecContext *const w = avctx->priv_data; - MPVMainDecContext *const m = &w->s; + MPVMainDecContext *const m = &w->h.m; MPVDecContext *const s = &m->s; int ret; diff --git a/libavcodec/wmv2dec.h b/libavcodec/wmv2dec.h index 05ca29741b..22aa81c0d6 100644 --- a/libavcodec/wmv2dec.h +++ b/libavcodec/wmv2dec.h @@ -21,12 +21,13 @@ #ifndef AVCODEC_WMV2DEC_H #define AVCODEC_WMV2DEC_H +#include "h263dec.h" #include "mpegvideo.h" #include "mpegvideodec.h" int ff_wmv2_decode_mb(MPVDecContext *s, int16_t block[6][64]); -int ff_wmv2_decode_picture_header(MPVMainDecContext *s); -int ff_wmv2_decode_secondary_picture_header(MPVMainDecContext *s); +int ff_wmv2_decode_picture_header(H263DecContext *h); +int ff_wmv2_decode_secondary_picture_header(H263DecContext *h); void ff_wmv2_add_mb(MPVContext *s, int16_t block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);