From patchwork Thu Sep 30 03:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 30682 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp233625iob; Wed, 29 Sep 2021 20:31:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzmaiCaDV6hDC0tQSKACvxv9NTFLAIXTzxfvt1MfZ593JSkvH0Pr514t4oapXDpPgRysHq X-Received: by 2002:a50:9d44:: with SMTP id j4mr4409065edk.173.1632972668637; Wed, 29 Sep 2021 20:31:08 -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 j30si2406063ejo.706.2021.09.29.20.31.07; Wed, 29 Sep 2021 20:31:08 -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=@hotmail.com header.s=selector1 header.b=blCODMFO; 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=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E967468A7A9; Thu, 30 Sep 2021 06:31:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08olkn2079.outbound.protection.outlook.com [40.92.46.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7F1068996A for ; Thu, 30 Sep 2021 06:30:57 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DogVdtv4ANTZFsqxKwh/+3Ghgl1A5cKt/FViGb/4+dpCWs90ddi4kTJyUN792bE1C3B2+Q8Fj+54NQnqE/z/yNlWT+owqBxWvN0L669dBheb+qdmA3PLn+VLZ/dR2W1JkH2PwMAQM3P5PdfbBWjwUqbf/csZ1duHEiZ5KriC8VG+nDB62vksTyNki8Y722wTrXFe4tu+GoDtyE+avyiPSSlSRdjQ6goXSa68cu5YI0rBb1xQmasJkE0f8y2h/pmg7Pg58v4i9MvLJRCqp6YctxxK63VxQq68btzJV+ekJ5i7uGLCxIHyZcHC6Un7rwBHOpThnueHjQqWFC9u5IM3gA== 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; bh=VHWVMVGGUoSGBAP9ZqK9Ftgp+sRwljMYG+52tmgquJk=; b=ZynbSKPW29yQ7MMyO7d7c0dsr7hvM/UzTtlzDWHUkASf4rFziN+Jr382MoyQ9rlZjPBdEURheSOdim8DuhDZtibBRqwKBB0ZU94cWGYG97AdrFLdIlKnn/4fBSx/9+eIp4iZIBbrO69mYlhLaZwecF2MJUPaFpNoxORD4CLOHLOQDJGfVgWBagxzdeKwfv82aHgQ9DGRvte8DXSIgcOixMrPm+Mn3t9EtYwqnVHMcVCp8iAa99Mh21mulVB1tXPRb2nwtM3r3hFtHoqthcT/xaAaNU74e3NGbJVYq0Ew9njdJ6P3PgkHIGV0xF32zmyFmdXCjax5c8Rz2fanWSn3kg== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VHWVMVGGUoSGBAP9ZqK9Ftgp+sRwljMYG+52tmgquJk=; b=blCODMFO5i6CYLyFx/horSmWvGQA6SPQ1kmWcGeRV85k8iS7VbIuyWKb2JSi3D9Q8+wsLmx7fnX4nBSW3Cqv9+BG3q3kdlek5Di+MAkpzL3eVLQw0PepRQeVrf57cW2fnJG4vm0tLqv2p/isD0UWKX3yhEaHpOdaWJOk/Uzhn42IOCdxDxiEVzDNOfCu+bFNXMSQPMO7x7tTKJaaSh8kmTA2zrkIbeCNAFLZzECM30HuTHpI/B1xjl51/068Eave01rIeuS4IWiVo9WpnkHJNFRmbxs0c7NNwvmyfMg6OF46Xhk3j3ReptMXR8CQMRdql6OQ+PX+sTeEscCBltibAw== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB5597.namprd04.prod.outlook.com (2603:10b6:208:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Thu, 30 Sep 2021 03:30:54 +0000 Received: from MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb]) by MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb%5]) with mapi id 15.20.4544.022; Thu, 30 Sep 2021 03:30:54 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH 1/1] avutil/frame: Document the possibility of negative line sizes Thread-Index: AQIk8DiTYM0jzKepyPbg0cPYPptoIgNxRIVr Date: Thu, 30 Sep 2021 03:30:54 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [BVleDFna4jTC46xqmswkC+O7w4qcDhar] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9e7cc371-ebd1-4836-29cd-08d983c2b5dc x-ms-traffictypediagnostic: MN2PR04MB5597: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Y0QzbSiYY9HlRMeU+99+fmd5KekOJKcTZyY3GG8+KrmmWM+g+Qs852Myv3maV2R2XOU/LEdsGenCkbiqWFa0Tsplf01WO6LD1QlZhwoKPk7L1qa2wXBQh1JbGBfmZqeB05JLp83D8h+rtoOY+sf4KTOxJtinfpOJ8K+WFdwo0ai65q7ICM6Orx7v4d472S+lL0IS+teT9Y07wZ7lJLTM34VUNR96t8LoGxN0NP84+djifo76LQ7GM9CSWu0FnSvIxcVS7qvNCoLKycigm2fbtg5rrdRgK2r7FQOK1YrmqWsKVhC0TEEYy+jnMQ/sorfrjIBGKBV+3SW7Lx6/ZLWIbCHFBXAX+H7rMl0MqGa9JRV6FRZzqUoGUbaKN4c1hkRWpyz/3fiyQJhsX2I+nxpOWOVcIzlDNowF64R+qR23vgzsYchGpPt/A+jnRPFKMXUq x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 2h6me3H65bj8jj1KzvWmYOYedJ4fwK5jE5cRP9gCcC8LHDiiWPDz7/CQRuSTMT8eO6cArWcPJF//QXRU9cjaqTvEJlnHiGUywg0JM4UjzNhsz2sRvVnTFtR7FHUqY9ktFI+d7fmcUiG+sCJOc3tZCg== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-529c7.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB5981.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 9e7cc371-ebd1-4836-29cd-08d983c2b5dc X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2021 03:30:54.6195 (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: MN2PR04MB5597 Subject: [FFmpeg-devel] [PATCH 1/1] avutil/frame: Document the possibility of negative line sizes 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PDQwhYMFPDZX Signed-off-by: softworkz --- libavutil/frame.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavutil/frame.h b/libavutil/frame.h index ff2540a20f..f07e690410 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -304,7 +304,8 @@ typedef struct AVFrame { #define AV_NUM_DATA_POINTERS 8 /** * pointer to the picture/channel planes. - * This might be different from the first allocated byte + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. * * Some decoders access areas outside 0,0 - width,height, please * see avcodec_align_dimensions2(). Some filters and swscale can read @@ -313,11 +314,16 @@ typedef struct AVFrame { * * NOTE: Except for hwaccel formats, pointers not needed by the format * MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** - * For video, size in bytes of each picture line. + * For video, a positive or negative value, the ABS() value of which is indicating + * the size in bytes of each picture line. * For audio, size in bytes of each plane. * * For audio, only linesize[0] may be set. For planar audio, each channel @@ -330,6 +336,9 @@ typedef struct AVFrame { * * @note The linesize may be larger than the size of usable data -- there * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. */ int linesize[AV_NUM_DATA_POINTERS];