From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0638A44FCA for ; Thu, 15 Dec 2022 23:26:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AE73368BD46; Fri, 16 Dec 2022 01:26:11 +0200 (EET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2081.outbound.protection.outlook.com [40.92.73.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD89868BA5F for ; Fri, 16 Dec 2022 01:26:04 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdVYDfutCbTpot+X8fCbZanAVQuSfCAmGLSZmNp+tHcDGaxQ1KXCsA6DpivHF/nep/9M/cW17SWsCVqs08hwD4aOqa6KavNCEd9TY6uARiRxsBLlNlaAafLPpcxMEbQGDk61IlNANkpZI68RepiVR/9r4Rhwhu8kUfoEvQgT1B0YRcfYN/MYfK+i4Kd8NpbkINrY7YWDQZdYe4/u3fj5WwrJRnAz8aiuzf6HXksNQR3AwQusQjnC70ChpiyI+WNwmt0MmIolO3TiGONaMIYqUsjaWUtep+kRHueB0ad5+jNetczculprWTOFTXIbkoZ03StBBCHPEwvpOonazgtD+g== 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=ajkxYiKgNfGO5Axtny1Xgx5AScfyN7voCaP3CJ2ldGs=; b=B1GCf3q+qoNuy0GKcXN8nOj9gUHQDxFnRBN/nQlvecDPMTMHL09ElWyQiVgaUj7gDuFof6Yc4LYn0Gw1wZefPqcYK0sy6RNIeWMFOdInRWr8xOp7rEnyy8pykaM6XmFS3hCK2kXyVShvziS+uzeuc+LnFwH9gLisQpL5SUoTUL5bjK+xNyFdclxuceMYVPDVNBxeC8b8At1cC6b6UxAb6+LNVNVjLavOZZgneQNq7zrerzAthRg6FLNYcc+lnnA9bg2eF4HS7VOO38EJ9mMxy6kFK6PtjqZhf2vogouqEk05TtFIOYWHyKO6qkiD9ULGz/DVO4o2yAKQ8hCV/y1Z0g== 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=ajkxYiKgNfGO5Axtny1Xgx5AScfyN7voCaP3CJ2ldGs=; b=sQ5u7xmyTgCnmDgWuWJiaYQXm96/knyHc3N6C6OxT8TBb22/ZMQXIAsbgRRAwwbPg6bzid466hn1yWIjVv0BOQiqhCiYjjsaHC5CE4Z11I/yQCBzFYTWCDZk7jEWDUoIstqGBKGgUvkNmxT8fmT4D16kxPrjYy1dgm/2E+L+bEfIlF/7I+Sbt1x9gbhZEecbGhT2tS6BBFPYrrjydQrRjCZSBSyTGiE8MYjpxUwiEINnxvf2kg0oKcqKG+5cSqT6mFfbUlEnPUi7SunxFFHy3l9r6VA8CkG+miFIJc33tvQbNI3bCau5qJFBfhU4UCYxmq1BOfqoF/nP7TdVIDxmOA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0963.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5a2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Thu, 15 Dec 2022 23:26:03 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::da14:61e3:630a:70b5]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::da14:61e3:630a:70b5%8]) with mapi id 15.20.5924.011; Thu, 15 Dec 2022 23:26:02 +0000 Message-ID: Date: Fri, 16 Dec 2022 00:26:25 +0100 To: ffmpeg-devel@ffmpeg.org References: <20221215185959.19191-1-etemesicaleb@gmail.com> Content-Language: en-US From: Andreas Rheinhardt In-Reply-To: <20221215185959.19191-1-etemesicaleb@gmail.com> X-TMN: [yFHITpxFGe1y5t+5vjjG5guT78i48hiy] X-ClientProxiedBy: FR0P281CA0145.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::18) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0963:EE_ X-MS-Office365-Filtering-Correlation-Id: c30c1ab7-50fe-4f9f-5e4e-08dadef3bb3d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SEzyQjwMuYKfrmsC532z7lHhCkv7leeSDPrQPyJCHHcx362Y/rUPBCdhl6TYPo5ppgVzw15QcmNujkcrI3rHHdmUxup4YnXvb++q/QpjjrtrMXDHV50pjddQsg+FBH5Ccv4O/kWj8FqHjik64tg6HvzMYQ0b+5nLMcAQaOlaXpgwS/acPxd99Lwk4btcn5FedSZjouMARBcqr8NBmt8T7yJvkJccQgLo+W03DVp2H8J/uSpkbJbXgG98FjtJuoHnHcX7NzcbBhBh1Gh9VHwyHcYOe7NrJOIua78WVvUvud1HKkHLKFfoe6UdjVgE7JJ11STqViHgotIjxe6zjhqc0SVHN5t2kEPgnyUM7QijFet7ssnVzMj2KvYGAgbCS5nMyRPBSX2SNmvdCDNbLZcWDwOALnWKlJ1Vvu2dkm6FesY3oQlvosODQ6wcjxVAZHhBLFmQ0iUEQOpsNWwmGXswoSItNMi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GhBcDNxMkNw?= =?utf-8?B?UHpmaHBWbE40WVdVMHhUeXBDclkrZTJPU2JDTW41NllaNm81L29uK2pUMUlI?= =?utf-8?B?aGU2QVNqb3NBVFVMV25mdkgxYWJrc0U5cmJyelBLRTh4K2tjazdocTBFeVpx?= =?utf-8?B?L1RqWlB4SUdQT0RqTnRxMnpja2lWTTlIV0ttT1ltVVdZdHNxS1NGKy9GdlQ4?= =?utf-8?Q?hBBdKxw413rP2o9Glc=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c30c1ab7-50fe-4f9f-5e4e-08dadef3bb3d X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2022 23:26:02.8939 (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: AS8P250MB0963 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Move decoder structs to header files 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: etemesicaleb@gmail.com: > From: caleb > > This should pave way for HTJ2K decoding > > --- > libavcodec/jpeg2000dec.c | 96 +---------------------------- > libavcodec/jpeg2000dec.h | 126 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 127 insertions(+), 95 deletions(-) > create mode 100644 libavcodec/jpeg2000dec.h > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > index c2b81ec103..7fc09cb558 100644 > --- a/libavcodec/jpeg2000dec.c > +++ b/libavcodec/jpeg2000dec.c > @@ -42,101 +42,7 @@ > #include "jpeg2000.h" > #include "jpeg2000dsp.h" > #include "profiles.h" > - > -#define JP2_SIG_TYPE 0x6A502020 > -#define JP2_SIG_VALUE 0x0D0A870A > -#define JP2_CODESTREAM 0x6A703263 > -#define JP2_HEADER 0x6A703268 > - > -#define HAD_COC 0x01 > -#define HAD_QCC 0x02 > - > -#define MAX_POCS 32 > - > -typedef struct Jpeg2000POCEntry { > - uint16_t LYEpoc; > - uint16_t CSpoc; > - uint16_t CEpoc; > - uint8_t RSpoc; > - uint8_t REpoc; > - uint8_t Ppoc; > -} Jpeg2000POCEntry; > - > -typedef struct Jpeg2000POC { > - Jpeg2000POCEntry poc[MAX_POCS]; > - int nb_poc; > - int is_default; > -} Jpeg2000POC; > - > -typedef struct Jpeg2000TilePart { > - uint8_t tile_index; // Tile index who refers the tile-part > - const uint8_t *tp_end; > - GetByteContext header_tpg; // bit stream of header if PPM header is used > - GetByteContext tpg; // bit stream in tile-part > -} Jpeg2000TilePart; > - > -/* RMK: For JPEG2000 DCINEMA 3 tile-parts in a tile > - * one per component, so tile_part elements have a size of 3 */ > -typedef struct Jpeg2000Tile { > - Jpeg2000Component *comp; > - uint8_t properties[4]; > - Jpeg2000CodingStyle codsty[4]; > - Jpeg2000QuantStyle qntsty[4]; > - Jpeg2000POC poc; > - Jpeg2000TilePart tile_part[32]; > - uint8_t has_ppt; // whether this tile has a ppt marker > - uint8_t *packed_headers; // contains packed headers. Used only along with PPT marker > - int packed_headers_size; // size in bytes of the packed headers > - GetByteContext packed_headers_stream; // byte context corresponding to packed headers > - uint16_t tp_idx; // Tile-part index > - int coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}} > -} Jpeg2000Tile; > - > -typedef struct Jpeg2000DecoderContext { > - AVClass *class; > - AVCodecContext *avctx; > - GetByteContext g; > - > - int width, height; > - int image_offset_x, image_offset_y; > - int tile_offset_x, tile_offset_y; > - uint8_t cbps[4]; // bits per sample in particular components > - uint8_t sgnd[4]; // if a component is signed > - uint8_t properties[4]; > - > - uint8_t has_ppm; > - uint8_t *packed_headers; // contains packed headers. Used only along with PPM marker > - int packed_headers_size; > - GetByteContext packed_headers_stream; > - uint8_t in_tile_headers; > - > - int cdx[4], cdy[4]; > - int precision; > - int ncomponents; > - int colour_space; > - uint32_t palette[256]; > - int8_t pal8; > - int cdef[4]; > - int tile_width, tile_height; > - unsigned numXtiles, numYtiles; > - int maxtilelen; > - AVRational sar; > - > - Jpeg2000CodingStyle codsty[4]; > - Jpeg2000QuantStyle qntsty[4]; > - Jpeg2000POC poc; > - uint8_t roi_shift[4]; > - > - int bit_index; > - > - int curtileno; > - > - Jpeg2000Tile *tile; > - Jpeg2000DSPContext dsp; > - > - /*options parameters*/ > - int reduction_factor; > -} Jpeg2000DecoderContext; > +#include "jpeg2000dec.h" > > /* get_bits functions for JPEG2000 packet bitstream > * It is a get_bit function with a bit-stuffing routine. If the value of the > diff --git a/libavcodec/jpeg2000dec.h b/libavcodec/jpeg2000dec.h > new file mode 100644 > index 0000000000..b6410c1432 > --- /dev/null > +++ b/libavcodec/jpeg2000dec.h > @@ -0,0 +1,126 @@ > +/* > + * JPEG 2000 image decoder > + * Copyright (c) 2007 Kamil Nowosad > + * Copyright (c) 2013 Nicolas Bertrand > + * Copyright (c) 2022 Caleb Etemesi > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#ifndef AVCODEC_JPEG2000DEC_H > +#define AVCODEC_JPEG2000DEC_H > + > +#include "bytestream.h" > +#include "jpeg2000.h" > +#include "jpeg2000dsp.h" > + > +#define JP2_SIG_TYPE 0x6A502020 > +#define JP2_SIG_VALUE 0x0D0A870A > +#define JP2_CODESTREAM 0x6A703263 > +#define JP2_HEADER 0x6A703268 > + This stuff seems to be only used in jpeg2000dec.c, so it can stay there. Given that this is format-specific (and not specific to our decoder-implementation, a better place for this would be jpeg2000.h if it were moved out of jpeg2000dec.c). > +#define HAD_COC 0x01 > +#define HAD_QCC 0x02 > + These two should not be in this header, they are only used in jpeg2000dec.c and seems to be decoder-only and not format specific at all. > +#define MAX_POCS 32 If this is moved to a header, it should have a proper prefix in order to avoid future clashes. > + > +typedef struct Jpeg2000POCEntry { > + uint16_t LYEpoc; > + uint16_t CSpoc; > + uint16_t CEpoc; > + uint8_t RSpoc; > + uint8_t REpoc; > + uint8_t Ppoc; > +} Jpeg2000POCEntry; > + > +typedef struct Jpeg2000POC { > + Jpeg2000POCEntry poc[MAX_POCS]; > + int nb_poc; > + int is_default; > +} Jpeg2000POC; > + > +typedef struct Jpeg2000TilePart { > + uint8_t tile_index; // Tile index who refers the tile-part > + const uint8_t *tp_end; > + GetByteContext header_tpg; // bit stream of header if PPM header is used > + GetByteContext tpg; // bit stream in tile-part > +} Jpeg2000TilePart; > + > +/* RMK: For JPEG2000 DCINEMA 3 tile-parts in a tile > + * one per component, so tile_part elements have a size of 3 */ > +typedef struct Jpeg2000Tile { > + Jpeg2000Component *comp; > + uint8_t properties[4]; > + Jpeg2000CodingStyle codsty[4]; > + Jpeg2000QuantStyle qntsty[4]; > + Jpeg2000POC poc; > + Jpeg2000TilePart tile_part[32]; > + uint8_t has_ppt; // whether this tile has a ppt marker > + uint8_t *packed_headers; // contains packed headers. Used only along with PPT marker > + int packed_headers_size; // size in bytes of the packed headers > + GetByteContext packed_headers_stream; // byte context corresponding to packed headers > + uint16_t tp_idx; // Tile-part index > + int coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}} > +} Jpeg2000Tile; Seems like there is no reason to put Jpeg2000TilePart and Jpeg2000Tile into this header, as it is only used in jpeg2000dec.c (the usage below only uses a Jpeg2000Tile* and can therefore use an incomplete type). > + > +typedef struct Jpeg2000DecoderContext { > + AVClass *class; const AVClass* would be better. > + AVCodecContext *avctx; > + GetByteContext g; > + > + int width, height; > + int image_offset_x, image_offset_y; > + int tile_offset_x, tile_offset_y; > + uint8_t cbps[4]; // bits per sample in particular components > + uint8_t sgnd[4]; // if a component is signed > + uint8_t properties[4]; > + > + uint8_t has_ppm; > + uint8_t *packed_headers; // contains packed headers. Used only along with PPM marker > + int packed_headers_size; > + GetByteContext packed_headers_stream; > + uint8_t in_tile_headers; > + > + int cdx[4], cdy[4]; > + int precision; > + int ncomponents; > + int colour_space; > + uint32_t palette[256]; > + int8_t pal8; > + int cdef[4]; > + int tile_width, tile_height; > + unsigned numXtiles, numYtiles; > + int maxtilelen; > + AVRational sar; > + > + Jpeg2000CodingStyle codsty[4]; > + Jpeg2000QuantStyle qntsty[4]; > + Jpeg2000POC poc; > + uint8_t roi_shift[4]; > + > + int bit_index; > + > + int curtileno; > + > + Jpeg2000Tile *tile; > + Jpeg2000DSPContext dsp; > + > + /*options parameters*/ > + int reduction_factor; > +} Jpeg2000DecoderContext; > + > +#endif //AVCODEC_JPEG2000DEC_H _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".