From patchwork Wed Oct 12 18:03:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38706 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1503988pzb; Wed, 12 Oct 2022 11:03:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5v3oCV/VdD+cpSB5TAPPBpn00KyZnChKTYzRMp9jzFz94zyC/Il9dEvQjuLt2YPCpkGf1h X-Received: by 2002:aa7:cd4f:0:b0:458:6077:c3ac with SMTP id v15-20020aa7cd4f000000b004586077c3acmr28632851edw.32.1665597820933; Wed, 12 Oct 2022 11:03:40 -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 p14-20020a170906604e00b0078d07d3be2asi13841131ejj.333.2022.10.12.11.03.40; Wed, 12 Oct 2022 11:03:40 -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="oWEo6dB/"; 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 1FD8668BD3F; Wed, 12 Oct 2022 21:03:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074101.outbound.protection.outlook.com [40.92.74.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A1A7468BB2C for ; Wed, 12 Oct 2022 21:03:30 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Umq5hvP7lBCCRsUp42kjNycCbnG5v/RnHRD+muN7d3+5SxkItQjUMPDoyD2r7Ma5EGkOPoLCsn2JW8T1o+Py+ALATU7BcaIoB8nNRhuf/28hbjZVVfpDO/nOxWfoJE0ZQmIsIPrLC9ZtHPcJ3kI3HXLdqG9zDC4jqVG2/tXgyaLC8BpqYgfrF32RlR8IA9LcwNmqQEPMvBKyx2T5cTK6KHUEoqxKK+/QceVsf9OeUOptbqZ40gnKD41JRv0u8cqDG6+xATDEz5dJnDhRXzEq6piAiuMR4ksp3JSQdQD6ErDV9Jd/u55xFPQS2lEn963qFsbpl2GHMTF5vWFCa8Th5w== 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=RPYLNCpwe7h+5/hUGSKFde96D9jeBD5rDd1cJUG7daM=; b=bJ1rX3ezueSY6Ms10f6q5AbgDA9/aNnwScJOvjvtNnYXz42LVKupOxZ741coZlaJ+pa+ShMU95DjfIV2jkwTMKObury6ElRb0biXMmOi+KDmoYyNkuz/6ubxh/dJByILH7B79t7EYHWq5/v7f27wo1tsRJGntsJ/WrC1nOfiByDtDAxeYrwSUfFXKusu34vZOoQAFBja6NCVvhTkaDsK9kTKoOvTUzaJQ9tejFaSkL3IRn2K0lV3BhD8hOz+7k2nLtzO6F0FNDEob8DXOznRWN6eE9PD1ToLmANtGYo2QSu7JlqXITfjnJGxr2eUkXcC8RXAJAwzKPdkQHt0h8F72Q== 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=RPYLNCpwe7h+5/hUGSKFde96D9jeBD5rDd1cJUG7daM=; b=oWEo6dB/aSzC4sLK5Zq/4hJpgGR1tt4eHcms2LL9Yp/jA2etFmSKq5OW23oiJ59FhnQUe/h6bBIH5xL/t3uEYxoJ6eqRRJxCi7nnY20f9LE1tChYL8Y8Y6oyIRRlABd6WBwqTs9aMO/m/TThm/cJatimgabdx7p96LrnUtAzPuL/2i9enHIWSS3rM1dviAgOmJJpw2oDHbwYoaTATFJl8ImXFuZpxvYrtv0WFhjB86k6zlxuesTFLR8/ZA2NLa99gdH0jpR3ELNnOC4rOUer7QEaWbkY3L2jjAHOiO4gpBnCoXPde4TyBoOJrrGnp/qZ9Owq2cf+tBR+8i9Ibvc3eQ== 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:03:28 +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:03:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:03:25 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [wbBwuH8eZYjkeiBnBHhlyGFNFeUk6t1Qx15WVYxw8NQ=] X-ClientProxiedBy: AS9PR06CA0039.eurprd06.prod.outlook.com (2603:10a6:20b:463::31) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221012180330.1834161-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: a1079788-d072-4172-64d6-08daac7c10c2 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqnpNgInvu+2FGvrKiQOZUvpi38XCrfgqEd+k5xXNg8ZoaQhS9KVLm56OMImoMYTE8VGM4/KW3741fZr9BsUCAPGl8Po63uIQiBqod0U315Janeg5mjeQUFJbTiz+JNIiyVMeakeUH8cS4JUpl8118CSKwcrI12M4BD1BzLXHWSa8r7hSkUurBAC+j0d+ZxUMizneZiKlSFW3Q0PFDiTBJRV945E/QN7Z55/bXKZZE78p0CYIYNyyJPZ+HmwZp4lEq0K8Ia/D9Mt4gYhk4Id8zmiGjFB8DTKUi06QEDOx0skhoVTCEM/MpHCbdzYY0h5NSyOlMeqRfSB5VDFS5I7PiEGOWo/0aUMj1yA9TGZTtOV77Wi+X5mSbZKQXtPE94lcJIhpspQTMstmTGluZpaFEtJXIK5rT6562SwXIJ/Oq60P5voCXL0C2Oo0dPoh53FK0nqTC0AgRFtkEa0XiEj0GjoU0wHch+9CJ9e7v7X84DGG/ioEnSlFKencxJeJchFqyNT6vpOGUMBrnRJJD1YYCMj6FEZzhWHm4lyPujSZgGPc3sdx7Idl+4VzwZipismy2wqn+Zk3bytIDIIVgi7wEbBvPccDAKBksWpCDUJyG60X11B6U3WBBqxhqciFtt4U0pE/f4vCBKdE6QO3kPfXkcpBF9vxv//0QhjyrmHOpUfxM1CFPIU8AF05N7ANxwrfFYJ16q4S3Zh3OkuLC/vlZUkr4w2oHslO9QeCcdYE2KKCxashbDza79OWoFVEvgyfs= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OQEYMOpgGYJiGciQ7e6JjPBeg8BfbP4iYGVZvkbTqFt5Wr0A3NcH5jHBBVvra0IjqsSAnKg2BA2zmSQrk/hTBWWtiv0hI/oDQNSx/rQk7bgHaBo0zXcjy67bA4QhbneU6r2qQsNabTzvWqkJ7G19xG43n5YVbknV0edBEKiIpRh5mhafegj+lYSsz7p8aQkNC2PfOS7oBEKqLSQktT8d01JvZB5N/VrkkDXCENb/Yr0k1ZGWP49LOOszP36pCzpexyjsexOusDWsizhpWHavhQ4ffEL3jA9clxvjH5XMgG75dvwdTsshl1DN+sUS0F5xbfh5cU1uQtJgfAgAkI5gH0VkQbhLNbfwWNa5TE1OWBIaRiFI4lI3kraJQy5zM2K2mN5zH34dfsbqJXBB4uMzdlgKbxt7bokUqT4mfntjEklNOMAYGale1y//xf5B3+wwodO9LsxBbg74DxqAOKssc9l8Tvx+OQl+6cvknCCjeQUc8GpodFy5umBIyKnJ8k6joCZN789sjxS8qo+GH8/qkj+EbZDW61tH9Nok0eS8YpmHKf3iybotraq2T77a6a533bdwKW9SYZLPkM29DX1QndBraATHebHtQwN+7L+JZd66lMdl+UDtMZjhn2EYmZAVsNS8HC02xDnMjpL6RP+uaDBfZ3kEB4CowS6jmj/DIHHgVEiYqMZFUKgiPHpibqe7 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sk5VTXNZq5VdS5TnIqm3eDbpS1yyP/jow/fTRpiSe1MJFrbDAIukWDXV5pTduDawRcQosEfcNV/8BkqdwnHjpOrIGBwAoMZW4KZNm0kOWbiWla6mycrNQyj+FdGC206nLlnb5yk+NypFnJc/xBpLGRhoTMQxOdMwwkY9MOQwbWHFQ4B7U0J3VcgUPEwy5HZRGW+JOU+sY992IZZII/s1nwra+ZxEPdpdw68bqPqznhsq0jUSRi5YJAdzbw7fP8Odr6mRJNNbAgagz/RNzTKdHPXzR3E3+tvG2LNhlaqWXG2+Qd0GS3xUIaOfzk71I2KBY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-64d6-08daac7c10c2 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:03:28.6255 (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 1/6] avcodec/mpegvideo_motion: Move mspel/gmc motion to mpeg4videodec.c 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: 9plvTz52BOB3 It is the only codec for which mcsel is ever set. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 168 ++++++++++++++++++++++++++++++++++ libavcodec/mpeg4videodec.h | 3 + libavcodec/mpegvideo_motion.c | 166 +-------------------------------- 3 files changed, 174 insertions(+), 163 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 4dbf37afe5..58a8ac9027 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -72,6 +72,174 @@ static const int mb_type_b_map[4] = { MB_TYPE_L0 | MB_TYPE_16x16, }; +static void gmc1_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + uint8_t *const *ref_picture) +{ + const uint8_t *ptr; + int src_x, src_y, motion_x, motion_y; + ptrdiff_t offset, linesize, uvlinesize; + int emu = 0; + + motion_x = s->sprite_offset[0][0]; + motion_y = s->sprite_offset[0][1]; + src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy + 1)); + src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy + 1)); + motion_x *= 1 << (3 - s->sprite_warping_accuracy); + motion_y *= 1 << (3 - s->sprite_warping_accuracy); + src_x = av_clip(src_x, -16, s->width); + if (src_x == s->width) + motion_x = 0; + src_y = av_clip(src_y, -16, s->height); + if (src_y == s->height) + motion_y = 0; + + linesize = s->linesize; + uvlinesize = s->uvlinesize; + + ptr = ref_picture[0] + src_y * linesize + src_x; + + if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || + (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) { + s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, + linesize, linesize, + 17, 17, + src_x, src_y, + s->h_edge_pos, s->v_edge_pos); + ptr = s->sc.edge_emu_buffer; + } + + 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); + } else { + int dxy; + + dxy = ((motion_x >> 3) & 1) | ((motion_y >> 2) & 2); + if (s->no_rounding) { + s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); + } else { + s->hdsp.put_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); + } + } + + if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) + return; + + motion_x = s->sprite_offset[1][0]; + motion_y = s->sprite_offset[1][1]; + src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy + 1)); + src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy + 1)); + motion_x *= 1 << (3 - s->sprite_warping_accuracy); + motion_y *= 1 << (3 - s->sprite_warping_accuracy); + src_x = av_clip(src_x, -8, s->width >> 1); + if (src_x == s->width >> 1) + motion_x = 0; + src_y = av_clip(src_y, -8, s->height >> 1); + if (src_y == s->height >> 1) + motion_y = 0; + + offset = (src_y * uvlinesize) + src_x; + ptr = ref_picture[1] + offset; + if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) || + (unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) { + s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, + uvlinesize, uvlinesize, + 9, 9, + src_x, src_y, + s->h_edge_pos >> 1, s->v_edge_pos >> 1); + 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); + + ptr = ref_picture[2] + offset; + if (emu) { + s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, + uvlinesize, uvlinesize, + 9, 9, + src_x, src_y, + 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); +} + +static void gmc_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + uint8_t *const *ref_picture) +{ + const uint8_t *ptr; + int linesize, uvlinesize; + const int a = s->sprite_warping_accuracy; + int ox, oy; + + linesize = s->linesize; + uvlinesize = s->uvlinesize; + + ptr = ref_picture[0]; + + ox = s->sprite_offset[0][0] + s->sprite_delta[0][0] * s->mb_x * 16 + + s->sprite_delta[0][1] * s->mb_y * 16; + 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, + 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, + ox + s->sprite_delta[0][0] * 8, + oy + s->sprite_delta[1][0] * 8, + 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); + + if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) + return; + + ox = s->sprite_offset[1][0] + s->sprite_delta[0][0] * s->mb_x * 8 + + s->sprite_delta[0][1] * s->mb_y * 8; + oy = s->sprite_offset[1][1] + s->sprite_delta[1][0] * s->mb_x * 8 + + s->sprite_delta[1][1] * s->mb_y * 8; + + ptr = ref_picture[1]; + s->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); + + ptr = ref_picture[2]; + s->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); +} + +void ff_mpeg4_mcsel_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + uint8_t *const *ref_picture) +{ + if (s->real_sprite_warping_points == 1) { + gmc1_motion(s, dest_y, dest_cb, dest_cr, + ref_picture); + } else { + gmc_motion(s, dest_y, dest_cb, dest_cr, + ref_picture); + } +} + void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int block_size, int uvlinesize, int dct_linesize, int dct_offset) diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h index 65d846aed0..8d1e121b67 100644 --- a/libavcodec/mpeg4videodec.h +++ b/libavcodec/mpeg4videodec.h @@ -87,6 +87,9 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb, void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int block_size, int uvlinesize, int dct_linesize, int dct_offset); +void ff_mpeg4_mcsel_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + uint8_t *const *ref_picture); int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx); int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx); int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx); diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index fe3bfc4454..8922f5b1a5 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -31,164 +31,10 @@ #include "h261.h" #include "mpegutils.h" #include "mpegvideo.h" +#include "mpeg4videodec.h" #include "qpeldsp.h" #include "wmv2.h" -static void gmc1_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - uint8_t *const *ref_picture) -{ - const uint8_t *ptr; - int src_x, src_y, motion_x, motion_y; - ptrdiff_t offset, linesize, uvlinesize; - int emu = 0; - - motion_x = s->sprite_offset[0][0]; - motion_y = s->sprite_offset[0][1]; - src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy + 1)); - src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy + 1)); - motion_x *= 1 << (3 - s->sprite_warping_accuracy); - motion_y *= 1 << (3 - s->sprite_warping_accuracy); - src_x = av_clip(src_x, -16, s->width); - if (src_x == s->width) - motion_x = 0; - src_y = av_clip(src_y, -16, s->height); - if (src_y == s->height) - motion_y = 0; - - linesize = s->linesize; - uvlinesize = s->uvlinesize; - - ptr = ref_picture[0] + src_y * linesize + src_x; - - if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || - (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) { - s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, - linesize, linesize, - 17, 17, - src_x, src_y, - s->h_edge_pos, s->v_edge_pos); - ptr = s->sc.edge_emu_buffer; - } - - 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); - } else { - int dxy; - - dxy = ((motion_x >> 3) & 1) | ((motion_y >> 2) & 2); - if (s->no_rounding) { - s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); - } else { - s->hdsp.put_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); - } - } - - if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) - return; - - motion_x = s->sprite_offset[1][0]; - motion_y = s->sprite_offset[1][1]; - src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy + 1)); - src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy + 1)); - motion_x *= 1 << (3 - s->sprite_warping_accuracy); - motion_y *= 1 << (3 - s->sprite_warping_accuracy); - src_x = av_clip(src_x, -8, s->width >> 1); - if (src_x == s->width >> 1) - motion_x = 0; - src_y = av_clip(src_y, -8, s->height >> 1); - if (src_y == s->height >> 1) - motion_y = 0; - - offset = (src_y * uvlinesize) + src_x; - ptr = ref_picture[1] + offset; - if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) || - (unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) { - s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, - uvlinesize, uvlinesize, - 9, 9, - src_x, src_y, - s->h_edge_pos >> 1, s->v_edge_pos >> 1); - 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); - - ptr = ref_picture[2] + offset; - if (emu) { - s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr, - uvlinesize, uvlinesize, - 9, 9, - src_x, src_y, - 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); -} - -static void gmc_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - uint8_t *const *ref_picture) -{ - const uint8_t *ptr; - int linesize, uvlinesize; - const int a = s->sprite_warping_accuracy; - int ox, oy; - - linesize = s->linesize; - uvlinesize = s->uvlinesize; - - ptr = ref_picture[0]; - - ox = s->sprite_offset[0][0] + s->sprite_delta[0][0] * s->mb_x * 16 + - s->sprite_delta[0][1] * s->mb_y * 16; - 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, - 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, - ox + s->sprite_delta[0][0] * 8, - oy + s->sprite_delta[1][0] * 8, - 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); - - if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) - return; - - ox = s->sprite_offset[1][0] + s->sprite_delta[0][0] * s->mb_x * 8 + - s->sprite_delta[0][1] * s->mb_y * 8; - oy = s->sprite_offset[1][1] + s->sprite_delta[1][0] * s->mb_x * 8 + - s->sprite_delta[1][1] * s->mb_y * 8; - - ptr = ref_picture[1]; - s->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); - - ptr = ref_picture[2]; - s->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); -} - static inline int hpel_motion(MpegEncContext *s, uint8_t *dest, uint8_t *src, int src_x, int src_y, @@ -849,14 +695,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, switch (s->mv_type) { case MV_TYPE_16X16: - if (!is_mpeg12 && s->mcsel) { - if (s->real_sprite_warping_points == 1) { - gmc1_motion(s, dest_y, dest_cb, dest_cr, - ref_picture); - } else { - gmc_motion(s, dest_y, dest_cb, dest_cr, - ref_picture); - } + if (CONFIG_MPEG4_DECODER && !is_mpeg12 && s->mcsel) { + ff_mpeg4_mcsel_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } else if (!is_mpeg12 && s->quarter_sample) { qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, 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/5A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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(); From patchwork Wed Oct 12 18:06:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38708 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1505392pzb; Wed, 12 Oct 2022 11:06:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D9ya2e+d30M6wISzbeOqsJ8+adBDVSqzYyw9dHetbqp+k0UNbHa4NEqFJSi6u+x9+6mWT X-Received: by 2002:aa7:dd57:0:b0:453:2d35:70bb with SMTP id o23-20020aa7dd57000000b004532d3570bbmr28681498edw.26.1665598005995; Wed, 12 Oct 2022 11:06:45 -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 ga7-20020a1709070c0700b0078c37681f89si9256062ejc.650.2022.10.12.11.06.45; Wed, 12 Oct 2022 11:06:45 -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=bEn753ch; 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 65DAF68BAF5; Wed, 12 Oct 2022 21:06:42 +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-oln040092067025.outbound.protection.outlook.com [40.92.67.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 874E468BCAE for ; Wed, 12 Oct 2022 21:06:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Me6KycbhjC/Ihd7HGZuT6EF0cIUtB0PbVRntf23hhFeEbUPtRomb1OrlAq//zKB6UUGJ6mZOd+hAk+Suf2gGq/Qk5esDsGqC/BNIASpOkJUK7TjGjwT5e/Wb5/JXlrE1GNo3lg9ZL0vY0SrP08fft6iUT8ammyRUrSzH+cU6+pCcqFvTd/HwoNCw8gkPaUdPQVAwzvQPWC3XDcCQena5NDjDXXpNPXx14ieOHiqHgnMhfUewU+tFJrZDJ4wMVEpVOQg+Q/KAX+n9nnfgK0PPk17GRF0hdQk1/7Fxo19bh8FBNS9hiMYZHwYzfamqVQ4iicTJBdTLybUyYXt7FqTX3w== 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=kN61gN4jhEage8zBc6bMy2LKK7w5J1cGzyRQxdgjAxs=; b=UqZZNn0d6poya3gLANBNGxw8TL03mz6mdxnvqgtGsEAlH9h0ne82wSVtor/tfL+FOkEmk+ycb3KLxFJIo3lmgOe27W+IGObW/32gNU0KsgqnVc0+F9Wkz2dcwclKu+M+F5ZjypycA+3s9Volq1+9He0vnjDh3/wgmQ3C2tY3dTQwOhRnQGXXHOpawXuUA6wIDyJeI2owCgXGU1N6nQM2zjul+HTfFS7J39jEHQUP3UBoLrNOpdGqTSyAC+APO6Q4SV3m0g3fKropRqafVrP90yYDsDL4FZbo/TjVQQjj4SBif6SaOe+eiKK3Kc1hIQS4s9YkGpcyAzBf3MgjyCuVng== 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=kN61gN4jhEage8zBc6bMy2LKK7w5J1cGzyRQxdgjAxs=; b=bEn753chpmGfxDMP8xx60/ltdsOFMDh9+bUbPludqvDceGC/EQN7/IqfQiHIyCT/pIFIAKy6shA150qZO6Q9MNldVS6U7BXPaaTQTRhKN0Mi9Z+VOAHhyEKOsp5BUk7gloB8Ln8qx1V8VoQr7msDSmuiLJ2EGuOL5QeqGvQthzxkvohS3mxP5zaNwXzPvLipjKvreY2ssnFmzDFC/N7N/zmRPr3eGk4cOi8h0by2kQtcSBfignPULixWYRMN2OCfOtxdGthYSjaG9XebCd0ssfKei/ld4aTaTa/qAvO3kzhBrGJgYLK3dhOjq5ZcXFoEO/MZThHkBdN63/zVmjVfXQ== 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:34 +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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:06:20 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [LMrPN3hfUpOqDLxBEPQh2clVL0cFL55bVdewaMjxy8Y=] 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-2-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: 83fa8584-5dc9-4b5a-c60b-08daac7c7f76 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3kTotjjC9DVrXGSRzCr0nLNGl0OybCog5e2TugfWDxXW9lE0GeTozzlo0nDgWDU6hSlYHLQEBVazSVP0VjK7RJi1ki3wN5/cVtmqqQacls2SiFUycFTULWsOsDSXxbyCn0ohHyaPpHsz2kBy7e7dBEmAwqCuyzH4y2RcTL+GbgS6V+hnDDA+aEKLRLoDXD+l9HvYq356kEgmXvD3w0fnEDqr21ox8F5yqCxQaBIS7ymC5mj9HWI22kscffbk+Nl3zISBaVAj/As3JpycXbOnEZRaJtRnWbS2r7/rKKDQZqZqogCfUOroalGGbF8+uUt2gP2N2w3s1Kz2deCbZayMyL4HNC+vi9xaNIG28OfFrxRCnZ7gruyVpN6hTPZLjtKfciInC21SC7ON8fn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k/SxDHWdIm0xMZSqPSTfeMTFH3IwKJlr4OBFNhabkYRJP6LItBOZJwvjDjVJpB7u1KE4qPyfA9C/8YX3KhFXAXDnmWMuCo9/l+9jITplpuRz3rDunuTImoF3SYADuV588AC1zV5qjILEpkuw4TNo6totKVSoD9oXy0+OmYNuAXaz2cvPi90SsccQ3YxcWoRTfKfAA2wQ+X9tEI+itOW0UM9vOveVqSF731ZhJBpAW4tHCql3mrP5de30ruNFpqwNhZXKv4W4fDGSwJSysMfl1K6k7RtaUUAKv2ZO86zCQ8XMjkgF5mrHlyA+rzs5L03BD77yoFElYvuOmFDsnSzQ4f6seeCZrHMu1jNw4HmlrSqnEpxKQiQ= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83fa8584-5dc9-4b5a-c60b-08daac7c7f76 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:34.2477 (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 3/6] avcodec/mpegvideo: Move sprite-related fields to Mpeg4DecContext 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: M+cRCGuGW3mJ Only used there. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 106 ++++++++++++++++++------------------- libavcodec/mpeg4videodec.h | 4 ++ libavcodec/mpegvideo.h | 4 -- libavcodec/vaapi_mpeg4.c | 2 +- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 1638664e00..dcf970af5a 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -81,12 +81,12 @@ static void gmc1_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, ptrdiff_t offset, linesize, uvlinesize; int emu = 0; - motion_x = s->sprite_offset[0][0]; - motion_y = s->sprite_offset[0][1]; - src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy + 1)); - src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy + 1)); - motion_x *= 1 << (3 - s->sprite_warping_accuracy); - motion_y *= 1 << (3 - s->sprite_warping_accuracy); + motion_x = ctx->sprite_offset[0][0]; + motion_y = ctx->sprite_offset[0][1]; + src_x = s->mb_x * 16 + (motion_x >> (ctx->sprite_warping_accuracy + 1)); + src_y = s->mb_y * 16 + (motion_y >> (ctx->sprite_warping_accuracy + 1)); + motion_x *= 1 << (3 - ctx->sprite_warping_accuracy); + motion_y *= 1 << (3 - ctx->sprite_warping_accuracy); src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) motion_x = 0; @@ -128,12 +128,12 @@ static void gmc1_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; - motion_x = s->sprite_offset[1][0]; - motion_y = s->sprite_offset[1][1]; - src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy + 1)); - src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy + 1)); - motion_x *= 1 << (3 - s->sprite_warping_accuracy); - motion_y *= 1 << (3 - s->sprite_warping_accuracy); + motion_x = ctx->sprite_offset[1][0]; + motion_y = ctx->sprite_offset[1][1]; + src_x = s->mb_x * 8 + (motion_x >> (ctx->sprite_warping_accuracy + 1)); + src_y = s->mb_y * 8 + (motion_y >> (ctx->sprite_warping_accuracy + 1)); + motion_x *= 1 << (3 - ctx->sprite_warping_accuracy); + motion_y *= 1 << (3 - ctx->sprite_warping_accuracy); src_x = av_clip(src_x, -8, s->width >> 1); if (src_x == s->width >> 1) motion_x = 0; @@ -175,7 +175,7 @@ static void gmc_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, { const uint8_t *ptr; int linesize, uvlinesize; - const int a = s->sprite_warping_accuracy; + const int a = ctx->sprite_warping_accuracy; int ox, oy; linesize = s->linesize; @@ -183,46 +183,46 @@ static void gmc_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, ptr = ref_picture[0]; - ox = s->sprite_offset[0][0] + s->sprite_delta[0][0] * s->mb_x * 16 + - s->sprite_delta[0][1] * s->mb_y * 16; - oy = s->sprite_offset[0][1] + s->sprite_delta[1][0] * s->mb_x * 16 + - s->sprite_delta[1][1] * s->mb_y * 16; + ox = ctx->sprite_offset[0][0] + ctx->sprite_delta[0][0] * s->mb_x * 16 + + ctx->sprite_delta[0][1] * s->mb_y * 16; + oy = ctx->sprite_offset[0][1] + ctx->sprite_delta[1][0] * s->mb_x * 16 + + ctx->sprite_delta[1][1] * s->mb_y * 16; 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], + ctx->sprite_delta[0][0], ctx->sprite_delta[0][1], + ctx->sprite_delta[1][0], ctx->sprite_delta[1][1], 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], - 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); + ox + ctx->sprite_delta[0][0] * 8, + oy + ctx->sprite_delta[1][0] * 8, + ctx->sprite_delta[0][0], ctx->sprite_delta[0][1], + ctx->sprite_delta[1][0], ctx->sprite_delta[1][1], + a + 1, (1 << (2 * a + 1)) - s->no_rounding, + s->h_edge_pos, s->v_edge_pos); if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; - ox = s->sprite_offset[1][0] + s->sprite_delta[0][0] * s->mb_x * 8 + - s->sprite_delta[0][1] * s->mb_y * 8; - oy = s->sprite_offset[1][1] + s->sprite_delta[1][0] * s->mb_x * 8 + - s->sprite_delta[1][1] * s->mb_y * 8; + ox = ctx->sprite_offset[1][0] + ctx->sprite_delta[0][0] * s->mb_x * 8 + + ctx->sprite_delta[0][1] * s->mb_y * 8; + oy = ctx->sprite_offset[1][1] + ctx->sprite_delta[1][0] * s->mb_x * 8 + + ctx->sprite_delta[1][1] * s->mb_y * 8; ptr = ref_picture[1]; 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], + ctx->sprite_delta[0][0], ctx->sprite_delta[0][1], + ctx->sprite_delta[1][0], ctx->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); ptr = ref_picture[2]; 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], + ctx->sprite_delta[0][0], ctx->sprite_delta[0][1], + ctx->sprite_delta[1][0], ctx->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); } @@ -233,7 +233,7 @@ void ff_mpeg4_mcsel_motion(MpegEncContext *s, { const Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; - if (s->real_sprite_warping_points == 1) { + if (ctx->real_sprite_warping_points == 1) { gmc1_motion(s, ctx, dest_y, dest_cb, dest_cr, ref_picture); } else { @@ -418,8 +418,8 @@ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; - int a = 2 << s->sprite_warping_accuracy; - int rho = 3 - s->sprite_warping_accuracy; + int a = 2 << ctx->sprite_warping_accuracy; + int rho = 3 - ctx->sprite_warping_accuracy; int r = 16 / a; int alpha = 1; int beta = 0; @@ -607,7 +607,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g sprite_delta[1][1] = a; ctx->sprite_shift[0] = 0; ctx->sprite_shift[1] = 0; - s->real_sprite_warping_points = 1; + ctx->real_sprite_warping_points = 1; } else { int shift_y = 16 - ctx->sprite_shift[0]; int shift_c = 16 - ctx->sprite_shift[1]; @@ -653,18 +653,18 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g goto overflow; } } - s->real_sprite_warping_points = ctx->num_sprite_warping_points; + ctx->real_sprite_warping_points = ctx->num_sprite_warping_points; } for (i = 0; i < 4; i++) { - s->sprite_offset[i&1][i>>1] = sprite_offset[i&1][i>>1]; - s->sprite_delta [i&1][i>>1] = sprite_delta [i&1][i>>1]; + ctx->sprite_offset[i&1][i>>1] = sprite_offset[i&1][i>>1]; + ctx->sprite_delta [i&1][i>>1] = sprite_delta [i&1][i>>1]; } return 0; overflow: - memset(s->sprite_offset, 0, sizeof(s->sprite_offset)); - memset(s->sprite_delta, 0, sizeof(s->sprite_delta)); + memset(ctx->sprite_offset, 0, sizeof(ctx->sprite_offset)); + memset(ctx->sprite_delta, 0, sizeof(ctx->sprite_delta)); return AVERROR_PATCHWELCOME; } @@ -832,25 +832,25 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) MpegEncContext *s = &ctx->m; int x, y, mb_v, sum, dx, dy, shift; int len = 1 << (s->f_code + 4); - const int a = s->sprite_warping_accuracy; + const int a = ctx->sprite_warping_accuracy; if (s->workaround_bugs & FF_BUG_AMV) len >>= s->quarter_sample; - if (s->real_sprite_warping_points == 1) { + if (ctx->real_sprite_warping_points == 1) { if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= s->quarter_sample) - sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); + sum = ctx->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); else - sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); + sum = RSHIFT(ctx->sprite_offset[0][n] * (1 << s->quarter_sample), a); } else { - dx = s->sprite_delta[n][0]; - dy = s->sprite_delta[n][1]; + dx = ctx->sprite_delta[n][0]; + dy = ctx->sprite_delta[n][1]; shift = ctx->sprite_shift[0]; if (n) dy -= 1 << (shift + a + 1); else dx -= 1 << (shift + a + 1); - mb_v = s->sprite_offset[0][n] + dx * s->mb_x * 16U + dy * s->mb_y * 16U; + mb_v = ctx->sprite_offset[0][n] + dx * s->mb_x * 16U + dy * s->mb_y * 16U; sum = 0; for (y = 0; y < 16; y++) { @@ -2698,7 +2698,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) ctx->num_sprite_warping_points = 0; return AVERROR_INVALIDDATA; } - s->sprite_warping_accuracy = get_bits(gb, 2); + ctx->sprite_warping_accuracy = get_bits(gb, 2); ctx->sprite_brightness_change = get_bits1(gb); if (ctx->vol_sprite_usage == STATIC_SPRITE) skip_bits1(gb); // low_latency_sprite @@ -3286,8 +3286,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, if (ctx->vol_sprite_usage == STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n"); } else { - memset(s->sprite_offset, 0, sizeof(s->sprite_offset)); - memset(s->sprite_delta, 0, sizeof(s->sprite_delta)); + memset(ctx->sprite_offset, 0, sizeof(ctx->sprite_offset)); + memset(ctx->sprite_delta, 0, sizeof(ctx->sprite_delta)); } } @@ -3329,7 +3329,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first, s->quarter_sample ? 'q' : 'h', s->data_partitioning, ctx->resync_marker, - ctx->num_sprite_warping_points, s->sprite_warping_accuracy, + ctx->num_sprite_warping_points, ctx->sprite_warping_accuracy, 1 - s->no_rounding, ctx->vo_type, ctx->vol_control_parameters ? " VOLC" : " ", ctx->intra_dc_threshold, ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p, diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h index 302c5c38da..c0e6ec6592 100644 --- a/libavcodec/mpeg4videodec.h +++ b/libavcodec/mpeg4videodec.h @@ -38,7 +38,11 @@ typedef struct Mpeg4DecContext { int shape; int vol_sprite_usage; int sprite_brightness_change; + int sprite_warping_accuracy; int num_sprite_warping_points; + int real_sprite_warping_points; + int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY] + int sprite_delta[2][2]; ///< sprite_delta [isY][isMVY] /// sprite trajectory points uint16_t sprite_traj[4][2]; /// sprite shift [isChroma] diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 007d681a09..925e61138d 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -376,13 +376,9 @@ typedef struct MpegEncContext { uint16_t pb_time; ///< time distance between the last b and p,s,i frame uint16_t pp_field_time; uint16_t pb_field_time; ///< like above, just for interlaced - int real_sprite_warping_points; - int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY] - int sprite_delta[2][2]; ///< sprite_delta [isY][isMVY] int mcsel; int quant_precision; int quarter_sample; ///< 1->qpel, 0->half pel ME/MC - int sprite_warping_accuracy; int data_partitioning; ///< data partitioning flag from header int partitioned_frame; ///< is current frame partitioned int low_delay; ///< no reordering needed / has no B-frames diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index ca3f3b22f6..4e74e0382b 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -66,7 +66,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ .interlaced = !s->progressive_sequence, .obmc_disable = 1, .sprite_enable = ctx->vol_sprite_usage, - .sprite_warping_accuracy = s->sprite_warping_accuracy, + .sprite_warping_accuracy = ctx->sprite_warping_accuracy, .quant_type = s->mpeg_quant, .quarter_sample = s->quarter_sample, .data_partitioned = s->data_partitioning, From patchwork Wed Oct 12 18:06:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38709 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1505471pzb; Wed, 12 Oct 2022 11:06:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tQK1y0+OI90JiSIvnQjsi7g3aJn4q90iyub85vMaIeFGrWEuaajX2QhH/HfZnX8pD2JSL X-Received: by 2002:a50:c31b:0:b0:458:cc93:8000 with SMTP id a27-20020a50c31b000000b00458cc938000mr29467806edb.264.1665598016488; Wed, 12 Oct 2022 11:06:56 -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 g10-20020a1709065d0a00b0078d27c1b499si17922943ejt.500.2022.10.12.11.06.56; Wed, 12 Oct 2022 11:06:56 -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="oxE/Ad97"; 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 7E93868BD61; Wed, 12 Oct 2022 21:06:46 +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-oln040092067025.outbound.protection.outlook.com [40.92.67.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ADAF068A6B5 for ; Wed, 12 Oct 2022 21:06:40 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FvuhiJe/PQcBpp4DrJN1TfBaYEbAWpyxfgDt/bBL523rIV2GFyWfyuA7/UOfs8CWbpj4LkbSRbgF+10K8GLlGeT9jv2o1nSNzXQpZnfcCNzEltRZzELOOStHFa6C8B1m0l43/WhdgElGGeqaYGBf3j81hRztebA19/38RMIu3IgRqrVvBbbABtmATprpB0ZifjiSc6Dv6y8KFD8WfuRsQXDKuCL6bXBjwXTfC8650G7Z3WeLjn8Z6VCgBdOMFpxlJjwUHmjaXfLxYQFDuKcWGYYqhye67u6T4I8vYm1aI6V6L4Oh1TB1A1x8mQ6dEWmZm1NZ5RcBM9THv3RmLQ+A7g== 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=OPsswVDK60ma73kPDMvNo9pU1cBCbgYvcodnWZ3w3Ms=; b=iTkoo+77ZTBQx0dtVcR+Zqa5O9ifjR/SUu4Si+k7pcCnhJIHnEa0xvsajAs02lFmnmbI+5csL8vIK0dDAN+ry4DgubFRnuA/uCX+xR6PtUyB6CHr8YORNkwL2hRBe5FrSl0jUuDYgcb4TuVLa/nNr8BWtCpz1P4rWh7dIe33YmrCtzb4jS8cSrc2qlHqnbxp+MgOXSBZv/jsxix626LT11OCj2VmnHRzzPD/EO83b8WxNquoWCK/DSIpmeoo5YluaCyzRsTlkQDgwJb8B276m6uLGibcKkl8ohPa89KXeH3dRUSqHPS7R/PyZTI2Q5YSnGgneafl2b3yr6Xj+KzGHw== 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=OPsswVDK60ma73kPDMvNo9pU1cBCbgYvcodnWZ3w3Ms=; b=oxE/Ad97wB+Mv7+r03IYtoQcAQhFLjwLVS0SahQr59p7bXXK1jpgUSIlob+xKJ5a7HDVmVUBPNN7+H+3XrQ5AT8u/26RCAD9/9cZLqYdWJEdlzb4ynuheMKbPv9tD6kMGXx/CB2rgoVUI4p5sl6xISTfZM8NNAlD4dojy1lvEIOOq6iyn8/E4RgpWs/+KO3nXWnOrji8EeR6nvey3rt6cjXn+O1Y3DNfcPAoK7IrjzSgkhExNJLm5fzjnP5WIkPxZAELWSkWGoj/yMpCHy4jLfGfiEKnTbmYxsMvE3fwK9DpqF2kYd3i+xiPRGuh1HalYt0C3BvjfxarZudbePb67w== 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:35 +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:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:06:21 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [ejKE/8uoYP0LZvYTevBKXaPCjhoDPq/w7VNrmzOr7fU=] 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-3-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: 9247fdd6-2379-4125-3f78-08daac7c803d X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKwnrVpDQWFAOsbC1250XZEGDev2RsCvDaUYznUscLmoQbmK0q3t1Byu9inlpHXeerS5+WAifj8sxxgdc62GTVu4QTg1jJbsOSdCEItWQ/dMZOnal4vhZQ6MWStjBjtAmvYMDSrxpnrxFQEaKO5n1FYsjFeWhLNWM6/Nkl1j1I3rrJiJtFpmzuEPOZj8iTdcRzYmVI+7THSpmgqz9fVtEl2ZHBWkyOHxYchO90upr6RD+vUilcnhmIGBAlrHfa2V+dQik9BvuRSVFETFUjyOzPe9QBDGftYJBfU7d9Kh48NcW9ye3JhBzd2UvFKbQ/QLgi2e90D8gOUhIPCqz3346wDyFRPjq1YkWeljovoQnANiWfFGTW3V99MyQlOQsRT2a7tioAzHtgwdIYADLyakbGycNOuFiwbz+/gHtp7jInGBoUJPnTWrwS0x45kUndcKN1GmLzB4KAUW9zJTLFFDMfF8tW95ZXGAQbelMYIWuOFJHQ9m+HAr6/+wFUkd1mpDTJtRMdLjnfeDfIJacvhi5nHsRSBtI4G4kMOYYVGvm+Pb0hk/dFBJhfkD3yXXKlN8PP62Zdv2syueJFXKLltma8JNTOFRq4bGheWVi6p6A6JsoJL7gP8XkMZMSEJzRtUu0Jlqw7soFXpy9piMKO3XFDGBya7ochWw80V883EzFvcIbyryVXU1HkjPgigfY8r2YhWKz26A3pl4Ab34D05eiz0M0vnujq0Wj3c= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MEyDYFvWxlZYzDho3xfBWfCMWJMpkgEyd9xs8xvgtyHgmYfZTBX9gkLeTFpxr0fIq4AGrlulXmkR/2W/76vEEZrvv1rxBv5KFGafow+J7F9JMcnMveOX/A7hFNLd94WTr1s3vnXUr5v9woHPtTkZh2KjI9PJyTUl711IrtnsqEfkwwFldpHDleCwqa/VCdKFIMMRndlm+YAb40qjEtlXgXFLRwAf+zZykFu/6L4eEnIPTwxLN5kJGWDx/s8VPDakwZ1OJvqnnFPwSsQ7xJhSMNDoVxCbNSX+XBgFN+eeUWqfDM6KWu6a7sdB75SkygtDQRoFgSJv7Q6wvNtPH2R/vnZoo7BMbUDnJOY/UoTUdG2uBGxsl+6djsKNactIjIV6zcBv3gi70Q/KcU/iv/IiP8A96A87eYdV9KdpA8fXVb1b20c/5gaHLw+Gja6ul1Dm1toDt/ssHuy+VkepHP75+AqB67wv130imezL5+enOQpNQ2931ajM99jMm9emjSWLO4kqTttnmpbqpOOGPPjJR0UXp/mndyiPoShycbQeAnE3KhXxemLJHrjnaR0MXKhRYEgqrX4RYl8UmmmO7DVuAsFCkPqCPkZJuEDsPloEaY9EgLYb/FDhujMmH4YAPTRgruPXX+GdNJoaIHlrNvyMu5NKCv5pZI3M5cMhF0MOLsid/PszKUxDcFFYSd/5Cl5o X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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41rB6a2Rndt8mD15ksuFmkgkWd6vM+5H5cwwupQX2GHKlY8dLq+JJvvYjjElvpQdh+BAuSzqCtb+QaFQ1Z9bn7Vx0LUspSRrystoKHddOkAvFHqYlSVG3kxxmSTF9mQP0rmaJSkHM8aTRa1J/J6MH44oDuSk5hUQzSoga1pNzG5OE7einMCcE9UC+obCpf6dC1/Q2oXFP/3qFgGol7GVxbNm3g17IXMzCcTh6OoUhrx3vyVzlAfXkIfxyD8= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9247fdd6-2379-4125-3f78-08daac7c803d 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:35.5796 (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 4/6] avcodec/mpeg4videodec: Sync sprite_warping_accuracy between threads 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: TvUHHjfiFg1d It is set in the vol header and is therefore a sequence and not only a picture property. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index dcf970af5a..aeb0d003ec 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3705,6 +3705,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, s->shape = s1->shape; s->vol_sprite_usage = s1->vol_sprite_usage; s->sprite_brightness_change = s1->sprite_brightness_change; + s->sprite_warping_accuracy = s1->sprite_warping_accuracy; s->num_sprite_warping_points = s1->num_sprite_warping_points; s->m.data_partitioning = s1->m.data_partitioning; s->rvlc = s1->rvlc; From patchwork Wed Oct 12 18:06:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38710 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1505532pzb; Wed, 12 Oct 2022 11:07:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lJaiOkKDgA2e3v9Z+yh+lWSj1prp7XGYS8w/RyNjLcIk3XHQjXBN4s6i9Jhh4bc67U3nW X-Received: by 2002:a17:906:8457:b0:78d:98e9:ad59 with SMTP id e23-20020a170906845700b0078d98e9ad59mr18354780ejy.29.1665598027136; Wed, 12 Oct 2022 11:07:07 -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 gn39-20020a1709070d2700b00782650a2738si15121541ejc.24.2022.10.12.11.07.06; Wed, 12 Oct 2022 11:07:07 -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=eCZ0Nn2n; 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 7287168BD66; Wed, 12 Oct 2022 21:06:47 +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-oln040092067025.outbound.protection.outlook.com [40.92.67.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E049B68A6B5 for ; Wed, 12 Oct 2022 21:06:45 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kmS7JIWN5ATLgXipbhe6LQ0xfRDYQNZOeUXAIJcLa8J8kIFMVDXJ01IGGyZbXPZdisHqk8w50L3tvEc+29H/J/gGs+Y5UTwIeOiyzjIJWAFJEl1M9EQbCXcm8kZytF+q2mYisEtjvBHFiFCpw8+C31+XaIwNgJDDDR6kfKKpljKr4Om3iwM0mzHxOnP2+xUIdlI2dCubnoX3pd1RLbJpO5KUe1GEzCGeXvZksdIDiidkBDWrAfHt7CFEXz6vi5PFcBRnT2aLHV02EF9mURj2MDwBTms2bz9YqcgKigeAgaFbEbL9TlhyBfCsJepxdZP5SiKBhtzuSg/qvsN+E8RyXA== 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=Lxp0SF0I40W9BuSh8mOA8yQkESg30FIVhBhO1/52HSQ=; b=Zv1h5Hx7IFzeeY86j+zm/OdyZ3VPArYXqabCWFo045d9vI8FlwWNbbAGAGBkbmQUzMD55dNuzEok0DnuMXIjlASinVdM1ORNplR/CCAOcKd9S56YzVuFiVX5X8qKXQhdDsARmqWTVFKF76u33+yQmc9N5QD3xzGCZYPyWTyycNMRlNVJwYO8mvupVX59CBrZ5CdeoNpHLOYBgv/l1w2GXNF9YdwpbjrxP3HLkEFrDJyhhw89ytsgZl5ACBuCAVf1460+h7xVjyBm12dCaLG0eH4jbt6w4p0cLvjJ1rZALyWOG2sD8jy01W1V3hA+t3onqRAmKVeYJDfCEP4AxokGdQ== 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=Lxp0SF0I40W9BuSh8mOA8yQkESg30FIVhBhO1/52HSQ=; b=eCZ0Nn2neBmm4bjGX1ugHGDuFIHOaO8h+DFgxTy2sxISbv1NTaLpAE3f3olEiVZkNSLIUoCxhgwdfaeJB1+q13isNtDfYFNMk6rzTg/NRuxr8SHzP20cn04+qTzZkfyINaBCj84JVpqV/RcxPBzs2QqWn8FMcOCwbGvUWfvIGqztPAmLBlNEsELxjheMewg97J7xW3Bu9JqnDFAlh/2FaZi3yFLEEQyy6S+H8nsTzsuo+Y56TjkZ9l32CQC8Io8CVtKGWcC5SARqEvH1VvlByY5gbVGTPErLoouf7+x3yGeJ394n+XZwM+GVCl+Bf915ABSzCS4scRhPqgBuwJ4WEg== 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:36 +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:36 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:06:22 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [jRf4Z/pT8K8/lQK/alwhQZAYwty3Xu5TZ0659tZoS4o=] 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-4-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: a8eb6dd1-69d3-4542-582d-08daac7c80cc X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHWQzKB2Hr/Rk2TmbbY3HYadj/NQCuQPlzL8mxgoiz1mH8Q3F5KAfQ4GQYMWUNOdwhdOPxRmraztGGFCAPiVb5YTwrnF1zLZvkUpyamcqr6X9uv1z7rBcedqNZ5akeS/RgEi4zstEOH02bNoQFU3JcZsyGLk55VdMatwQ3p049TL2jTtc8lXqZoBp+McK8BIYpdFyHVQEBdNe6lWB/sZU6PZFqoJ5hHNLt/4M0ndoDvte2fOP7Y8/iQ9SDBu35uQYseb3kqOKVNVh4RQOvzxGgUBW1cWTMLB7i/+OCxsRZKVqfSnHx6a7DgHpfh8/Whouree3+st3LeVaHjqNbmJT87IcmZp84Q13+KfrTE/cDowA1Snu6ZAA02BodHDU98I680WNcFwjT/69Lag+Js7KEn3zVmpA4B1kKoPXJc+ShS50DTFBBO/SiNleYpN4Ar7bdWlSMNHETAjKORJTvSTmOq7WTO7qj2VndxQvBIkUwjucKm2p0BihbxwxLM+BdXfjdBgRAqiUwhQk58erUfqgg/8XJNxTWdO6CKDcbajHyWfod23bukN23sqZ71bjfGDd4089Eq5NygKAVjdzB967Pn5IbGJ/MNC6bSm8ZL/yq7WeC0ixj44jymoDFtu55a48eV6EWBhYbZZpc+5cmsCjL0YTGB4bDX1ElcvHxHEk2NOLrNjqUqO1pmVNJKPTe4BMXf6o0z7o0bbuw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XCpK9HaErrTnqSZDNytoyIJ23TS62BKmcGQf3AwaEW0rdSgsvYOkL90u1eq5t+48yVxErfALuR6C1pQQYgPSwhpgKk2kMMfzglgKFz2V2yuZwNjJotA8JhKY0L9X2Mlbwu7Ye0pEb3gyGU8L5SJM/ACbC25emsODdC503IjTl/mRaEv9dpc9xQcnK/W2Wlu7vTjVD638XABDJ7TssDWv2alXxgY38Qh1hJyA1dRNkxEKyvSfTO54L0rNW2l2K0qxi0q6P1YWC1jaDEWw+IGPVUTZhuPmD4h9/XxMe3CGyCS0lMYuAg2k3KCNGd1GEJl2PelbZ2i5PNpvwcMKO/xS/ACARCkKPPGj1B5Zkn5GuOTvW/aX7Srt/tButhIQCg05Fi+0JKLvj41ZsdGuVudsQOw4rWtLbWwkygNFEW/Zn3zk3U2esKRTXiTKEzU+tZ9cs5S26Wvyy7FfReqe8bypyDUpMltKv5jBntrUCjEeGtGJz9LQHkNSz3dNS+f6KZD70+Ze7tRRzBGeoG0zzb78uW9sU9ZMhvE8c1nWGO71ksP0SQdCUj/8nOzLm8I5GaQszXUmHEe7Aj1srVODp+fDPukfgsYs1i5mGhlb8FCwtfxTHTQpHP7S4/Z4sOveix5a3lSkRqIqeao6QGK2BSsHs5VbU60+WcCWa7QWecjGYwkxgOPMW70797ETCX67le41 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oiF6Bg56eyyBOh6Btscafmd9y4k/kLliHP2yfP2DhnrLGTKhkqhIHPL+AgBhZB0b8sT6mRxIWydl72/63QQSL5fRyDxPyxY1qqPcul1D1M+AUfNgfPDHYHxjf4nD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Lpjgh8gmBxeDCgP3Cc9OY8gIsWFsB+Rpc13z13YlWhtHHgmcP0dfIz9RkCaEZXGTkIGkb3shMOuj5Tg37jZtj3Xpw9qAQd7URzGz1pPwtz4dX4topN/eXkg8WpJvHZb4M= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8eb6dd1-69d3-4542-582d-08daac7c80cc 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:36.4861 (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 5/6] avcodec/mpeg4videodec: Remove always-true checks 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: ZTDFe+fIHjWt codec_id is always AV_CODEC_ID_MPEG4 in this file. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index aeb0d003ec..b4e2c09706 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1648,6 +1648,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) int16_t *mot_val; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; + int next; av_assert2(s == (void*)ctx); av_assert2(s->h263_pred); @@ -1999,8 +2000,7 @@ intra: end: /* per-MB end of slice check */ - if (s->codec_id == AV_CODEC_ID_MPEG4) { - int next = mpeg4_is_resync(ctx); + next = mpeg4_is_resync(ctx); if (next) { if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) { return AVERROR_INVALIDDATA; @@ -2019,7 +2019,6 @@ end: return SLICE_END; } - } return SLICE_OK; } @@ -3084,7 +3083,6 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && - s->codec_id == AV_CODEC_ID_MPEG4 && avctx->idct_algo == FF_IDCT_AUTO) { avctx->idct_algo = FF_IDCT_XVID; ff_mpv_idct_init(s); From patchwork Wed Oct 12 18:06:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38711 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1505621pzb; Wed, 12 Oct 2022 11:07:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM578esdrQmjwKFJjHJCw1v9CHnA2Vggkg4c4RXlN4nPtArPuSPCbI4mXcgviauGSB6ObPvT X-Received: by 2002:a17:907:3e02:b0:782:1267:f2c8 with SMTP id hp2-20020a1709073e0200b007821267f2c8mr23617993ejc.585.1665598037972; Wed, 12 Oct 2022 11:07:17 -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 t2-20020a056402524200b0045968aa645dsi19846791edd.30.2022.10.12.11.07.17; Wed, 12 Oct 2022 11:07:17 -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=B9+mDa+u; 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 752DC68BD5C; Wed, 12 Oct 2022 21:06:48 +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-oln040092067025.outbound.protection.outlook.com [40.92.67.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1B01C68BCDA for ; Wed, 12 Oct 2022 21:06:46 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GWfm7IVGvNLM2SXxC7NVzjp+nrKKmAUfR/Pa8iwG6g3M3p1JBBxZIS3N8M3MCb0ogLF6Vfdua3G/3v9A2SefucFsElKoLsZ33rJJyJ2Gy2JAcg5kfo3j0E22IRENEu+MzvzMFSKF6iG5DBER+bs2S8YNvm7ThE0hkEKMZaOSyoNyHk62OCxcBuFDxWROaEW9phb//ZwfIA6thm3vhABtRy0PopBRVAYD3Jx8lAKw3UPZE5Atkn4tgRtGsIHfZHnIy50HZPNAKL9P7eBqOPG6cXaEpVslaSxIBHxXObTQ8CplkQtgJPPX8k7ZTuBSKskQrbWKItbx4wUQn9DTTePcYQ== 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=XUE+YHYo6HKQfDBVvbC8ePoXG4C8xmTmQEFhBObEn3s=; b=XiXw1UwtJ7pzZCcTncuUIaWHtgeGYvpCZPoqrfsOiGHaBpz7UuOAHZCPufVU7X+p9szC4scCAQXSPtZYhiCuMl8jR7AUHaX91z8tXD/4gBuqhTpWbOlDpEO2yDN10z2Y+4NP1Pk5HCQDanDBzULetoXzfK52EQ6SPQPo+PqidbfXDjdCT6uZ/ugfYjGkJx8Md8WUId/EjQxWdaXUAqs7Rfl+NLmuXTA1Iz+3lXL8ABoXnouPFNYm4gfqHvCGrr1/LNPehFo6r7QnzJu4lH2db+wP6Mev4OJ1wJ85xJDImYtQ6dbhBhfkMi5icsKCCe0+2lJvT00y4vc+COoXUHBgYA== 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=XUE+YHYo6HKQfDBVvbC8ePoXG4C8xmTmQEFhBObEn3s=; b=B9+mDa+uq+ChsY1lBzIhuhPdYD9Box1FU0YDHaFsGC61+azMsRLrdHweZ+azHJa/vFmFYDHG0rAV72+buYCye+Bi3FnTvafpR557iYA2IsU4OjKQ5GuxagI0LTol6QGWmK7EoRYJlBgEAP/GAcDOTHPCrcsA2SjJcyXhmSnnIRxzGFR9+TKaxF+D4AkG7APKdhQ2/xQsM/eqbhqURL5i88g80936KJalf+CitbjpYGwTyyQ1BnhCipKuddurfh7pcxodZbPtLLFTRhMYpUAKZ2h281qJHhupzdaiXdLf1elIYbtB61AML5YJT71nYzgZ9ibyvP5jNPlyvHJn41efbg== 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:37 +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:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 20:06:23 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [E8QAQVqjdVpFmHKqMUjMi4O3WQsYyYw7WdLtZfGpeSk=] 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-5-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: eb9386c1-ede8-4ff5-83c5-08daac7c8162 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqnpNgInvu+2FGvrKiQOZUvzX0soCLuFrsYtl4NQyYA97PD5wN+6KeqCChIeJivYwPaVzAotSMv3/w2P60HIONPyi2EeCJ7bpMHBFv+SdEOj1gATDDpWjsGvX1NUy30PpiS8bDMA+ZUPX6iNpemQW4i//6nPBGTjWI9roFfACRlJ1gjUxVef32uzPl7De4uw/WGtGzdUdChfetAeMTz2G1imub9s9p3rVY7jTYLaxKAzzzjKTck/Z5DKUTLo+3a/1dSjT58Ot5ibLJjkESzxOvmgCg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oSSltzMh9f7X7LxZNUkthAlBOlraSPx7TR1JxhaXTKh2sdu3STktyC/xSOfKii01ku0dC5hjjBHpThnrL/g1H4VpD/DRVII/TVUuiZCpe1bmsBZDN/CA9Abg2z+zcm/IJjU8MgpUR4xzXN88CectJg0bYAQdlXoUb4Lz4ca35xr7+QyftIvwAveV80H0hPsWvmMtxzcXfJ3cQrK7qztBZG9hdcMlSBooBzwaw6kBwWhUBlXKSj727zWxluRphbHMJ0GbaNnkB9SbCyUGDgNW/tDf4MS3gixtvuIMEJGUH7RZMzF1Ww4ClQY7TDvGWqlwEfEIgqAi/fGugT0RhRwj9tAt1FgFZCmSjnRdElKt0fjN81tysStwNcivqExRGn5j7exRr3hcNXA1mhoAUrVx4FLGhYqv69zDd0kdMRIT1+O2bMYX3KT76i6pxZt9POszCuazYxwHOoHx/Ij X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb9386c1-ede8-4ff5-83c5-08daac7c8162 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:37.4860 (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 6/6] avcodec/mpeg4videodec: Reindent after the previous commit 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: K5M9nLhCvl9s Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index b4e2c09706..c4f268c534 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2001,25 +2001,25 @@ intra: end: /* per-MB end of slice check */ next = mpeg4_is_resync(ctx); - if (next) { - if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) { - return AVERROR_INVALIDDATA; - } else if (s->mb_x + s->mb_y*s->mb_width + 1 >= next) - return SLICE_END; - - if (s->pict_type == AV_PICTURE_TYPE_B) { - const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1; - ff_thread_await_progress(&s->next_picture_ptr->tf, - (s->mb_x + delta >= s->mb_width) - ? FFMIN(s->mb_y + 1, s->mb_height - 1) - : s->mb_y, 0); - if (s->next_picture.mbskip_table[xy + delta]) - return SLICE_OK; - } - + if (next) { + if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) { + return AVERROR_INVALIDDATA; + } else if (s->mb_x + s->mb_y*s->mb_width + 1 >= next) return SLICE_END; + + if (s->pict_type == AV_PICTURE_TYPE_B) { + const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1; + ff_thread_await_progress(&s->next_picture_ptr->tf, + (s->mb_x + delta >= s->mb_width) + ? FFMIN(s->mb_y + 1, s->mb_height - 1) + : s->mb_y, 0); + if (s->next_picture.mbskip_table[xy + delta]) + return SLICE_OK; } + return SLICE_END; + } + return SLICE_OK; }