From patchwork Sat Jan 23 20:47:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25134 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 65F3744B48E for ; Sat, 23 Jan 2021 22:48:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F20968A2B1; Sat, 23 Jan 2021 22:48:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 20575689AB3 for ; Sat, 23 Jan 2021 22:48:32 +0200 (EET) Received: by mail-wm1-f46.google.com with SMTP id s24so8470632wmj.0 for ; Sat, 23 Jan 2021 12:48:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=afgTDEkarC01dWs63ZUg8AVHIWBen7ESdc8JCjvj1Ug=; b=CnRvYfQUbchWORre6Cr5Z3fdvvMXn6c9JQ6xuRi4tm5HHT3jZGoGNoIqN1KEIo3UPc G3puorFaEnYC7WfH83zWTPJdC+gKjv64O8PH4EGoVy/0YVHU5qF+2WMTRx/sgXp/ji3Q zBZ5GO+1+a8yM9A8HvS94pBqzzuc2gYfM/2H9uWsmXGsOUSVrR5vDeEOyyghlKtjCEDI vqMN7+RnSIuo39MiRxjbd6Jl78aGyv1vEkrOSVzh5VCVOrvBhUPw3nkCaYw9RstCj8pl aPjL96HxrDo1K0I+WZ60LNFefy0pIBDb5reZShIti8edDOHSBUM9sywvojxgr9ZXKxyf dApQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=afgTDEkarC01dWs63ZUg8AVHIWBen7ESdc8JCjvj1Ug=; b=CId5uQfAV30oOZzzRnpEY3ta+WKSx+c3uS9/RXR5tm9Jb1ZvAvGZmbhQxoXWjIUQWg OAnAaFob+b+Y/V7BSNVSQzAwpSlJh1DxAg64fXwXMaxu6qLp78prXQISULXMjFjTqEXb mJl4bppXccIz9NsAhUi7yEOau2UbPRSxi98JqkWTL4GtSRSMDMBLoOYJAerI0cLvZr/T 9fDcrY/S4kJ0kAyUtj/+b1k5GJHnGzICb5rNDR+T/HBI9NU+R7coUdCKo/tQtUsWnTbk YxOKpDRm4aeef97IUr4S+Pc/P2NmCA/4sYGs4vj1GnorAbIZiZrd5GRygxLTkRxuGZra 8v3g== X-Gm-Message-State: AOAM531zC1VJs+G0xVNovpFkBslDwbZQ/4Z+zq9xjPRd4QxDN5sOGZhz oX0xgkOETusovFa/pLr6OPkYMJGyZlw= X-Google-Smtp-Source: ABdhPJz9ITB9zLRrGSGQSRje1OrwJImeDvnv+BBeiqJvgZP12jwzsBnRXWDEVSFekiIFGlZri+uRAg== X-Received: by 2002:a1c:7c03:: with SMTP id x3mr321320wmc.103.1611434911191; Sat, 23 Jan 2021 12:48:31 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g12sm16299529wmh.14.2021.01.23.12.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 12:48:30 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Jan 2021 21:47:57 +0100 Message-Id: <20210123204800.689497-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123204800.689497-1-andreas.rheinhardt@gmail.com> References: <20210123204800.689497-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/10] avcodec/sp5x: Remove unused quant tables X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Only the fifth one is used. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 4 +- libavcodec/sp5x.h | 92 +------------------------------------- libavcodec/sp5xdec.c | 5 +-- 3 files changed, 5 insertions(+), 96 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 7db042e5fe..a4b00c53f7 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3874,8 +3874,8 @@ static int encode_picture(MpegEncContext *s, int picture_number) for(i=1;i<64;i++){ int j= s->idsp.idct_permutation[ff_zigzag_direct[i]]; - s->intra_matrix[j] = sp5x_quant_table[5*2+0][i]; - s->chroma_intra_matrix[j] = sp5x_quant_table[5*2+1][i]; + s->intra_matrix[j] = sp5x_qscale_five_quant_table[0][i]; + s->chroma_intra_matrix[j] = sp5x_qscale_five_quant_table[1][i]; } s->y_dc_scale_table= y; s->c_dc_scale_table= c; diff --git a/libavcodec/sp5x.h b/libavcodec/sp5x.h index 21c45715d0..d84d851768 100644 --- a/libavcodec/sp5x.h +++ b/libavcodec/sp5x.h @@ -132,58 +132,8 @@ static const uint8_t sp5x_data_dht[] = { }; -static const uint8_t sp5x_quant_table[20][64]= +static const uint8_t sp5x_qscale_five_quant_table[][64]= { - /* index 0, Q50 */ - { 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40, - 26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 60, 57, 51, - 56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80,109, 81, 87, - 95, 98,103,104,103, 62, 77,113,121,112,100,120, 92,101,103, 99 }, - { 17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 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, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, - - /* index 1, Q70 */ - { 10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24, - 16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31, - 34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52, - 57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59 }, - { 10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 }, - - /* index 2, Q80 */ - { 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16, - 10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20, - 22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35, - 38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40 }, - { 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 }, - - /* index 3, Q85 */ - { 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12, - 8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, 15, - 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26, - 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30 }, - { 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }, - - /* index 4, Q90 */ - { 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 4, 3, 3, 4, 5, 8, - 5, 5, 4, 4, 5, 10, 7, 7, 6, 8, 12, 10, 12, 12, 11, 10, - 11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17, - 19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20 }, - { 3, 4, 4, 5, 4, 5, 9, 5, 5, 9, 20, 13, 11, 13, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }, - /* index 5, Q60 */ { 13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32, 21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41, @@ -193,46 +143,6 @@ static const uint8_t sp5x_quant_table[20][64]= 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 }, - - /* index 6, Q25 */ - { 32, 22, 24, 28, 24, 20, 32, 28, 26, 28, 36, 34, 32, 38, 48, 80, - 52, 48, 44, 44, 48, 98, 70, 74, 58, 80,116,102,122,120,114,102, - 112,110,128,144,184,156,128,136,174,138,110,112,160,218,162,174, - 190,196,206,208,206,124,154,226,242,224,200,240,184,202,206,198 }, - { 34, 36, 36, 48, 42, 48, 94, 52, 52, 94,198,132,112,132,198,198, - 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, - 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, - 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 }, - - /* index 7, Q95 */ - { 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 4, - 3, 2, 2, 2, 2, 5, 4, 4, 3, 4, 6, 5, 6, 6, 6, 5, - 6, 6, 6, 7, 9, 8, 6, 7, 9, 7, 6, 6, 8, 11, 8, 9, - 10, 10, 10, 10, 10, 6, 8, 11, 12, 11, 10, 12, 9, 10, 10, 10 }, - { 2, 2, 2, 2, 2, 2, 5, 3, 3, 5, 10, 7, 6, 7, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, - - /* index 8, Q93 */ - { 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 3, 3, 6, - 4, 3, 3, 3, 3, 7, 5, 5, 4, 6, 8, 7, 9, 8, 8, 7, - 8, 8, 9, 10, 13, 11, 9, 10, 12, 10, 8, 8, 11, 15, 11, 12, - 13, 14, 14, 15, 14, 9, 11, 16, 17, 16, 14, 17, 13, 14, 14, 14 }, - { 2, 3, 3, 3, 3, 3, 7, 4, 4, 7, 14, 9, 8, 9, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, - - /* index 9, Q40 */ - { 20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50, - 33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64, - 70, 69, 80, 90,115, 98, 80, 85,109, 86, 69, 70,100,136,101,109, - 119,123,129,130,129, 78, 96,141,151,140,125,150,115,126,129,124 }, - { 21, 23, 23, 30, 26, 30, 59, 33, 33, 59,124, 83, 70, 83,124,124, - 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, - 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, - 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 } }; #endif /* AVCODEC_SP5X_H */ diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c index 302fdb073e..0b2b2d8418 100644 --- a/libavcodec/sp5xdec.c +++ b/libavcodec/sp5xdec.c @@ -35,7 +35,6 @@ int ff_sp5x_process_packet(AVCodecContext *avctx, AVPacket *avpkt) const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVBufferRef *buf_recoded; - const int qscale = 5; uint8_t *recoded; int i = 0, j = 0; @@ -52,8 +51,8 @@ int ff_sp5x_process_packet(AVCodecContext *avctx, AVPacket *avpkt) recoded[j++] = 0xD8; memcpy(recoded+j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt)); - memcpy(recoded+j+5, &sp5x_quant_table[qscale * 2], 64); - memcpy(recoded+j+70, &sp5x_quant_table[(qscale * 2) + 1], 64); + memcpy(recoded + j + 5, &sp5x_qscale_five_quant_table[0], 64); + memcpy(recoded + j + 70, &sp5x_qscale_five_quant_table[1], 64); j += sizeof(sp5x_data_dqt); memcpy(recoded+j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));