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 AE77241A22 for ; Mon, 17 Oct 2022 14:52:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3C7368BD2E; Mon, 17 Oct 2022 17:52:46 +0300 (EEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074011.outbound.protection.outlook.com [40.92.74.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 036A368BCF7 for ; Mon, 17 Oct 2022 17:52:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EcyTF/mtjamYGRPb/4Vgre4wsRYFQ86SMCQ1nDZ2sBf48CGEZnHzaVLc3v/aZRX20QYwpk4p3VevXeD4X4YHxbNcml3zLoK5yyGKtnWIL3qMiM8sopcYuTpUmfSyIOXGPxhab2gRjcCdYW4MrgYfnNDAf76kmfPOH/hvLmdNfHn6abgBgwCQze4jh5g+zzFlZt7nc36t05oSBjld5fIBENBJ716ZKAYL6Ys0iKFbpL1XLOTLZ/BkYqAJij3puM2p/1KosjJlqKJy4YDlmFcRjpMBVDv6MP+ZLkIz3QXYNaIYYUOEks/ajy5EF1j58xtcGe0vTf1BYsH3q2cXayvmCQ== 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=J7FUvrcJ8ouy5i5SpUeoZVPBJW0zD2npV+ipEV1bv80=; b=UWOngAm+pGFZH/eCOj+Z24KuxsKStwTidOZCdTX2xo6d5pryn/BWsU6ZXlF1kr0AUoBOJ+4299pVB0XuOPqk+niwIl2bjMyZQdu7xrr9A471YTo63Y1IhoBaoNo1P+5ikPpcQ0NdJFgckmAyy+OPFfrPt5oRUo2hAWF8w7wI4LazouEDzGYd5l/O/tLbmrPC1iJ/xcJrHb0lceBjAu41I/Bxl8QxYYOj8xmu0U2zqZf9uvvT0IAL7Ydm4f9JXIi4s3Id4xHiHqIJR2WWB0y44xSJCyPZD0l9GrSHKfjSFEEDPGC0/jBmvoptVmp+QJ9K4OJX5h5yxNtqaBcLU5JLtQ== 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=J7FUvrcJ8ouy5i5SpUeoZVPBJW0zD2npV+ipEV1bv80=; b=i3p/Ow5zT9RF5kbwV7kEIzw6z7o87fGr2gapNjSd+LMpF547wx2jyvdGNeBrgNzp9ubFtyZgX17bZV1b588E+St+xHHQWzHJV6OepVYc8oe7DfHODVKPeTgBDIyKUugVEixRHoaPvMMvgXvBNjJ3cyj/AuimCVsmxEz/varSn/U9VUr1beDhvC5hqaFGehcp7JdX8GyZUzEUK62Z2zzDlyNaY454qNc067uR6d8FIO4wmD5NTibwAEEwbI+BQ8d9ZRdIPQLk8/RZ+Kfhr4EI/DM8UdjtfJz5FCPmsDVz9GjXc9infTpHTmEEo7wGhmd/4La1D1RaTAdYAKjhYJZWaA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU0P250MB0841.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3e4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Mon, 17 Oct 2022 14:52:38 +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; Mon, 17 Oct 2022 14:52:37 +0000 Message-ID: Date: Mon, 17 Oct 2022 16:52:47 +0200 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <7ac509f6550637ef793935a30dbaab3db904a0ce.1665794986.git.pross@xvid.org> From: Andreas Rheinhardt In-Reply-To: <7ac509f6550637ef793935a30dbaab3db904a0ce.1665794986.git.pross@xvid.org> X-TMN: [5U7zmMxKrZXDYRgZTPekT8a//t6x9p9u9qHj4YIWAB0=] X-ClientProxiedBy: AM6P195CA0049.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::26) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <98271960-0e07-b54e-231f-2165cf30237b@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU0P250MB0841:EE_ X-MS-Office365-Filtering-Correlation-Id: 944d2af5-9973-456a-87b4-08dab04f3bbd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8U9ZiAL5GRdA6DxMF9lcGoPvPoJQU1V7rckZizE7SFobyOw1TRA/PWCXrN6t+rVSQGenn3zzdyLd5ewjklcAx++GjuzpArqxIRC8+52sCmADVhP1mjXZ9YXZwZB2Bzv/z4Qegv78ciSiEd+riQWImTYO24fmFd9rbdwZf5D5wKxZLbE19Q1bIxEssbmdMaE1udX0DaKpHEI6XgST+BDVZVSjv1pt28C6XbePI2G8rrGKuBar/ts1TMCz3KRcLm0Pp7npXRVaHtsec+UW2kDkXXDf3arSXdIcpsBjjU1mn/cjkMLCU7nBSWzvy0L0Q4+UIp4dQ1LUzWlWi+1/6vra4nNMpQlsbxhmBIrNDU5ZAQBVEw4zukMnYzbxd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3NpMDJib0VUNDNoUEhITkVLYjZYa0lVZ2Y0N2ZwQW9HYmV3YTlnVzFk?= =?utf-8?B?NjVGc3dXTVp2ZXp6bkNEcWljOFdBU0xvMkxmUjRSRm90Y3ZQNUowSEtTUDlI?= =?utf-8?B?OVRJM2lVeGloV210QStuQzEycnFoOGJQMm9kaVY3dFRKTEh2SUE5T3hxbkJY?= =?utf-8?B?RE1uT0hZL1QzeU5ieW1TVUtVUjFtVkNLU2pwY1gvKytFL2VrQmo0Q2s5dHpi?= =?utf-8?B?NVFML25yUmRvTnN4R2RVeXlOek43Ym95Q24xYStLTmsyN0ZFZUZ6elJkQlBM?= =?utf-8?Q?OxUW0+OxlyC3TkRmmQzTqyIp/QLcw7sohq8/3tA?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 944d2af5-9973-456a-87b4-08dab04f3bbd X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 14:52:37.9246 (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: DU0P250MB0841 Subject: Re: [FFmpeg-devel] [PATCHv2] avcodec/jpegtables: remove duplicate luma and chroma quantization tables 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: Peter Ross: > Duplicates of the standard JPEG quantization tables were found in the > AGM, MSS34(dsp), NUV and VP31 codecs. This patch elimates those duplicates, > placing a single copy in jpegquanttables.c. > --- > libavcodec/Makefile | 8 ++--- > libavcodec/agm.c | 27 ++++------------- > libavcodec/jpegquanttables.c | 58 ++++++++++++++++++++++++++++++++++++ > libavcodec/jpegquanttables.h | 29 ++++++++++++++++++ > libavcodec/jpegtables.c | 27 ----------------- > libavcodec/mss34dsp.c | 25 ++-------------- > libavcodec/nuv.c | 27 ++--------------- > libavcodec/vp3.c | 3 +- > libavcodec/vp3data.h | 13 -------- > 9 files changed, 103 insertions(+), 114 deletions(-) > create mode 100644 libavcodec/jpegquanttables.c > create mode 100644 libavcodec/jpegquanttables.h > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 37b63cadc2..f53a8b6209 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -142,7 +142,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \ > mpegvideoencdsp.o > OBJS-$(CONFIG_MSMPEG4DEC) += msmpeg4dec.o msmpeg4.o msmpeg4data.o > OBJS-$(CONFIG_MSMPEG4ENC) += msmpeg4enc.o msmpeg4.o msmpeg4data.o > -OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o > +OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o jpegquanttables.o > OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o > OBJS-$(CONFIG_QPELDSP) += qpeldsp.o > OBJS-$(CONFIG_QSV) += qsv.o > @@ -196,7 +196,7 @@ OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \ > OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o > OBJS-$(CONFIG_AC3_MF_ENCODER) += mfenc.o mf_utils.o > OBJS-$(CONFIG_ACELP_KELVIN_DECODER) += g729dec.o lsp.o celp_math.o celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o > -OBJS-$(CONFIG_AGM_DECODER) += agm.o > +OBJS-$(CONFIG_AGM_DECODER) += agm.o jpegquanttables.o > OBJS-$(CONFIG_AIC_DECODER) += aic.o > OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o > OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o > @@ -552,7 +552,7 @@ OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o > OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o > OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o > OBJS-$(CONFIG_NOTCHLC_DECODER) += notchlc.o > -OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o > +OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o jpegquanttables.o > OBJS-$(CONFIG_ON2AVC_DECODER) += on2avc.o on2avcdata.o > OBJS-$(CONFIG_OPUS_DECODER) += opusdec.o opusdec_celt.o opus_celt.o \ > opus_pvq.o opus_silk.o opustab.o vorbis_data.o \ > @@ -737,7 +737,7 @@ OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbisdsp.o vorbis.o \ > vorbis_data.o > OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \ > vorbis_data.o > -OBJS-$(CONFIG_VP3_DECODER) += vp3.o > +OBJS-$(CONFIG_VP3_DECODER) += vp3.o jpegquanttables.o > OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vpx_rac.o > OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \ > vp6dsp.o vpx_rac.o > diff --git a/libavcodec/agm.c b/libavcodec/agm.c > index 017aa0e1fa..760760a403 100644 > --- a/libavcodec/agm.c > +++ b/libavcodec/agm.c > @@ -33,24 +33,7 @@ > #include "decode.h" > #include "get_bits.h" > #include "idctdsp.h" > - > -static const uint8_t unscaled_luma[64] = { > - 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, > - 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, > - 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, > - 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92, > - 49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98, > - 112,100,103,99 > -}; > - > -static const uint8_t unscaled_chroma[64] = { > - 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, > - 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, > - 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99 > -}; > +#include "jpegquanttables.h" > > typedef struct MotionVector { > int16_t x, y; > @@ -550,13 +533,13 @@ static void compute_quant_matrix(AGMContext *s, double qscale) > } else { > if (qscale >= 0.0) { > for (int i = 0; i < 64; i++) { > - luma[i] = FFMAX(1, unscaled_luma [(i & 7) * 8 + (i >> 3)] * f); > - chroma[i] = FFMAX(1, unscaled_chroma[(i & 7) * 8 + (i >> 3)] * f); > + luma[i] = FFMAX(1, ff_mjpeg_std_luminance_quant_tbl [(i & 7) * 8 + (i >> 3)] * f); > + chroma[i] = FFMAX(1, ff_mjpeg_std_chrominance_quant_tbl[(i & 7) * 8 + (i >> 3)] * f); > } > } else { > for (int i = 0; i < 64; i++) { > - luma[i] = FFMAX(1, 255.0 - (255 - unscaled_luma [(i & 7) * 8 + (i >> 3)]) * f); > - chroma[i] = FFMAX(1, 255.0 - (255 - unscaled_chroma[(i & 7) * 8 + (i >> 3)]) * f); > + luma[i] = FFMAX(1, 255.0 - (255 - ff_mjpeg_std_luminance_quant_tbl [(i & 7) * 8 + (i >> 3)]) * f); > + chroma[i] = FFMAX(1, 255.0 - (255 - ff_mjpeg_std_chrominance_quant_tbl[(i & 7) * 8 + (i >> 3)]) * f); > } > } > } > diff --git a/libavcodec/jpegquanttables.c b/libavcodec/jpegquanttables.c > new file mode 100644 > index 0000000000..e0221fdb0e > --- /dev/null > +++ b/libavcodec/jpegquanttables.c > @@ -0,0 +1,58 @@ > +/* > + * MJPEG encoder and decoder > + * Copyright (c) 2000, 2001 Fabrice Bellard > + * Copyright (c) 2003 Alex Beregszaszi > + * Copyright (c) 2003-2004 Michael Niedermayer > + * > + * Support for external huffman table, various fixes (AVID workaround), > + * aspecting, new decode_frame mechanism and apple mjpeg-b support > + * by Alex Beregszaszi You seem to have just copied this from jpegtables.c where it is already inappropriate; it is so here, too. > + * > + * 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 > + */ > + > +/** > + * @file > + * MJPEG quantization tables > + */ > + > +#include "jpegquanttables.h" > + > +/* These are the sample quantization tables given in JPEG spec section K.1. > + * The spec says that the values given produce "good" quality, and > + * when divided by 2, "very good" quality. > + */ > +const uint8_t ff_mjpeg_std_luminance_quant_tbl[64] = { > + 16, 11, 10, 16, 24, 40, 51, 61, > + 12, 12, 14, 19, 26, 58, 60, 55, > + 14, 13, 16, 24, 40, 57, 69, 56, > + 14, 17, 22, 29, 51, 87, 80, 62, > + 18, 22, 37, 56, 68, 109, 103, 77, > + 24, 35, 55, 64, 81, 104, 113, 92, > + 49, 64, 78, 87, 103, 121, 120, 101, > + 72, 92, 95, 98, 112, 100, 103, 99 > +}; > +const uint8_t ff_mjpeg_std_chrominance_quant_tbl[64] = { > + 17, 18, 24, 47, 99, 99, 99, 99, > + 18, 21, 26, 66, 99, 99, 99, 99, > + 24, 26, 56, 99, 99, 99, 99, 99, > + 47, 66, 99, 99, 99, 99, 99, 99, > + 99, 99, 99, 99, 99, 99, 99, 99, > + 99, 99, 99, 99, 99, 99, 99, 99, > + 99, 99, 99, 99, 99, 99, 99, 99, > + 99, 99, 99, 99, 99, 99, 99, 99 > +}; > diff --git a/libavcodec/jpegquanttables.h b/libavcodec/jpegquanttables.h > new file mode 100644 > index 0000000000..70f1cbf96e > --- /dev/null > +++ b/libavcodec/jpegquanttables.h > @@ -0,0 +1,29 @@ > +/* > + * MJPEG quantization tables > + * > + * 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_JPEGQUANTTABLES_H > +#define AVCODEC_JPEGQUANTTABLES_H > + > +#include > + > +extern const uint8_t ff_mjpeg_std_luminance_quant_tbl[64]; > +extern const uint8_t ff_mjpeg_std_chrominance_quant_tbl[64]; > + Can you mark these tables as hidden (this is necessary for certain arches not to produce suboptimal code because the compilers have to presume that they need to use a GOT indirection)? Or maybe we should just put these declarations into jpegtables.h where I will add the attribute in a soon-to-be-applied patch? > +#endif /* AVCODEC_JPEGQUANTTABLES_H */ > diff --git a/libavcodec/jpegtables.c b/libavcodec/jpegtables.c > index e453fcf90d..9a15975a95 100644 > --- a/libavcodec/jpegtables.c > +++ b/libavcodec/jpegtables.c > @@ -31,30 +31,3 @@ > */ > > #include "jpegtabs.h" > - > -#if 0 > -/* These are the sample quantization tables given in JPEG spec section K.1. > - * The spec says that the values given produce "good" quality, and > - * when divided by 2, "very good" quality. > - */ > -static const unsigned char std_luminance_quant_tbl[64] = { > - 16, 11, 10, 16, 24, 40, 51, 61, > - 12, 12, 14, 19, 26, 58, 60, 55, > - 14, 13, 16, 24, 40, 57, 69, 56, > - 14, 17, 22, 29, 51, 87, 80, 62, > - 18, 22, 37, 56, 68, 109, 103, 77, > - 24, 35, 55, 64, 81, 104, 113, 92, > - 49, 64, 78, 87, 103, 121, 120, 101, > - 72, 92, 95, 98, 112, 100, 103, 99 > -}; > -static const unsigned char std_chrominance_quant_tbl[64] = { > - 17, 18, 24, 47, 99, 99, 99, 99, > - 18, 21, 26, 66, 99, 99, 99, 99, > - 24, 26, 56, 99, 99, 99, 99, 99, > - 47, 66, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99 > -}; > -#endif > diff --git a/libavcodec/mss34dsp.c b/libavcodec/mss34dsp.c > index f3405658f7..3f08c03ed7 100644 > --- a/libavcodec/mss34dsp.c > +++ b/libavcodec/mss34dsp.c > @@ -22,33 +22,12 @@ > #include > #include "libavutil/common.h" > #include "mss34dsp.h" > - > -static const uint8_t luma_quant[64] = { > - 16, 11, 10, 16, 24, 40, 51, 61, > - 12, 12, 14, 19, 26, 58, 60, 55, > - 14, 13, 16, 24, 40, 57, 69, 56, > - 14, 17, 22, 29, 51, 87, 80, 62, > - 18, 22, 37, 56, 68, 109, 103, 77, > - 24, 35, 55, 64, 81, 104, 113, 92, > - 49, 64, 78, 87, 103, 121, 120, 101, > - 72, 92, 95, 98, 112, 100, 103, 99 > -}; > - > -static const uint8_t chroma_quant[64] = { > - 17, 18, 24, 47, 99, 99, 99, 99, > - 18, 21, 26, 66, 99, 99, 99, 99, > - 24, 26, 56, 99, 99, 99, 99, 99, > - 47, 66, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99 > -}; > +#include "jpegquanttables.h" > > void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma) > { > int i; > - const uint8_t *qsrc = luma ? luma_quant : chroma_quant; > + const uint8_t *qsrc = luma ? ff_mjpeg_std_luminance_quant_tbl : ff_mjpeg_std_chrominance_quant_tbl; > > if (quality >= 50) { > int scale = 200 - 2 * quality; > diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c > index ccd47586b5..1d4f02217c 100644 > --- a/libavcodec/nuv.c > +++ b/libavcodec/nuv.c > @@ -29,6 +29,7 @@ > #include "avcodec.h" > #include "codec_internal.h" > #include "decode.h" > +#include "jpegquanttables.h" > #include "rtjpeg.h" > > typedef struct NuvContext { > @@ -42,28 +43,6 @@ typedef struct NuvContext { > RTJpegContext rtj; > } NuvContext; > > -static const uint8_t fallback_lquant[] = { > - 16, 11, 10, 16, 24, 40, 51, 61, > - 12, 12, 14, 19, 26, 58, 60, 55, > - 14, 13, 16, 24, 40, 57, 69, 56, > - 14, 17, 22, 29, 51, 87, 80, 62, > - 18, 22, 37, 56, 68, 109, 103, 77, > - 24, 35, 55, 64, 81, 104, 113, 92, > - 49, 64, 78, 87, 103, 121, 120, 101, > - 72, 92, 95, 98, 112, 100, 103, 99 > -}; > - > -static const uint8_t fallback_cquant[] = { > - 17, 18, 24, 47, 99, 99, 99, 99, > - 18, 21, 26, 66, 99, 99, 99, 99, > - 24, 26, 56, 99, 99, 99, 99, 99, > - 47, 66, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99 > -}; > - > /** > * @brief copy frame data from buffer to AVFrame, handling stride. > * @param f destination AVFrame > @@ -107,8 +86,8 @@ static void get_quant_quality(NuvContext *c, int quality) > int i; > quality = FFMAX(quality, 1); > for (i = 0; i < 64; i++) { > - c->lq[i] = (fallback_lquant[i] << 7) / quality; > - c->cq[i] = (fallback_cquant[i] << 7) / quality; > + c->lq[i] = (ff_mjpeg_std_luminance_quant_tbl[i] << 7) / quality; > + c->cq[i] = (ff_mjpeg_std_chrominance_quant_tbl[i] << 7) / quality; > } > } > > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c > index 31775455a4..b731bc0669 100644 > --- a/libavcodec/vp3.c > +++ b/libavcodec/vp3.c > @@ -43,6 +43,7 @@ > #include "decode.h" > #include "get_bits.h" > #include "hpeldsp.h" > +#include "jpegquanttables.h" > #include "mathops.h" > #include "thread.h" > #include "threadframe.h" > @@ -2418,7 +2419,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) > s->coded_dc_scale_factor[1][i] = s->version < 2 ? vp31_dc_scale_factor[i] : vp4_uv_dc_scale_factor[i]; > s->coded_ac_scale_factor[i] = s->version < 2 ? vp31_ac_scale_factor[i] : vp4_ac_scale_factor[i]; > s->base_matrix[0][i] = s->version < 2 ? vp31_intra_y_dequant[i] : vp4_generic_dequant[i]; > - s->base_matrix[1][i] = s->version < 2 ? vp31_intra_c_dequant[i] : vp4_generic_dequant[i]; > + s->base_matrix[1][i] = s->version < 2 ? ff_mjpeg_std_chrominance_quant_tbl[i] : vp4_generic_dequant[i]; > s->base_matrix[2][i] = s->version < 2 ? vp31_inter_dequant[i] : vp4_generic_dequant[i]; > s->filter_limit_values[i] = s->version < 2 ? vp31_filter_limit_values[i] : vp4_filter_limit_values[i]; > } > diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h > index 272af4e3a0..317797a697 100644 > --- a/libavcodec/vp3data.h > +++ b/libavcodec/vp3data.h > @@ -37,19 +37,6 @@ static const uint8_t vp31_intra_y_dequant[64] = { > 72, 92, 95, 98, 112, 100, 103, 99 > }; > > -/* these coefficients dequantize intraframe C plane coefficients > - * (note: same as JPEG) */ > -static const uint8_t vp31_intra_c_dequant[64] = { > - 17, 18, 24, 47, 99, 99, 99, 99, > - 18, 21, 26, 66, 99, 99, 99, 99, > - 24, 26, 56, 99, 99, 99, 99, 99, > - 47, 66, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99, > - 99, 99, 99, 99, 99, 99, 99, 99 > -}; > - > /* these coefficients dequantize interframe coefficients (all planes) */ > static const uint8_t vp31_inter_dequant[64] = { > 16, 16, 16, 20, 24, 28, 32, 40, > > > _______________________________________________ > 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". _______________________________________________ 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".