From patchwork Wed Oct 12 18:06:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38707 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1505283pzb; Wed, 12 Oct 2022 11:06:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ll+bQ04m7pbKCCFeMhHPFf09mpby1w9q1f2uyL2oZkGrKYEMPVPkQSmg+iQg5uyo3bFZ/ X-Received: by 2002:a17:907:2c74:b0:78d:b3ae:8408 with SMTP id ib20-20020a1709072c7400b0078db3ae8408mr14095997ejc.172.1665597992736; Wed, 12 Oct 2022 11:06:32 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g11-20020a1709065d0b00b007804b5a2c48si17003556ejt.521.2022.10.12.11.06.32; Wed, 12 Oct 2022 11:06:32 -0700 (PDT) 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=DtypNemY; 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 61B3268BD44; Wed, 12 Oct 2022 21:06:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067036.outbound.protection.outlook.com [40.92.67.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 919B068BCAE for ; Wed, 12 Oct 2022 21:06:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A7dXYNqL2h3H0fXFEYICv/eVuxfl84qUKAYuOVPC36iMRh3XlyPS3DewJLnwPSh6B5dSjVKb8N95jOdsR2euGJoRkwMLE1P7VhFZGh5SyUHbyHPGqa4miAJUQQy9Os9BtjTwlo1YuhPxrPA9RoKGjKldWlxixwEyXtGaa8s4fu7pNqF/W6xxkuWRkvpU6DQB78q7NE3SfrcN47O+8NEWnQAWwwcC+YeWZ+vP1EHFTXCaDbBw5mOeEJVNLk3OcHp0V/QhuqHl25Pvoz6WyzZtuqnz1frVyAixTrCc8XKIhpa/Kbi+hfxSgaxO+r36amTgnkJv2H2TOa8BVCq+X8vzpg== 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=iRWi/38hDRv2mk3r0HGV91Nvd0WhN7DE28eEWpGfCFc=; b=caHuTPqjvemBcZ9eQVHQNJraw335wK2aiPpyItFoeeOfmRv7z718NXGNucAqFTW6FCj7Ev73QwMX0DoDgEQsmnDjslBIBcX38IT/JSxFLt/K0Pbxdyp0KBQUNc/uaAqKuE4by+doK8r34cuYGIO8Mof2knB6TGz/GuNSd2ni3mRZtAWSoiy/Fq4zb0hSGo8Lugazj9r+m+n161VUnH3QeAhmRHCy1Mx/RK4c0fv1v8SiL4O8Fqw1T/bk+VBLZ6dWz2N/wY95TKA4idntlxptz4uO98tRMcD4QCTuvPDqtRoOCRbOwR/gmhsulJTcSeCXrDnBkv+DBb4VWj6gIFeRnQ== 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=iRWi/38hDRv2mk3r0HGV91Nvd0WhN7DE28eEWpGfCFc=; b=DtypNemY9i5RvTo+/9JqvEhD0Nynb8Id8e1I9AxD9qUN9Q+YB6HsFtnGw5sNlgOkNOkdnZkPHcUay9ZJxhB78CCg+37oaVDwelpQmlYqGZ6yttJ0MwwNxdFkk2sjXzO09btduBzv/MVkeOzFI5xFp/MicqMgtvioxzzl27s8fAE0QJQ3VQakCfK0KCTC2ltHeUEgM4o7z3VA6cZL/dK6iYT6TyMQzd4kyAgcPJfupMmxtDGbjbVadgsuPVay6sWbnLj1A6iEhL+GSigfCLBQ0/fIRSRzZcoSmSasKsBGWYC4xABhbnHSiXFMRuV5DkxZ7yIKs3+Vt0A5HzqsEIDLqA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0095.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:270::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Wed, 12 Oct 2022 18:06:21 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Wed, 12 Oct 2022 18:06:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:06:19 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [owxJazpTG/jrUS45yrbcQZWUKZQuGzMVVcrTSFUTlMg=] X-ClientProxiedBy: AS9PR06CA0077.eurprd06.prod.outlook.com (2603:10a6:20b:464::24) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221012180623.1834366-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0095:EE_ X-MS-Office365-Filtering-Correlation-Id: bf9c05c3-b47c-4117-98d9-08daac7c77c0 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3kTotjjC9DVrXGSRzCr0nLN1TWZ1PRINGwEJGISbYOad0zf1Z0UOxLRY2WwUDAbPmYrBKnUBBeltnrRj0MNHT2pCb7rGxZR/RyoVNmou7NOd8EV0MCVMpTlWSZHrsHYQqL5fmIPWhuzazdzJsEZ5RrpzRbFQRh6HuASeNtrncGepveyEPwfVg+33xuSnlBuIAmQ7wgS2nRDHEwj/XUdjp0Yp5uUSTdBYonYbvp98Io+M3dl5LyKOFGlK+U+l6Qf8Z031ilUJlUmS8trEAiFdRq256vR47/iW1aNisE/eFF5sUYqpzfmX9qu03CT9BB1t2zPBAppwYFQ5MB7uxZLXHNmb0M+ejawp0xcWR21SMSN4iNpHsidog+k+Tm0PWCQtdX56aouzU7iE/robK/x7j3fNyVlrehNJhRJzV9ppbHRzPTdJjw8ZfEWTjqDLagneLtqpq07NfQVvi1TEL/SRVCJL3a6p7+Wr8/nBjbFsWgcEXbZ7XhRx/CUAnHDI+WpjDrKyugc2s6z9rsZ43czLyEKKihQ74BlKBq6wTEHwLclBrnz3Eq4jZnt1TDcr/L+D542bdJkxxhSNMJ4RnwLF3Io6xraYl4FdIe3eohrdmrgD3j06YM31RS3Tb+hHeQ+nFiRreBzjVgt8K+IFixDA6t9iLwFPkBZ6onxw0F4v6yoEYbHCFNTBESWj5Q1Zx+7gzQmyN7Zx4+59NJ3jZSYyNt+tPy8c3KjZNs18REVXcFzf9MKtMfQHYRiVDD8B2eeCSFkVS8GMPUdDiS3R/IlPi6C X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LU6vlZlERpDPc7bPszble9ciWOU/kvY5xuLcHkaL21pamVGnGzl6A11LJqFCc1G3wQ2YBayywTrNtNiknD+veEzhrZGKJKlNbRjUGJYCvmucx5UF3kXdT6eTbr4g+0/5A7EgWWHVuwOwruWtoKq5Wejb5IL5LOe1ri7Fz/YKBOC3aUVWeVZ2ZIN5v2SmVnaA47uPjP+XRHgZI0VHMMWZnI+PGkSMjDa+3rqopSSDILa+EUfUu7kBJcbAxsDQ5GfqPXREkpH9lU6xf6xuEYCNxwWbDRyxcJ5eKJQgdMnoBeigJTkOA+8xlWTbdeqfLcq05xTy0nio+SN3+dB1vOUlH7fRIbxYP5usLgpykrquRYcwfhDYDHIiYvzVemhCegpUnQ8SxLFvSFM7DCcakObSKwG/JFPdUDWwvu2FXy8M9JcMGZz6rD9Ru/3z5sfhO5Oq/E1C+P8GqR2xnGo+DmanULRMS26x1bkQYgkdMvjo1DEwQrgJJF/aIyxmDB0JWeK3bqQPc0/bMpT+oFUlyrj7IECooSTIYsTqHyd3h1P9OUEnGsIuQK0MH+L+4OErsjVtWHDOua1pJosCZZG0A5Qfhk1ifbQZDNxexk7oFg+ucwOCj/KBVLeyp3oDylmQfpGp+S+tFwYriW0RDibymCRErvDaA/pAfJA/scYPstd4owLZNtky9EYR4JgOD8Geo2wI X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6rpYjnoG/DWPEazXRALeJw8wp5H1e1p3xfPsdG7y7AkeAzSyi5R/lsNAVMPruhJzGMmmq3ScIuUdAcTthuKuCVinfS8a8ljoitHc7vnc0KkkMaaCdsCiCEgMxioaeN7LPIJlCNHXux41Ke34mWec1VurVuM0gpVqez3tlLbiFfVMU5ACZjK+rGVROB/rsIJ4fAgExqyAxYm3DiJs6otvSp1+UW3ui+jSr5Z42GzOg6ELhO8ivghVRoG1hKWFuaYAZ4G4837TkZJE4EZKVeBHAtCCz5KTf1Wcpnl6jWJGb2X/9MJciCb0eudEAuEBtvXBWRWkr3+S7/grc2XzcqKX1JsHz1nSH+gnnAYn7eyb9JRTDju/ShveqiS7f9tTrogNKoryJHlMbqDuF0xbWskEdxWZukeJ02p281KQogqDr/3dWf0jAs/KhiJz8O+e+Dcl6vLyGwJj5lNoE5JKBIosTIklwYS4ACO3bh7vOahkdCVjkvPGT1jLSx7s7r2ctGUjcNowSNjK/Vwwcu31Z2FCjZ7140IgekgbV2Nlc7uVL79v9C4Aor/k8f+/tu6Ji8euejV88cnz/RZB0SF+D8Atbx2+kW5kSsalIA28aA7s66ZwAXfPy/RCnT6unDkwwVZimtERvdEi8avCuto1LF2Gabx2mOSAfYqNcNcDj8TFrJ3f1yqcG0u5GJw+rH++BvwfmJB/Ug0WZPTPdstPEcjx+iQUK/uL2SOn9PTw0AHtPaZD4Cz9CAwcqTzHtlQxK8eLoR6Ew/8mTYaF3eFccupgrZfeVJdZ6IqBWtuT9NhWDrbZ5BygKPmZXx9IAqGJ/ns7YEpssR4tPEYPhlgQBRkW0ERmxZb3vrIerQVKfA49IDsoiS6T2Cb1LUqX7kxseZgSFP//GFgS11T8WLJhDMlZAdpEDMtN6gkN8taLWzVbzybqjr+oouVQkRAhaeeTLIwOO3Wm1mgUK0MEcdzDm31mZAU1KqPCao64IV33mqzphRpMgOviwSvypwRp1hte9qdpdwQBn8imHIaJmdY5A0wQRGYSpgbjadibLAcwJhND1a96C3/FtSoB4SD3ZmKBaoEPUHQJQ8CO4PyZU9TUi+HM/7erkjBHBDQsb9N1RtAaJPidXNCJzT2IX7OJQfHOb952Kq6EjPYGWSYhM3I5Cs2qnj+SMuVO5Gr2Q4KQPu8yOXudsV+EXPnmOj29Nykg+mXmlM2CVQsK/rljl4d6EfaAzsjd7PTVftmEIsJQyBjH2aAotVh7mMDzj8v1N6lRWxgIYP1CceTjuQ9sgUG/Ql2Sn1ZGGColmZ262g1lnROFAhU= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf9c05c3-b47c-4117-98d9-08daac7c77c0 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2022 18:06:21.4191 (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: DU2P250MB0095 Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodsp: Make MpegVideoDSP MPEG-4 only 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: Od0UDX+h2H6y It is only used by gmc/gmc1 which is only used by the MPEG-4 decoder, so move it to Mpeg4DecContext and rename it to Mpeg4VideoDSP. Also compile it iff the MPEG-4 decoder is compiled. Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 4 +- libavcodec/mpeg4videodec.c | 58 ++++++++++--------- libavcodec/mpeg4videodec.h | 3 + .../{mpegvideodsp.c => mpeg4videodsp.c} | 8 +-- .../{mpegvideodsp.h => mpeg4videodsp.h} | 16 ++--- libavcodec/mpegvideo.c | 1 - libavcodec/mpegvideo.h | 2 - libavcodec/ppc/Makefile | 4 +- .../ppc/{mpegvideodsp.c => mpeg4videodsp.c} | 4 +- libavcodec/x86/Makefile | 5 +- .../x86/{mpegvideodsp.c => mpeg4videodsp.c} | 4 +- 11 files changed, 57 insertions(+), 52 deletions(-) rename libavcodec/{mpegvideodsp.c => mpeg4videodsp.c} (96%) rename libavcodec/{mpegvideodsp.h => mpeg4videodsp.h} (81%) rename libavcodec/ppc/{mpegvideodsp.c => mpeg4videodsp.c} (98%) rename libavcodec/x86/{mpegvideodsp.c => mpeg4videodsp.c} (98%) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 37b63cadc2..2df7479721 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -132,7 +132,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_float.o OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o -OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ +OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o rl.o \ mpegvideo_motion.o \ mpegvideodata.o mpegpicture.o \ to_upper4.o @@ -523,7 +523,7 @@ OBJS-$(CONFIG_MPEG2_CUVID_DECODER) += cuviddec.o OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_MPEG2_VAAPI_ENCODER) += vaapi_encode_mpeg2.o OBJS-$(CONFIG_MPEG2_V4L2M2M_DECODER) += v4l2_m2m_dec.o -OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o +OBJS-$(CONFIG_MPEG4_DECODER) += mpeg4videodsp.o xvididct.o OBJS-$(CONFIG_MPEG4_ENCODER) += mpeg4videoenc.o OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 58a8ac9027..1638664e00 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -72,7 +72,7 @@ static const int mb_type_b_map[4] = { MB_TYPE_L0 | MB_TYPE_16x16, }; -static void gmc1_motion(MpegEncContext *s, +static void gmc1_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture) { @@ -110,10 +110,10 @@ static void gmc1_motion(MpegEncContext *s, } if ((motion_x | motion_y) & 7) { - s->mdsp.gmc1(dest_y, ptr, linesize, 16, - motion_x & 15, motion_y & 15, 128 - s->no_rounding); - s->mdsp.gmc1(dest_y + 8, ptr + 8, linesize, 16, - motion_x & 15, motion_y & 15, 128 - s->no_rounding); + ctx->mdsp.gmc1(dest_y, ptr, linesize, 16, + motion_x & 15, motion_y & 15, 128 - s->no_rounding); + ctx->mdsp.gmc1(dest_y + 8, ptr + 8, linesize, 16, + motion_x & 15, motion_y & 15, 128 - s->no_rounding); } else { int dxy; @@ -153,8 +153,8 @@ static void gmc1_motion(MpegEncContext *s, ptr = s->sc.edge_emu_buffer; emu = 1; } - s->mdsp.gmc1(dest_cb, ptr, uvlinesize, 8, - motion_x & 15, motion_y & 15, 128 - s->no_rounding); + ctx->mdsp.gmc1(dest_cb, ptr, uvlinesize, 8, + motion_x & 15, motion_y & 15, 128 - s->no_rounding); ptr = ref_picture[2] + offset; if (emu) { @@ -165,11 +165,11 @@ static void gmc1_motion(MpegEncContext *s, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr = s->sc.edge_emu_buffer; } - s->mdsp.gmc1(dest_cr, ptr, uvlinesize, 8, - motion_x & 15, motion_y & 15, 128 - s->no_rounding); + ctx->mdsp.gmc1(dest_cr, ptr, uvlinesize, 8, + motion_x & 15, motion_y & 15, 128 - s->no_rounding); } -static void gmc_motion(MpegEncContext *s, +static void gmc_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture) { @@ -188,13 +188,13 @@ static void gmc_motion(MpegEncContext *s, oy = s->sprite_offset[0][1] + s->sprite_delta[1][0] * s->mb_x * 16 + s->sprite_delta[1][1] * s->mb_y * 16; - s->mdsp.gmc(dest_y, ptr, linesize, 16, - ox, oy, + ctx->mdsp.gmc(dest_y, ptr, linesize, 16, + ox, oy, s->sprite_delta[0][0], s->sprite_delta[0][1], s->sprite_delta[1][0], s->sprite_delta[1][1], - a + 1, (1 << (2 * a + 1)) - s->no_rounding, - s->h_edge_pos, s->v_edge_pos); - s->mdsp.gmc(dest_y + 8, ptr, linesize, 16, + a + 1, (1 << (2 * a + 1)) - s->no_rounding, + s->h_edge_pos, s->v_edge_pos); + ctx->mdsp.gmc(dest_y + 8, ptr, linesize, 16, ox + s->sprite_delta[0][0] * 8, oy + s->sprite_delta[1][0] * 8, s->sprite_delta[0][0], s->sprite_delta[0][1], @@ -211,31 +211,33 @@ static void gmc_motion(MpegEncContext *s, s->sprite_delta[1][1] * s->mb_y * 8; ptr = ref_picture[1]; - s->mdsp.gmc(dest_cb, ptr, uvlinesize, 8, - ox, oy, + ctx->mdsp.gmc(dest_cb, ptr, uvlinesize, 8, + ox, oy, s->sprite_delta[0][0], s->sprite_delta[0][1], s->sprite_delta[1][0], s->sprite_delta[1][1], - a + 1, (1 << (2 * a + 1)) - s->no_rounding, - (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1); + a + 1, (1 << (2 * a + 1)) - s->no_rounding, + (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1); ptr = ref_picture[2]; - s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8, - ox, oy, + ctx->mdsp.gmc(dest_cr, ptr, uvlinesize, 8, + ox, oy, s->sprite_delta[0][0], s->sprite_delta[0][1], s->sprite_delta[1][0], s->sprite_delta[1][1], - a + 1, (1 << (2 * a + 1)) - s->no_rounding, - (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1); + a + 1, (1 << (2 * a + 1)) - s->no_rounding, + (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1); } void ff_mpeg4_mcsel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture) { + const Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; + if (s->real_sprite_warping_points == 1) { - gmc1_motion(s, dest_y, dest_cb, dest_cr, + gmc1_motion(s, ctx, dest_y, dest_cb, dest_cr, ref_picture); } else { - gmc_motion(s, dest_y, dest_cb, dest_cr, + gmc_motion(s, ctx, dest_y, dest_cb, dest_cr, ref_picture); } } @@ -3684,6 +3686,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size) return 0; } +#if CONFIG_MPEG4_DECODER #if HAVE_THREADS static int mpeg4_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) @@ -3726,7 +3729,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift)); memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj)); - if (CONFIG_MPEG4_DECODER && !init && s1->xvid_build >= 0) + if (!init && s1->xvid_build >= 0) ff_xvid_idct_init(&s->m.idsp, dst); return 0; @@ -3814,6 +3817,8 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; + ff_mpeg4videodsp_init(&ctx->mdsp); + ff_thread_once(&init_static_once, mpeg4_init_static); return 0; @@ -3873,3 +3878,4 @@ const FFCodec ff_mpeg4_decoder = { NULL }, }; +#endif /* CONFIG_MPEG4_DECODER */ diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h index 8d1e121b67..302c5c38da 100644 --- a/libavcodec/mpeg4videodec.h +++ b/libavcodec/mpeg4videodec.h @@ -27,6 +27,7 @@ #include "get_bits.h" #include "mpegvideo.h" +#include "mpeg4videodsp.h" typedef struct Mpeg4DecContext { @@ -76,6 +77,8 @@ typedef struct Mpeg4DecContext { int rgb; + Mpeg4VideoDSPContext mdsp; + int32_t block32[12][64]; // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan int dpcm_direction; diff --git a/libavcodec/mpegvideodsp.c b/libavcodec/mpeg4videodsp.c similarity index 96% rename from libavcodec/mpegvideodsp.c rename to libavcodec/mpeg4videodsp.c index 05893d0e01..1c5661a076 100644 --- a/libavcodec/mpegvideodsp.c +++ b/libavcodec/mpeg4videodsp.c @@ -19,7 +19,7 @@ #include "config.h" #include "libavutil/attributes.h" #include "libavutil/common.h" -#include "mpegvideodsp.h" +#include "mpeg4videodsp.h" static void gmc1_c(uint8_t *dst, const uint8_t *src, int stride, int h, int x16, int y16, int rounder) @@ -107,14 +107,14 @@ void ff_gmc_c(uint8_t *dst, const uint8_t *src, int stride, int h, int ox, int o } } -av_cold void ff_mpegvideodsp_init(MpegVideoDSPContext *c) +av_cold void ff_mpeg4videodsp_init(Mpeg4VideoDSPContext *c) { c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; #if ARCH_PPC - ff_mpegvideodsp_init_ppc(c); + ff_mpeg4videodsp_init_ppc(c); #elif ARCH_X86 - ff_mpegvideodsp_init_x86(c); + ff_mpeg4videodsp_init_x86(c); #endif } diff --git a/libavcodec/mpegvideodsp.h b/libavcodec/mpeg4videodsp.h similarity index 81% rename from libavcodec/mpegvideodsp.h rename to libavcodec/mpeg4videodsp.h index 69e6053c68..e1ccb71ce9 100644 --- a/libavcodec/mpegvideodsp.h +++ b/libavcodec/mpeg4videodsp.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_MPEGVIDEODSP_H -#define AVCODEC_MPEGVIDEODSP_H +#ifndef AVCODEC_MPEG4VIDEODSP_H +#define AVCODEC_MPEG4VIDEODSP_H #include @@ -25,7 +25,7 @@ void ff_gmc_c(uint8_t *dst, const uint8_t *src, int stride, int h, int ox, int o int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); -typedef struct MpegVideoDSPContext { +typedef struct Mpeg4VideoDSPContext { /** * translational global motion compensation. */ @@ -38,10 +38,10 @@ typedef struct MpegVideoDSPContext { int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); -} MpegVideoDSPContext; +} Mpeg4VideoDSPContext; -void ff_mpegvideodsp_init(MpegVideoDSPContext *c); -void ff_mpegvideodsp_init_ppc(MpegVideoDSPContext *c); -void ff_mpegvideodsp_init_x86(MpegVideoDSPContext *c); +void ff_mpeg4videodsp_init(Mpeg4VideoDSPContext *c); +void ff_mpeg4videodsp_init_ppc(Mpeg4VideoDSPContext *c); +void ff_mpeg4videodsp_init_x86(Mpeg4VideoDSPContext *c); -#endif /* AVCODEC_MPEGVIDEODSP_H */ +#endif /* AVCODEC_MPEG4VIDEODSP_H */ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5095149eaa..b9fa6dc2d1 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -284,7 +284,6 @@ static av_cold int dct_init(MpegEncContext *s) ff_blockdsp_init(&s->bdsp); ff_h264chroma_init(&s->h264chroma, 8); //for lowres ff_hpeldsp_init(&s->hdsp, s->avctx->flags); - ff_mpegvideodsp_init(&s->mdsp); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); if (s->avctx->debug & FF_DEBUG_NOMC) { diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 1ddf8034aa..007d681a09 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -40,7 +40,6 @@ #include "me_cmp.h" #include "motion_est.h" #include "mpegpicture.h" -#include "mpegvideodsp.h" #include "mpegvideoencdsp.h" #include "pixblockdsp.h" #include "put_bits.h" @@ -209,7 +208,6 @@ typedef struct MpegEncContext { HpelDSPContext hdsp; IDCTDSPContext idsp; MECmpContext mecc; - MpegVideoDSPContext mdsp; MpegvideoEncDSPContext mpvencdsp; PixblockDSPContext pdsp; QpelDSPContext qdsp; diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 03e5b42d33..bc13d8a0ce 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -14,8 +14,7 @@ OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp.o OBJS-$(CONFIG_LLVIDDSP) += ppc/lossless_videodsp_altivec.o OBJS-$(CONFIG_ME_CMP) += ppc/me_cmp.o OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o -OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \ - ppc/mpegvideodsp.o +OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o OBJS-$(CONFIG_MPEGVIDEOENC) += ppc/mpegvideoencdsp.o OBJS-$(CONFIG_PIXBLOCKDSP) += ppc/pixblockdsp.o OBJS-$(CONFIG_VC1DSP) += ppc/vc1dsp_altivec.o @@ -26,6 +25,7 @@ OBJS-$(CONFIG_VP8DSP) += ppc/vp8dsp_altivec.o # decoders/encoders OBJS-$(CONFIG_HEVC_DECODER) += ppc/hevcdsp.o OBJS-$(CONFIG_LLAUDDSP) += ppc/lossless_audiodsp_altivec.o +OBJS-$(CONFIG_MPEG4_DECODER) += ppc/mpeg4videodsp.o OBJS-$(CONFIG_SVQ1_ENCODER) += ppc/svq1enc_altivec.o OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o OBJS-$(CONFIG_VP7_DECODER) += ppc/vp8dsp_altivec.o diff --git a/libavcodec/ppc/mpegvideodsp.c b/libavcodec/ppc/mpeg4videodsp.c similarity index 98% rename from libavcodec/ppc/mpegvideodsp.c rename to libavcodec/ppc/mpeg4videodsp.c index 3e99e089ea..8b30af4258 100644 --- a/libavcodec/ppc/mpegvideodsp.c +++ b/libavcodec/ppc/mpeg4videodsp.c @@ -26,7 +26,7 @@ #include "libavutil/ppc/cpu.h" #include "libavutil/ppc/util_altivec.h" -#include "libavcodec/mpegvideodsp.h" +#include "libavcodec/mpeg4videodsp.h" #if HAVE_ALTIVEC /* AltiVec-enhanced gmc1. ATM this code assumes stride is a multiple of 8 @@ -128,7 +128,7 @@ static void gmc1_altivec(uint8_t *dst /* align 8 */, const uint8_t *src /* align } #endif /* HAVE_ALTIVEC */ -av_cold void ff_mpegvideodsp_init_ppc(MpegVideoDSPContext *c) +av_cold void ff_mpeg4videodsp_init_ppc(Mpeg4VideoDSPContext *c) { #if HAVE_ALTIVEC if (!PPC_ALTIVEC(av_get_cpu_flags())) diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index e1120b7e15..ec6adcd8b0 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -27,8 +27,7 @@ OBJS-$(CONFIG_LPC) += x86/lpc_init.o OBJS-$(CONFIG_MDCT15) += x86/mdct15_init.o OBJS-$(CONFIG_ME_CMP) += x86/me_cmp_init.o OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o -OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \ - x86/mpegvideodsp.o +OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o \ x86/mpegvideoencdsp_init.o OBJS-$(CONFIG_PIXBLOCKDSP) += x86/pixblockdsp_init.o @@ -62,7 +61,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += x86/hevcdsp_init.o OBJS-$(CONFIG_JPEG2000_DECODER) += x86/jpeg2000dsp_init.o OBJS-$(CONFIG_LSCR_DECODER) += x86/pngdsp_init.o OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp_init.o -OBJS-$(CONFIG_MPEG4_DECODER) += x86/xvididct_init.o +OBJS-$(CONFIG_MPEG4_DECODER) += x86/mpeg4videodsp.o x86/xvididct_init.o OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp_init.o OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp_init.o diff --git a/libavcodec/x86/mpegvideodsp.c b/libavcodec/x86/mpeg4videodsp.c similarity index 98% rename from libavcodec/x86/mpegvideodsp.c rename to libavcodec/x86/mpeg4videodsp.c index ea1d941fba..6a1c6c5064 100644 --- a/libavcodec/x86/mpegvideodsp.c +++ b/libavcodec/x86/mpeg4videodsp.c @@ -20,7 +20,7 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" -#include "libavcodec/mpegvideodsp.h" +#include "libavcodec/mpeg4videodsp.h" #include "libavcodec/videodsp.h" #if HAVE_INLINE_ASM @@ -150,7 +150,7 @@ static void gmc_mmx(uint8_t *dst, const uint8_t *src, #endif /* HAVE_INLINE_ASM */ -av_cold void ff_mpegvideodsp_init_x86(MpegVideoDSPContext *c) +av_cold void ff_mpeg4videodsp_init_x86(Mpeg4VideoDSPContext *c) { #if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags();