From patchwork Tue Oct 12 16:02:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 31088 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp4936777ioa; Tue, 12 Oct 2021 09:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwM3U4TdjRztvWx1+RSYTptyQsy/WPgsqiyiVzdrswodapz3uJCVQQn0ZtGI3MWJmU3uGJ0 X-Received: by 2002:a05:600c:4fd3:: with SMTP id o19mr6474051wmq.147.1634054570930; Tue, 12 Oct 2021 09:02:50 -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 g1si17072030ejp.158.2021.10.12.09.02.49; Tue, 12 Oct 2021 09:02:50 -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=opvEwMKu; 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 7049568A8E7; Tue, 12 Oct 2021 19:02:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2049.outbound.protection.outlook.com [40.92.19.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4AF7368A87C for ; Tue, 12 Oct 2021 19:02:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEUxtwNFQAiMS5PFjpis1sCx/gxh3AJZxZy+SN6R65ukntJfcnOJ9UD5GBE8lTqd5z5ovOIIA9lngdTBKijXQeJXccCvGlwaWv041phZ3/fd2pZML2/KkWaAW41fDg4eSxqKYX3X9gvq8ymQCjys84Y2OhFSaqDaEGkNA4RDpsZwK8LAoZeQOEXgW9vAOuyOQgJao5KI2ZhyJ8TvwtWVcPqUaUi7BUSS6t/v2W6zsOl0Ehc3NISln9nTZNZuUSZfuDW69SHxDKhAQhQEEfpGfZZBe9XCTg0wbJIsypR1ApKRXqB15oKe5/kw4bpJuZp/QZr3Grb23ITTfyQ3XxtWjA== 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=ADV3Oz3xzHeO1v3r+EevodMpDbQEEB5qx3uZPNuS7Lg=; b=B0A+JUNuxOe2vz50WG8iEiVydLwEvxEUUgtSBQCcXfpGDHwghqpha5B4WWOXlLR36KApQH8Au7HVLda3ZDXUSsZ5hQZNlBtwdBkNNNolLVc4R7oQh4VpANFqndcO99Lb4dy7L9VZm6EyJRMEUUjzEvNnXcfKHaCPtoqrBR1FdMEyY466PTtKCx6dWnWp0hyybFjUoz5TW9nrdMW5XWNrnQ62FHJnJPdNq3ELi22h89eyPDdwxU0LGcKTA+fcMbc5m8PxiuadHkiB0m9bxiNymPd8VE3KlYCzJUvgM9M7prtlZrIT+plzsL45YtOTQm9jwwxaJcom4TVteNByKCm54g== 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=ADV3Oz3xzHeO1v3r+EevodMpDbQEEB5qx3uZPNuS7Lg=; b=opvEwMKuMIUxNKiZZayI/8jWOrcG5qw74oc0tBClXQ8SxIjfOUzUMkiiSkcSlIUrFILboV2tQunLaADWXpvEy0FOjts8/nu1dkXZOWwZzruAWhaFKo4KkUVDLwX7q97PatZzBFP/wBoguW5DzEL+v64hHHdHwZJkd7GtCTcWaJnL+3GfFkm76ZEAS4jMbQeQwx1ITrw3Sq67SbAxbGZSwuhBp/bY1QQSfMUmaBRE7a/AYKhttxtsNjURkuJ8ADySQOZQiVRO5M8vAqoqN66fUWxwJ9g37to6in6dhJWfsjKpw73ok//DYSYBLKrzO0aQo3SPhFaBsI8DztITN/47eQ== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB5503.namprd04.prod.outlook.com (2603:10b6:208:e4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25; Tue, 12 Oct 2021 16:02:31 +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.4587.026; Tue, 12 Oct 2021 16:02:31 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v2 1/1] avutil/frame: Document the possibility of negative line sizes Thread-Index: AQHXv4KQN62XeHJ1ekWuZqM1kdIMJQ== Date: Tue, 12 Oct 2021 16:02:31 +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: [TmXbXHOsXbCqP3MI7kWVXdv2b2HEx/XV] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 944443c0-1437-4228-6b5a-08d98d99b2d9 x-ms-traffictypediagnostic: MN2PR04MB5503: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YepUvZefzTERMecZWkBpldwjPKlXcK6fxqgkpjJobhtSZmPy8paHKYZeAZidG/XkRoJhSb3Vic8+AAp6ILejOVROABZrLw7vZMkl5N4Ma1LRZy5OuL4+hjKkBduhVfk4V/sgOzydIiM/IU/9xL0W4Anehk/lbPdrXI0nlBSbiFv/ao30lGt8vQpA6c1lmu3UUp3MSE1ma3XVGny53hS0uX7WGrII49spgB2Hj7H9Vmh+LWP0IW1Bu54O3DEFFakQK89JbDoywIPGK7B+obo4+RWz9dYIC3kvXyBOXmvvges6SJhTQWTy5LXXaxx+pjEzYwotqsRhTCqXEP/JVD6sGj7wfspnPHPxkDIEI1UQI5yeteXuNlgBIWT4i71Rbn1bEnWNHLJvywl/KCdAL2xvqyaNZu5HeQsPCySOYfM80LEbSq8iKldJV8lTbl0WaXUR x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Z+brcf/seFnCSOyjisIQcAVkh9WyLUNEdhlcIaQZQ2/kvujRaN5LUqwlWjbcX/cFZMfalAZ+ReqeTPQVDn6lP05G9XOJF41FsW0/fSpgarMPyer4F3NTopoXMFFlpCpoe9Io5xbxknrr1/dY+OgTXg== 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: 944443c0-1437-4228-6b5a-08d98d99b2d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2021 16:02:31.9312 (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: MN2PR04MB5503 Subject: [FFmpeg-devel] [PATCH v2 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: 1Mdt+0/Rfu26 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, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) + * - 0 for a more compact representation of a read only + * constant color frame + * * 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];