From patchwork Tue Oct 13 09:10:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22908 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 0806B44AFB2 for ; Tue, 13 Oct 2020 12:10:33 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DBB6868B82F; Tue, 13 Oct 2020 12:10:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C4B0C68AF32 for ; Tue, 13 Oct 2020 12:10:26 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id h7so23094857wre.4 for ; Tue, 13 Oct 2020 02:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nk+70u5yJDFejNNUr2VqQfoi05U9CvVtDbHXOtejT7c=; b=E+yAhr0wsdmTtAKLY+/NEFzaKsk4SuCzEtdz7vLPQMpGzT7j9JbfhdpwHIh75H3iHq 4VdujI7BAJiKuq8eJTd8J8bcSBqqeP5fu5c1pwnawXNFC7tAPxBIohYOdSvbqBlTgDs9 040GJ1lxw90m4aUTCUWKKGe/0P/Xjs7pbq4lI1OaPza/SEOXpk+J7g4Dn6+q8GsPfBY+ fMIt2rz4NX1H+xk96rJrOL21wl7n7unRiXlP89VTabAPbBLyPkR5Uh8CQxcEaIGpiWMf Uump5SaaaMhTyJmlq4ovdxq7gMF5Acce+0MdSJE9uTV5b5PooOkulnJxu4K3Vbkq1JOO NcNg== 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:mime-version :content-transfer-encoding; bh=nk+70u5yJDFejNNUr2VqQfoi05U9CvVtDbHXOtejT7c=; b=JgMzlNwxz7hIJ3JEIn6FzH5pmoX6komSlt9W2yYz5SQwJbWfOka1vSyfQSAyREJm3+ o2w01mUkXD4z/d6uNknmwgnVQYMBwvIVSf2dJia9v0WAxNETHMYlyqyi++2lbjAUxDeW f8Tf97OE8HQqNrP3jduc5epbkE/wYztkCopkhlZh+NFdjmLkZNDLw9kZPwdDC0TdAsuY /1GsIbW1zGyz3qH7E5FqP/qGl2eNAE5na2qlsdCsCM7YPzW1SkWhXkQXzkYKDXXSRarP ivCudw9oDYcHD5hWAgASaZZQAYTPb/akrpq8YxZn/AQikB5fw7M6jQ/almEF9X6+CfQX 37Nw== X-Gm-Message-State: AOAM533YWoCy758fnzGJSUVcGyDDSPspmn7DCXAFUDPjRrz4ceMN8EZ/ FZ0qiOew1hjgsZ+/lL/BRGUDMOzOzyI= X-Google-Smtp-Source: ABdhPJz5XEh6GUwPx7VRXAv4WLg9myweurQonaeFGLZM2yxgfcH+nNZNs55Vm+qNGhO9B5UN6VAFug== X-Received: by 2002:adf:94c6:: with SMTP id 64mr12850534wrr.8.1602580225735; Tue, 13 Oct 2020 02:10:25 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:24 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:09 +0200 Message-Id: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/9] avcodec/asvdec: Reduce the size of some VLCs 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/asvdec.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 9a11446f52..a21e4277b3 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -34,7 +34,10 @@ #include "mathops.h" #include "mpeg12data.h" -#define VLC_BITS 6 +#define CCP_VLC_BITS 5 +#define DC_CCP_VLC_BITS 4 +#define AC_CCP_VLC_BITS 6 +#define ASV1_LEVEL_VLC_BITS 4 #define ASV2_LEVEL_VLC_BITS 10 static VLC ccp_vlc; @@ -50,18 +53,18 @@ static av_cold void init_vlcs(ASV1Context *a) if (!done) { done = 1; - INIT_VLC_STATIC(&ccp_vlc, VLC_BITS, 17, + INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, &ff_asv_ccp_tab[0][1], 2, 1, - &ff_asv_ccp_tab[0][0], 2, 1, 64); - INIT_VLC_STATIC(&dc_ccp_vlc, VLC_BITS, 8, + &ff_asv_ccp_tab[0][0], 2, 1, 32); + INIT_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, &ff_asv_dc_ccp_tab[0][1], 2, 1, - &ff_asv_dc_ccp_tab[0][0], 2, 1, 64); - INIT_VLC_STATIC(&ac_ccp_vlc, VLC_BITS, 16, + &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); + INIT_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, &ff_asv_ac_ccp_tab[0][1], 2, 1, &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); - INIT_VLC_STATIC(&level_vlc, VLC_BITS, 7, + INIT_VLC_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, &ff_asv_level_tab[0][1], 2, 1, - &ff_asv_level_tab[0][0], 2, 1, 64); + &ff_asv_level_tab[0][0], 2, 1, 16); INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, &ff_asv2_level_tab[0][1], 2, 1, &ff_asv2_level_tab[0][0], 2, 1, 1024); @@ -76,7 +79,7 @@ static inline int asv2_get_bits(GetBitContext *gb, int n) static inline int asv1_get_level(GetBitContext *gb) { - int code = get_vlc2(gb, level_vlc.table, VLC_BITS, 1); + int code = get_vlc2(gb, level_vlc.table, ASV1_LEVEL_VLC_BITS, 1); if (code == 3) return get_sbits(gb, 8); @@ -101,7 +104,7 @@ static inline int asv1_decode_block(ASV1Context *a, int16_t block[64]) block[0] = 8 * get_bits(&a->gb, 8); for (i = 0; i < 11; i++) { - const int ccp = get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1); + const int ccp = get_vlc2(&a->gb, ccp_vlc.table, CCP_VLC_BITS, 1); if (ccp) { if (ccp == 16) @@ -133,7 +136,7 @@ static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) block[0] = 8 * asv2_get_bits(&a->gb, 8); - ccp = get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1); + ccp = get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS, 1); if (ccp) { if (ccp & 4) block[a->scantable.permutated[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4; @@ -144,7 +147,7 @@ static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) } for (i = 1; i < count + 1; i++) { - const int ccp = get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1); + const int ccp = get_vlc2(&a->gb, ac_ccp_vlc.table, AC_CCP_VLC_BITS, 1); if (ccp) { if (ccp & 8) From patchwork Tue Oct 13 09:10:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22909 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 30B5B44AFB2 for ; Tue, 13 Oct 2020 12:10:56 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1268668BB09; Tue, 13 Oct 2020 12:10:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AF6668BB06 for ; Tue, 13 Oct 2020 12:10:50 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id i1so16946683wro.1 for ; Tue, 13 Oct 2020 02:10:50 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=ke+/dk1swxIOVZK04HSNL/pDpO+sF7kYfUjMaXLzNmo=; b=gdOb0P4+gXnpsGk/BPLkx+2u+Vy53Mqe1/q7q/Q14LH1d6v9UPJWAi1xCupdaeOwRe hEcp1crHgUh0+jS4SHS+wJwzLfZdQpZIuAvPgJoAE5gdcxWh1pIE1RywMGAFtztLLXxd 5IutIgfoTItHdPBDt505KSN9fxNIG8bPn95O+mOjKr3mFitwRkfIF0vU+yXuc56amU/C vk2BYF7Rt3GwzGTL0vWnYdOAa6uFA+bkNVEBBAdK8LKFF+lIIrJlfkc8mBzn3Ys0MLeQ +wilTvoAA6eCxJ4JNYAUBGaRg+uYHQgwYYMdCFoiArn5bSaZef8zWSDud//OWUn8IlzH we7Q== 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:mime-version:content-transfer-encoding; bh=ke+/dk1swxIOVZK04HSNL/pDpO+sF7kYfUjMaXLzNmo=; b=F02GOkUY2uTm5uudoU4+Mc97nWKVxhEfeYSR/TWthW02RAJNNPIHj1cNeSWX45k0rw xoM/epoFpYarC90vPo+SCmsiJ0NGp/KlN/DOMsBnqT1JaiBgSbjBevWhZClB9NSgytMt bPzvz3Nf9Pw2cAv6UJnzKIaEtP8FjTSyIQdJXgZ1wADzNZDog+kyXX5b9LuCW4X9ArfH mJDY2N1N+nJIMeRZtuXVdBU2/H+pik63OEoBH2jiGo+SRmpH0djsCuBE+A7HLuj1nFS7 PVZSz4Hc+qkqiRWWezpQ6IfYPdFzJJSUHoM+FvbTHMHbMiVxsWgbKi2lgeTRdfxT88S2 yHUQ== X-Gm-Message-State: AOAM533BlcppiSb59sI9T4SkTWHA8DRZitdB2q+7Jr4d5Sqh0aUYv96g a9LSlkXm1/b0wn7sRJ35ZF7R9wNGxyM= X-Google-Smtp-Source: ABdhPJzJL9CQ/IWFfn2t2dq5BXWwpssuVyCqInBh+oNcflp1pNSPD5ihaVcsvHYA5ZM5BLaz0wvvxw== X-Received: by 2002:a5d:6ac6:: with SMTP id u6mr34030945wrw.65.1602580249136; Tue, 13 Oct 2020 02:10:49 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:48 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:10 +0200 Message-Id: <20201013091017.1899676-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/asvdec: Use init_get_bits8() 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/asvdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index a21e4277b3..6198188fc5 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -235,7 +235,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, a->bitstream_buffer[i] = ff_reverse[buf[i]]; } - init_get_bits(&a->gb, a->bitstream_buffer, buf_size * 8); + ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size); + if (ret < 0) + return ret; for (mb_y = 0; mb_y < a->mb_height2; mb_y++) { for (mb_x = 0; mb_x < a->mb_width2; mb_x++) { From patchwork Tue Oct 13 09:10:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22910 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 5A90544AFB2 for ; Tue, 13 Oct 2020 12:10:58 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3FAD368BB4A; Tue, 13 Oct 2020 12:10:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D112B68BB27 for ; Tue, 13 Oct 2020 12:10:51 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id e2so20974629wme.1 for ; Tue, 13 Oct 2020 02:10:51 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=0jYOgF5JD8UGj3SsJTfBsk+yzynAknjfDfRI5iE7aPg=; b=lZA2HnzkevhWTMHtcl2LJTWiepJcLFgQ7cL5nmZbxFJUeua109XlG2vWPlwlb1X2am HV4y7wn3cFI2oqJL+Lr3e9LN4Frd2DK4hTXZQwdoEqTbL5qqE0t61XgER9FsU4Dpt53y NGL5E6BG5LiKTqhQ2ybmMvLr0YSkTv3SBq+GvM9RvcyLNVpzS1WDj+Rf+X79+gBuA2L2 1wgjkrIdDSytvRBiI0nsuS8IPcd4uHyxFd7od0k4szC0mZhglSkdwMrmsO5H8lZcSyRl HfoB8fPRpJCf/UZGizBVRjRDcEqokEUosMnIFUxYf13YfcNqUes7q6A4jFVSGn8CgW9j ZJPw== 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:mime-version:content-transfer-encoding; bh=0jYOgF5JD8UGj3SsJTfBsk+yzynAknjfDfRI5iE7aPg=; b=psQONJx5/nTX05XLMzGpDyAPJlSmsRJ5hwNqfhaQ4wLdg/8qI2pT1uetmL2u+IZ2uc LEgX7DL09fJcBQUCuyuWDubHZ9tehLk6YYFOjMP/g4s6QR2ENmyUkftwOKaLqDoGoDYd dhni5rDAaXp8cxu3/Q+aLFsdMfNKMApYwir+L1CQqZXxafm2MVE450scxHY5DMwZYYwY echgXzfkWLpFjLpFIRm86iXtW0BZRA2pD7GRxlBjLXtZ6uoyQkjwhyUA+h9vsCTYUJWt 5MZB4FmOC7WRYVcTJlaGerVhZxAnmiTWzBMELHvODhAXTCTBqVlEFA5vrqLr9FVEixOo dSzw== X-Gm-Message-State: AOAM530yJiq8gRlvLbmTz4Czm/uO3flC0Wq/GnqDdlJGSqN7mOlJLvDg JTblwNKRBdhAdKsP3BvhdxoiPE0jde0= X-Google-Smtp-Source: ABdhPJwqD4BpYk/mzhm8oeT/rC+6pGixir9ljcLIoLZjE9bPmYk6bZi4vQMTH9CYtpAjUPaAe6K07Q== X-Received: by 2002:a1c:5602:: with SMTP id k2mr14807894wmb.25.1602580250756; Tue, 13 Oct 2020 02:10:50 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:49 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:11 +0200 Message-Id: <20201013091017.1899676-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/9] avcodecc/asvdec: Avoid reversing input data twice 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" Up until now the ASV2 decoder used an ordinary big-endian bitreader to read data actually destined for a little-endian bitreader; this is done by reversing the whole input packet bitwise, using the big-endian bigreader and reversing (and shifting) the result again. This commit stops this and instead uses a little-endian bitreader directly. Signed-off-by: Andreas Rheinhardt --- libavcodec/asvdec.c | 77 ++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 6198188fc5..78e53b6402 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -31,7 +31,6 @@ #include "blockdsp.h" #include "idctdsp.h" #include "internal.h" -#include "mathops.h" #include "mpeg12data.h" #define CCP_VLC_BITS 5 @@ -56,27 +55,24 @@ static av_cold void init_vlcs(ASV1Context *a) INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, &ff_asv_ccp_tab[0][1], 2, 1, &ff_asv_ccp_tab[0][0], 2, 1, 32); - INIT_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, - &ff_asv_dc_ccp_tab[0][1], 2, 1, - &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); - INIT_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, - &ff_asv_ac_ccp_tab[0][1], 2, 1, - &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); + INIT_CUSTOM_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, + &ff_asv_dc_ccp_tab[0][1], 2, 1, + &ff_asv_dc_ccp_tab[0][0], 2, 1, + INIT_VLC_OUTPUT_LE, 16); + INIT_CUSTOM_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, + &ff_asv_ac_ccp_tab[0][1], 2, 1, + &ff_asv_ac_ccp_tab[0][0], 2, 1, + INIT_VLC_OUTPUT_LE, 64); INIT_VLC_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, &ff_asv_level_tab[0][1], 2, 1, &ff_asv_level_tab[0][0], 2, 1, 16); - INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, - &ff_asv2_level_tab[0][1], 2, 1, - &ff_asv2_level_tab[0][0], 2, 1, 1024); + INIT_CUSTOM_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, + &ff_asv2_level_tab[0][1], 2, 1, + &ff_asv2_level_tab[0][0], 2, 1, + INIT_VLC_OUTPUT_LE, 1024); } } -// FIXME write a reversed bitstream reader to avoid the double reverse -static inline int asv2_get_bits(GetBitContext *gb, int n) -{ - return ff_reverse[get_bits(gb, n) << (8 - n)]; -} - static inline int asv1_get_level(GetBitContext *gb) { int code = get_vlc2(gb, level_vlc.table, ASV1_LEVEL_VLC_BITS, 1); @@ -87,12 +83,31 @@ static inline int asv1_get_level(GetBitContext *gb) return code - 3; } +// get_vlc2() is big-endian in this file +static inline int asv2_get_vlc2(GetBitContext *gb, VLC_TYPE (*table)[2], int bits) +{ + unsigned int index; + int code, n; + + OPEN_READER(re, gb); + UPDATE_CACHE_LE(re, gb); + + index = SHOW_UBITS_LE(re, gb, bits); + code = table[index][0]; + n = table[index][1]; + LAST_SKIP_BITS(re, gb, n); + + CLOSE_READER(re, gb); + + return code; +} + static inline int asv2_get_level(GetBitContext *gb) { - int code = get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1); + int code = asv2_get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS); if (code == 31) - return (int8_t) asv2_get_bits(gb, 8); + return (int8_t) get_bits_le(gb, 8); else return code - 31; } @@ -132,11 +147,11 @@ static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) { int i, count, ccp; - count = asv2_get_bits(&a->gb, 4); + count = get_bits_le(&a->gb, 4); - block[0] = 8 * asv2_get_bits(&a->gb, 8); + block[0] = 8 * get_bits_le(&a->gb, 8); - ccp = get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS, 1); + ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS); if (ccp) { if (ccp & 4) block[a->scantable.permutated[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4; @@ -147,7 +162,7 @@ static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) } for (i = 1; i < count + 1; i++) { - const int ccp = get_vlc2(&a->gb, ac_ccp_vlc.table, AC_CCP_VLC_BITS, 1); + const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc.table, AC_CCP_VLC_BITS); if (ccp) { if (ccp & 8) @@ -221,21 +236,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; - av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, - buf_size); - if (!a->bitstream_buffer) - return AVERROR(ENOMEM); - if (avctx->codec_id == AV_CODEC_ID_ASV1) { + av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, + buf_size); + if (!a->bitstream_buffer) + return AVERROR(ENOMEM); + a->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer, (const uint32_t *) buf, buf_size / 4); + ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size); } else { - int i; - for (i = 0; i < buf_size; i++) - a->bitstream_buffer[i] = ff_reverse[buf[i]]; + ret = init_get_bits8_le(&a->gb, buf, buf_size); } - - ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size); if (ret < 0) return ret; @@ -342,7 +354,6 @@ AVCodec ff_asv2_decoder = { .id = AV_CODEC_ID_ASV2, .priv_data_size = sizeof(ASV1Context), .init = decode_init, - .close = decode_end, .decode = decode_frame, .capabilities = AV_CODEC_CAP_DR1, }; From patchwork Tue Oct 13 09:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22919 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:3414:0:0:0:0:0 with SMTP id b20csp1644980yba; Tue, 13 Oct 2020 02:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzRESYcqbXCXJ+tsrlR8Zn3xi/Df1x1BX5Cbj4guptx3k7d6ihJnQn+kr0xPq117Bzp0M6 X-Received: by 2002:adf:9f4c:: with SMTP id f12mr22657814wrg.108.1602580276784; Tue, 13 Oct 2020 02:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602580276; cv=none; d=google.com; s=arc-20160816; b=JHNQJ5k+cpuEh5RA74nRr3wM2owIGx6j09WE6fWco6sS3j3m2e99TySdnIlLJUKlR+ dCGq3btMZFCATBUVXZeTdAChPRaOkaDr+zLe8dgrV2BDEtX6/TzJi5Wu8zV9sygqdRQf SqVC178G7pPBchTqLIMZy4BH4iXpvfS3rSPIFi3WrK9g4vbKbeyAVj9HRvRjKTnGGJW5 MI0iVTusV64hMU/O8EvHiIUGal+Ge/NNMQ8vGtZ1r6VT0H7yS1nQtaxMc8VbFUR/oR6+ Zpe0tMxE378KX9ZYycJsx97z5GTawmI8+0c8Nz4TMz93K6NmNE8iJjeBYPvxqHwXsJDV j3zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=drGRwj1AUFw4rPK6zjsQa1MQORvclRrRkvVOT191Ik8=; b=rwlfpuWMxrUgVwtkZLiLMg2pZH7drFrb9fxzTUgaWRiX4PoXKyJSjbYZDMiy/TvCuL MJdr1eeCQ8FSgaKCGJdl/ckKWTAc+yf80g/jwu7X5dG1Yd+4G71cXQ0/ux/q88IoFhjh 62nJjPbY9jYl6TukA7qpOu19M7Y7eQubljQRSj3M05uC+l/0At06p2KBneARfuB/xL1P X+b1BKb8zxo4AKXYPFM+XniAqcrs4B42oRWACbjGUM1olXb+HsFXNHRPManGxEc9axdl vzj0vaEI8huL6G+02UFXqoRVPdVGbiNe/ybPk0YDOl6vGS9AeM2g1aHPW/sFKZ1dp7Gg Wl0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=t94E4lUL; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u22si18248789wmc.123.2020.10.13.02.11.16; Tue, 13 Oct 2020 02:11:16 -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=@gmail.com header.s=20161025 header.b=t94E4lUL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 824ED68BB59; Tue, 13 Oct 2020 12:11:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3EA8F68BB27 for ; Tue, 13 Oct 2020 12:10:53 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id h7so23096617wre.4 for ; Tue, 13 Oct 2020 02:10:53 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=LTeK1Zk3P0Gp2CXzewLdkHLHDxqlYvoYtd5dwckpWb4=; b=t94E4lULq5dVYb1ldWDhAqosy6shD2kjPyKAsnAPq/yxL/DEQpL2csRy/YDad4U6WE JVcXQs/KQH91PAQ0Ywldas9kx2mU5x5xxvZcUAyJQznDVHcGuvV43MgdBnluWhosyoKm aO1WP4zKy2FuXxBgYfaQFfI0IXcCEsem6r3Fi7hJbvc9xK966nFaRbfAKwoeaW6XUIhq QqM8MnLaM37ZEguR5qraofhWUYTOeLi+/NN0KXkPiQwDd2/iorQxUDDMKf2TWJx+3Auh fe+z3d2QRMi0yzSV4No6ErCPQLuFm7BfjUrQLFetU5ySZppO/lbJQwbCL8GQRi1L/rR0 jLkg== 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:mime-version:content-transfer-encoding; bh=LTeK1Zk3P0Gp2CXzewLdkHLHDxqlYvoYtd5dwckpWb4=; b=MfkpTg6O0TYG2rZLfmXMSU9rSVQY228DhtjK9LJkGD4S6kxXw+GDzmSk8+H5uPDK3H 3O6+7WGFvqdyVFMDoglFV26fSJxMiN1tRmtv2AOP62tB0tBpfrhTTLjvWeCNwak4LmEr alpcvh+ZAIeicvCfaHHFIJ2FfowP7bF5PelfqcMPyEzyqSCiRcgZSPTdKU6J/DiGwnet 9V50q0VgAe3W8OhMNwwzN6b/eJKEB+gM2MDyr+fylz2PbUZK+erD6PYgMVKcpJJyTGG9 5dg2/tqxHZZS0e2LWc7v7ghzLNyaaM4quFujYPOVG2qEeQOt7Zzryn6b6aRrOM2g7mFh CUmQ== X-Gm-Message-State: AOAM530s8KoidQdlFQ3VojRc13ncxS32Q5yDkditPFKTLmpcZyetc7I5 TP4xT4Ae3f1iwNt3SJZWKR9IevgOS64= X-Received: by 2002:adf:ee44:: with SMTP id w4mr1921594wro.114.1602580252195; Tue, 13 Oct 2020 02:10:52 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:51 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:12 +0200 Message-Id: <20201013091017.1899676-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/9] avcodec/asvenc: Inline constants 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" X-TUID: BUW4JFldx6eA Content-Length: 2890 Signed-off-by: Andreas Rheinhardt --- libavcodec/asvenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 28f7a94071..054ec8ee65 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -47,7 +47,7 @@ static inline void asv1_put_level(PutBitContext *pb, int level) if (index <= 6) { put_bits(pb, ff_asv_level_tab[index][1], ff_asv_level_tab[index][0]); } else { - put_bits(pb, ff_asv_level_tab[3][1], ff_asv_level_tab[3][0]); + put_bits(pb, 3, 0); /* Escape code */ put_sbits(pb, 8, level); } } @@ -59,7 +59,7 @@ static inline void asv2_put_level(ASV1Context *a, PutBitContext *pb, int level) if (index <= 62) { put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]); } else { - put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]); + put_bits(pb, 5, 0); /* Escape code */ if (level < -128 || level > 127) { av_log(a->avctx, AV_LOG_WARNING, "Clipping level %d, increase qscale\n", level); level = av_clip_int8(level); @@ -95,7 +95,7 @@ static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]) if (ccp) { for (; nc_count; nc_count--) - put_bits(&a->pb, ff_asv_ccp_tab[0][1], ff_asv_ccp_tab[0][0]); + put_bits(&a->pb, 2, 2); /* Skip */ put_bits(&a->pb, ff_asv_ccp_tab[ccp][1], ff_asv_ccp_tab[ccp][0]); @@ -111,7 +111,7 @@ static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]) nc_count++; } } - put_bits(&a->pb, ff_asv_ccp_tab[16][1], ff_asv_ccp_tab[16][0]); + put_bits(&a->pb, 5, 0xF); /* End of block */ } static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) From patchwork Tue Oct 13 09:10:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22916 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:3414:0:0:0:0:0 with SMTP id b20csp1645132yba; Tue, 13 Oct 2020 02:11:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzU3nhvzRfE5b30mmjrSnmUrli14nKB7yBBEyurE67qp5c/Wz4qzOpjfP+O5+dlQ/6gcAiA X-Received: by 2002:adf:9e05:: with SMTP id u5mr34301723wre.78.1602580291679; Tue, 13 Oct 2020 02:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602580291; cv=none; d=google.com; s=arc-20160816; b=pYkiBboovP8jd2LZBQm/cKmfxoMYXomQrNlK3YqQPreg49ZFFefc2kKhG9IgjR0RR+ hXL1WEd9ES6z80xYDR3J1Qmk90OkinpEHSL3v4oETGxD1r4RxkACD5HvOqVQyuLJSwGK GcG/bcF+hXWAj9Ekyxn74KpoQRXViW42RoMub6nJJqSjXmQvaaO7kgbTxzL5KxW511CD W8wJvV556Bay6IufkMcS+bhYOdsXTpFKVcSJUWXtbZ1obObftUBMnfC372chMcVi+lvD mhO6l3M6kRCBnoDbbbpJ6gcqU0JZUGJopC2TicvIQmH/W+MHT9CJivxUcWocml9ulyun KBJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=qJdGXY4DBmUD18ZzM++fMQ1+VT34WZQAx60vHnnKdXY=; b=B2e5E49KLQieQoQwldC54SLX/4UYsNXhO3N5oTC/DoVjAWVUGC8GRdLqFCENdQtthe mSAiovb4HphwfP7mdtUKAsXsxOtDqSt/n26ngau3FsGfJ59Z5cO41rhODbpfg8FdlLPs TwNvHZ0KNj0tcxVzHYLLLMVpV05r6nMCc8v0Djb0HCdkrf/9L0axSvA2V12rfCPQjrUC AOVdLgIkWqkE2HdCMOFmmAF5k8xWodGASUJ9qZoc2oKqG6lj0HEIiXRpaWeY30sYxOww JaLQaVwhhbJGlrpF965F9Ykg923zBRJU2GXoSnJR/bIaAWg93zP55Id3KZi6UFmwRGi7 40Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=UP8nsExB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r2si18442911wrw.175.2020.10.13.02.11.30; Tue, 13 Oct 2020 02:11:31 -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=@gmail.com header.s=20161025 header.b=UP8nsExB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D1B2A68BB72; Tue, 13 Oct 2020 12:11:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 27F7C68BB54 for ; Tue, 13 Oct 2020 12:10:55 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id i1so16947019wro.1 for ; Tue, 13 Oct 2020 02:10:55 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Q/Imau7xZsh+Yna8ZnAJuIjnxpUcnoeWg1EzfNnSc98=; b=UP8nsExB24+Ctbkw1eWxHOyv+/pJEK40PVRhkONY5sQmUmbHaQOcxWrCp/izhvN7xI fC0JQkXdPGkXLrmC7mACqp2gTTW6S62w0Ripa0BY4PG0EriVFPclq38qRpkEi6XYDgdP 7l+esy4jtQ7HbPYzH7DpI7iqp2mlwM+hPpOSGbWrUupnOzP49qnJ5JQkUh05XE5Aqwq+ gbAa+h3LJ+WtcYRH/67BoadtShSQN+NMn6QcKJj6BtPAMbC0NUqRK0GPaCFCrDOvhx+z bk19hwnLZD1Pga9DUR99uq2hzfyGSoF8gVPS2WY+GR4oVmq+KKntbag9fSArukt1+EvD MfJw== 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:mime-version:content-transfer-encoding; bh=Q/Imau7xZsh+Yna8ZnAJuIjnxpUcnoeWg1EzfNnSc98=; b=Me3s3hD8OHrRug7CZCIcgYdSpQHk4kshj+98k/+hWjc3e7OiK8VFPx5WweYBq1wQwq pU8U/JPAlmKBIyKTTid2ecYrF+ZeKGAdH7Dm/8QRgDCumSe74wLyo5sLDv6Dk7Itdrkz HJTRiBFKpZ9OjNZyy+PU/ONkbH0gF4G9jSAbO2vTsd6feKVWfiAJNJ6CNMl/CNrmjy6R YsRyHJDXsxJG8r9HESho+TQQ1R0z8WKOGYrnnIIPHr4kjdMh/UW9RZndIa1jYh8VvTCe 1AqELywi0bgPZtzysiO9TKsgRspUCBPYgN5BLsDB/IcWFuErkZByv42jXNG0ZjmrTXC5 YEUg== X-Gm-Message-State: AOAM530AkvveNzDMjBJ0jaeJOUzaODOAR4D0XvpkqwBzlRna71b916xj Tjoy095WTfMpIPpPdl0kYd3TiiY1HEc= X-Received: by 2002:adf:e8cb:: with SMTP id k11mr25527103wrn.91.1602580253967; Tue, 13 Oct 2020 02:10:53 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:52 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:13 +0200 Message-Id: <20201013091017.1899676-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/9] avcodec/asvenc: Simplify flushing and padding packet 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" X-TUID: qtEXoGRE1JBh Content-Length: 1399 Signed-off-by: Andreas Rheinhardt --- libavcodec/asvenc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 054ec8ee65..49df3ffbe1 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -291,12 +291,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } emms_c(); - avpriv_align_put_bits(&a->pb); - while (put_bits_count(&a->pb) & 31) - put_bits(&a->pb, 8, 0); - flush_put_bits(&a->pb); - size = put_bits_count(&a->pb) / 32; + AV_WN32(put_bits_ptr(&a->pb), 0); + size = (put_bits_count(&a->pb) + 31) / 32; if (avctx->codec_id == AV_CODEC_ID_ASV1) { a->bbdsp.bswap_buf((uint32_t *) pkt->data, From patchwork Tue Oct 13 09:10:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22915 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:3414:0:0:0:0:0 with SMTP id b20csp1645330yba; Tue, 13 Oct 2020 02:11:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqh1ksuirrzLMldc6aJyQUf4I2xvEKJcMn7+9wpZYEPXdZZTG0nnKVcYWJpy0AyqLh4TQ5 X-Received: by 2002:adf:c392:: with SMTP id p18mr33407345wrf.88.1602580315558; Tue, 13 Oct 2020 02:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602580315; cv=none; d=google.com; s=arc-20160816; b=bLEZkwf9NfzRTvpL6nFH9yFACLDYTjygXOUvimwUxi4t7CL1OdrOvY7je3gocVyybz ZxhM+59TZR1GxE8o4NkAqtE2a2gGiJmZrQoJosfYCAMYlBWmcTOgPDdePEKEiyuBR/nD 1NWYkX+j5D61BvcS02BFSms1tZmwQ3iek/jAjMM4/IaGOEnM7Dmdokhhqx8mgxwdSRuu j9YgzOFR6wCQX1Tvukk2Y8vBICBqhxdpIwfpN9XlbB/SWa0kgzFHy0DozY7MCK65u6Q5 h1XC9vdf9PIT8ferofoCu2103lSmqq8F+tMSCuJStyr+VH9ahbzXjpRuw08JS9VT5SfB X+qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=v8M54Io/JBBdaigmWPeiead8M7rIe2bN1tBXfQqxhSA=; b=HnwXMp2EGn7iKJUgGFT053842xABBDgh/mZmYKHHMJvIwC6CdJM9iXovZGB27Z9LX0 SzaiOLvfsIEbPh6s0W91eaEpvMXJ2XoG1L6Pa0Dy0nSj0gPqGykHeGVOAPniJTdvm/Bh 0khvgDFalRJnutINscI3X8wqc13zh0y96q1GKDj7bVWzAHf3+WmpbNp4G6otmDKL+QMc E0yMifviXMN1LbJHVXs9ckRLg14ljrEPWSXb21+EutloU32WgSk2SE5UnsHG1oRzRIDP +EFU1AWSV7GQgHkH2cyS/FpdkS6v+5ksb+Jviz57iCxFAtKZljQPL04zk6e5brFN0VUq GytA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Aiy6Jd9k; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n15si16763745wrt.399.2020.10.13.02.11.55; Tue, 13 Oct 2020 02:11:55 -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=@gmail.com header.s=20161025 header.b=Aiy6Jd9k; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD21A68BB5D; Tue, 13 Oct 2020 12:11:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3F34268BB62 for ; Tue, 13 Oct 2020 12:10:57 +0300 (EEST) Received: by mail-wr1-f53.google.com with SMTP id e18so23054297wrw.9 for ; Tue, 13 Oct 2020 02:10:57 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Oh71Hz7CekICtWPGGTA6M9gyHxfaq7v8GFfnKbz1U/A=; b=Aiy6Jd9kuWDoaF3RLi7tkL2XQ+BQ2dS8p8OvmAHSZvc3n61U9UREiQSmdGECdDYPxH yb02ER1PepPAMeJRq+1XC/N6Ujpa9f7n8DRwqlmbNvEAP8HWaO3bkBLQ4XkmyCIQizG1 RQTcchKq8kPknAIJc7sdT5tj3IhprNdDLCUwdLGJTBr0mz5IgwvMb0QvggmoWDzAzBiq Vo622sd2azF4I59KlN6J+o120TaopyHMjtMeX6da/3US7fVj2RwJOrGiN3TJfei2ctAt bWr9s8gUniCA66Z6uEq+arycq9OTz/8CjjJlc5KfH/VoTOqH4xtuYni3l6xuYARg/RUX 1JrQ== 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:mime-version:content-transfer-encoding; bh=Oh71Hz7CekICtWPGGTA6M9gyHxfaq7v8GFfnKbz1U/A=; b=Di4NnSyQfBV+5ud7vcPqSE9qbNdzGt7chxl0Su2OGTSpe/5oLn4EiPU+2iVJfPSG9v N8UWem/h0u15WUWmzwARep9QUlQ/SCN4AE44bMBVEK31CZAKxgG9Ty73DdczF05u3wgs z+/XG32jwPGZvlQuLJFZWIos4M0iXM+1nqMzgtd3zKfEt0a9lRcCsIKVCLrCWih/uJYe CpQajrkpweta13/wku3+B1zFQte3vO3nzqZsaXzSZZaCdgU7la4Q9ljLP35fo4476spI sUpRFD4GdgAbc9iNhb3HbLXFsR8cp1sCku4uGCPEm1TfXO7XvYAwDhudize7oGAOxLCp 2FhQ== X-Gm-Message-State: AOAM533XZEdxSWZCnktaLoFqebVXG1se7k9WpQT4vBUKiuEoFutGkLt0 CcRswyk0T9M/pGnyn/RPEoyTQPK7IpE= X-Received: by 2002:adf:bc13:: with SMTP id s19mr33355823wrg.338.1602580255799; Tue, 13 Oct 2020 02:10:55 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:54 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:14 +0200 Message-Id: <20201013091017.1899676-6-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/9] avcodec/asvenc: Avoid reversing output data twice 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" X-TUID: q5W6JGYg2+3q Content-Length: 12742 The ASUS V2 format is designed for a little-endian bitstream reader, yet our encoder used an ordinary big-endian bitstream writer to write it; the bits of every byte were swapped at the end and some data (namely the numbers not in static tables) had to be bitreversed before writing it at all, so that it would be reversed twice. This commit stops doing so; instead, a little-endian bitstream writer is used. This also necessitated to switch certain static tables, which required trivial modifications to the decoder (that uses the same tables). Signed-off-by: Andreas Rheinhardt --- libavcodec/asv.c | 46 +++++++++++++++++++++++++-------------------- libavcodec/asv.h | 2 +- libavcodec/asvdec.c | 21 +++++++++------------ libavcodec/asvenc.c | 29 +++++++++++----------------- 4 files changed, 47 insertions(+), 51 deletions(-) diff --git a/libavcodec/asv.c b/libavcodec/asv.c index 14fdf73333..dcae90982a 100644 --- a/libavcodec/asv.c +++ b/libavcodec/asv.c @@ -53,31 +53,37 @@ const uint8_t ff_asv_level_tab[7][2] = { }; const uint8_t ff_asv_dc_ccp_tab[8][2] = { - { 0x1, 2 }, { 0xD, 4 }, { 0xF, 4 }, { 0xC, 4 }, - { 0x5, 3 }, { 0xE, 4 }, { 0x4, 3 }, { 0x0, 2 }, + { 0x2, 2 }, { 0xB, 4 }, { 0xF, 4 }, { 0x3, 4 }, + { 0x5, 3 }, { 0x7, 4 }, { 0x1, 3 }, { 0x0, 2 }, }; const uint8_t ff_asv_ac_ccp_tab[16][2] = { - { 0x00, 2 }, { 0x3B, 6 }, { 0x0A, 4 }, { 0x3A, 6 }, - { 0x02, 3 }, { 0x39, 6 }, { 0x3C, 6 }, { 0x38, 6 }, - { 0x03, 3 }, { 0x3D, 6 }, { 0x08, 4 }, { 0x1F, 5 }, - { 0x09, 4 }, { 0x0B, 4 }, { 0x0D, 4 }, { 0x0C, 4 }, + { 0x00, 2 }, { 0x37, 6 }, { 0x05, 4 }, { 0x17, 6 }, + { 0x02, 3 }, { 0x27, 6 }, { 0x0F, 6 }, { 0x07, 6 }, + { 0x06, 3 }, { 0x2F, 6 }, { 0x01, 4 }, { 0x1F, 5 }, + { 0x09, 4 }, { 0x0D, 4 }, { 0x0B, 4 }, { 0x03, 4 }, }; -const uint8_t ff_asv2_level_tab[63][2] = { - { 0x3F, 10 }, { 0x2F, 10 }, { 0x37, 10 }, { 0x27, 10 }, { 0x3B, 10 }, { 0x2B, 10 }, { 0x33, 10 }, { 0x23, 10 }, - { 0x3D, 10 }, { 0x2D, 10 }, { 0x35, 10 }, { 0x25, 10 }, { 0x39, 10 }, { 0x29, 10 }, { 0x31, 10 }, { 0x21, 10 }, - { 0x1F, 8 }, { 0x17, 8 }, { 0x1B, 8 }, { 0x13, 8 }, { 0x1D, 8 }, { 0x15, 8 }, { 0x19, 8 }, { 0x11, 8 }, - { 0x0F, 6 }, { 0x0B, 6 }, { 0x0D, 6 }, { 0x09, 6 }, - { 0x07, 4 }, { 0x05, 4 }, - { 0x03, 2 }, - { 0x00, 5 }, - { 0x02, 2 }, - { 0x04, 4 }, { 0x06, 4 }, - { 0x08, 6 }, { 0x0C, 6 }, { 0x0A, 6 }, { 0x0E, 6 }, - { 0x10, 8 }, { 0x18, 8 }, { 0x14, 8 }, { 0x1C, 8 }, { 0x12, 8 }, { 0x1A, 8 }, { 0x16, 8 }, { 0x1E, 8 }, - { 0x20, 10 }, { 0x30, 10 }, { 0x28, 10 }, { 0x38, 10 }, { 0x24, 10 }, { 0x34, 10 }, { 0x2C, 10 }, { 0x3C, 10 }, - { 0x22, 10 }, { 0x32, 10 }, { 0x2A, 10 }, { 0x3A, 10 }, { 0x26, 10 }, { 0x36, 10 }, { 0x2E, 10 }, { 0x3E, 10 }, +const uint16_t ff_asv2_level_tab[63][2] = { + { 0x3F0, 10 }, { 0x3D0, 10 }, { 0x3B0, 10 }, { 0x390, 10 }, { 0x370, 10 }, + { 0x350, 10 }, { 0x330, 10 }, { 0x310, 10 }, { 0x2F0, 10 }, { 0x2D0, 10 }, + { 0x2B0, 10 }, { 0x290, 10 }, { 0x270, 10 }, { 0x250, 10 }, { 0x230, 10 }, + { 0x210, 10 }, + { 0x0F8, 8 }, { 0x0E8, 8 }, { 0x0D8, 8 }, { 0x0C8, 8 }, { 0x0B8, 8 }, + { 0x0A8, 8 }, { 0x098, 8 }, { 0x088, 8 }, + { 0x03C, 6 }, { 0x034, 6 }, { 0x02C, 6 }, { 0x024, 6 }, + { 0x00E, 4 }, { 0x00A, 4 }, + { 0x003, 2 }, + { 0x000, 5 }, + { 0x001, 2 }, + { 0x002, 4 }, { 0x006, 4 }, + { 0x004, 6 }, { 0x00C, 6 }, { 0x014, 6 }, { 0x01C, 6 }, + { 0x008, 8 }, { 0x018, 8 }, { 0x028, 8 }, { 0x038, 8 }, { 0x048, 8 }, + { 0x058, 8 }, { 0x068, 8 }, { 0x078, 8 }, + { 0x010, 10 }, { 0x030, 10 }, { 0x050, 10 }, { 0x070, 10 }, { 0x090, 10 }, + { 0x0B0, 10 }, { 0x0D0, 10 }, { 0x0F0, 10 }, { 0x110, 10 }, { 0x130, 10 }, + { 0x150, 10 }, { 0x170, 10 }, { 0x190, 10 }, { 0x1B0, 10 }, { 0x1D0, 10 }, + { 0x1F0, 10 } }; av_cold void ff_asv_common_init(AVCodecContext *avctx) diff --git a/libavcodec/asv.h b/libavcodec/asv.h index a1366b6fe4..e778c72d34 100644 --- a/libavcodec/asv.h +++ b/libavcodec/asv.h @@ -66,7 +66,7 @@ extern const uint8_t ff_asv_ccp_tab[17][2]; extern const uint8_t ff_asv_level_tab[7][2]; extern const uint8_t ff_asv_dc_ccp_tab[8][2]; extern const uint8_t ff_asv_ac_ccp_tab[16][2]; -extern const uint8_t ff_asv2_level_tab[63][2]; +extern const uint16_t ff_asv2_level_tab[63][2]; void ff_asv_common_init(AVCodecContext *avctx); diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 78e53b6402..6b6d7b3fa7 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -55,21 +55,18 @@ static av_cold void init_vlcs(ASV1Context *a) INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, &ff_asv_ccp_tab[0][1], 2, 1, &ff_asv_ccp_tab[0][0], 2, 1, 32); - INIT_CUSTOM_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, - &ff_asv_dc_ccp_tab[0][1], 2, 1, - &ff_asv_dc_ccp_tab[0][0], 2, 1, - INIT_VLC_OUTPUT_LE, 16); - INIT_CUSTOM_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, - &ff_asv_ac_ccp_tab[0][1], 2, 1, - &ff_asv_ac_ccp_tab[0][0], 2, 1, - INIT_VLC_OUTPUT_LE, 64); + INIT_LE_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, + &ff_asv_dc_ccp_tab[0][1], 2, 1, + &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); + INIT_LE_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, + &ff_asv_ac_ccp_tab[0][1], 2, 1, + &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); INIT_VLC_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, &ff_asv_level_tab[0][1], 2, 1, &ff_asv_level_tab[0][0], 2, 1, 16); - INIT_CUSTOM_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, - &ff_asv2_level_tab[0][1], 2, 1, - &ff_asv2_level_tab[0][0], 2, 1, - INIT_VLC_OUTPUT_LE, 1024); + INIT_LE_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, + &ff_asv2_level_tab[0][1], 4, 2, + &ff_asv2_level_tab[0][0], 4, 2, 1024); } } diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 49df3ffbe1..718ffa1836 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -32,14 +32,8 @@ #include "dct.h" #include "fdctdsp.h" #include "internal.h" -#include "mathops.h" #include "mpeg12data.h" -static inline void asv2_put_bits(PutBitContext *pb, int n, int v) -{ - put_bits(pb, n, ff_reverse[v << (8 - n)]); -} - static inline void asv1_put_level(PutBitContext *pb, int level) { unsigned int index = level + 3; @@ -57,14 +51,14 @@ static inline void asv2_put_level(ASV1Context *a, PutBitContext *pb, int level) unsigned int index = level + 31; if (index <= 62) { - put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]); + put_bits_le(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]); } else { - put_bits(pb, 5, 0); /* Escape code */ + put_bits_le(pb, 5, 0); /* Escape code */ if (level < -128 || level > 127) { av_log(a->avctx, AV_LOG_WARNING, "Clipping level %d, increase qscale\n", level); level = av_clip_int8(level); } - asv2_put_bits(pb, 8, level & 0xFF); + put_bits_le(pb, 8, level & 0xFF); } } @@ -127,8 +121,8 @@ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) count >>= 2; - asv2_put_bits(&a->pb, 4, count); - asv2_put_bits(&a->pb, 8, (block[0] + 32) >> 6); + put_bits_le(&a->pb, 4, count); + put_bits_le(&a->pb, 8, (block[0] + 32) >> 6); block[0] = 0; for (i = 0; i <= count; i++) { @@ -150,9 +144,9 @@ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) av_assert2(i || ccp < 8); if (i) - put_bits(&a->pb, ff_asv_ac_ccp_tab[ccp][1], ff_asv_ac_ccp_tab[ccp][0]); + put_bits_le(&a->pb, ff_asv_ac_ccp_tab[ccp][1], ff_asv_ac_ccp_tab[ccp][0]); else - put_bits(&a->pb, ff_asv_dc_ccp_tab[ccp][1], ff_asv_dc_ccp_tab[ccp][0]); + put_bits_le(&a->pb, ff_asv_dc_ccp_tab[ccp][1], ff_asv_dc_ccp_tab[ccp][0]); if (ccp) { if (ccp & 8) @@ -291,17 +285,16 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } emms_c(); - flush_put_bits(&a->pb); + if (avctx->codec_id == AV_CODEC_ID_ASV1) + flush_put_bits(&a->pb); + else + flush_put_bits_le(&a->pb); AV_WN32(put_bits_ptr(&a->pb), 0); size = (put_bits_count(&a->pb) + 31) / 32; if (avctx->codec_id == AV_CODEC_ID_ASV1) { a->bbdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size); - } else { - int i; - for (i = 0; i < 4 * size; i++) - pkt->data[i] = ff_reverse[pkt->data[i]]; } pkt->size = size * 4; From patchwork Tue Oct 13 09:10:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22914 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:3414:0:0:0:0:0 with SMTP id b20csp1645392yba; Tue, 13 Oct 2020 02:12:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx23v6AuLfBJ4USzZ3wWUocSD/SgqO28Qspk42uimVB1J0bcBG5qWcuLweIcaHXBy0n7MA0 X-Received: by 2002:adf:e741:: with SMTP id c1mr23460769wrn.16.1602580323524; Tue, 13 Oct 2020 02:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602580323; cv=none; d=google.com; s=arc-20160816; b=IQwftLSi7xtQGLLO/sGU+KDyrObnb6r0XbND2XBCF4LJv2U+LhSvZv80e58/dPEIUu PqVmy+X4DlV1fCHBYFH4pUYm5IfdpYAeqSqBJUfNV89DHvcIjRmDuU9uHoUh9To9n2im Fx/d9mPULlQ8gp//kIIDWbh5WLofDvormsUijk4kW7G1d8k4APlPk2o1ATLvarussVfI hnNDbhItnmtZdwhQ8gvUHbdqka/uoglJcU3y9HoEG593wdKXfvwYS/pF2wcSN5I2gzuW u5rqZM9jubtfBRY34WZhVy2QaYMBwF3Iot6Eevo95ziShWewBgz85nGbcRso+BXlSq3X rTLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=Oyjx+WsdRLrPVGGW7/e3m7bzT2xaUic4mYKpHqiylsU=; b=xzyUZLe91yO134CuJENuEPEM0cze9Qa7nWI7AGrGJpJhh7RlWZHBPADYZxOScEsGtw f8eXLUs/VQoIn6duiz/HbCZG31NqVqTrZ2VioiRubvkaf6L+IJoDJLknX3Htd4zZ7ol3 3y4T8XqJ76Ico67Ful47GofD2wQqHO7Y48GXP5884x7bShkVdNJHOQ+aIMIhTB+CWuS5 bIYmuwbnuT8Umc2js75kJLAmcKu1RM3tBPs4PPOg3wrl0ixf50Glk4OWEbcfuO+jKNRb lZW1UGpit/SMTZ4sy+QkOJKMiSDOaB9L2pdPTTTGmSqHWytm2xcdg/jiyCKBF0LfLGAf T6Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=sKXdpvUn; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a131si18175804wmf.197.2020.10.13.02.12.03; Tue, 13 Oct 2020 02:12:03 -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=@gmail.com header.s=20161025 header.b=sKXdpvUn; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 429CF68BBDD; Tue, 13 Oct 2020 12:11:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 112FE68BB9E for ; Tue, 13 Oct 2020 12:10:58 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id h5so12995109wrv.7 for ; Tue, 13 Oct 2020 02:10:58 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=yAaP9JoTbUZup9cU1j4IVv0QBEC6HItgEblGWCgs8hg=; b=sKXdpvUnpRWWfUef19nbqWRgMwsdH77KlCSMleawUoCpAXFf8lIG4SzRCafAEAi28/ tcE+GbCUVYTQyhtsAQiFEhtNG3zYfreujLaruZ+cgvwwUpSlIb7GSuiED0wKVRMjGgTS ztbR2Nc1aYCjTd5tyu27qxfXHy2HrSXJbWXvFEw58NY7bY+67KthI0NU9UAJ/4VaWPiP x6yjZ2FhYLwoSQKBkOrBZFfnTbzTSFIa/7Lryj9jA4V5777a8RbPJE3+plyV1MKM5+ko /fpYXsD+BiIcv1+WOS7PDKHSm9DnU2o/dfufZ2h+6ZZcmqoA4V+fCtzVghdDz9KDPkQi WlDg== 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:mime-version:content-transfer-encoding; bh=yAaP9JoTbUZup9cU1j4IVv0QBEC6HItgEblGWCgs8hg=; b=otv171MYPMTwrOIyth2Yi661KcumNq93oFQDXsfvTOirVdTeQwpbvoMFr2iYkPDW11 Bndm14sgX3NAfoIxlUZWlqcv17MVdOczG0r6CisSbUBkCaXX98SjjkICYpdV+K76MLsm K6XiybSfDABJ0IYAQfZ9k0mCDvcVt9MM+IKEeqHs1ysZNueX5qPWV3wl/wx7dk+ru5EH 6QLg3lERcxk3DUW5WQPI/YqJVQJqZVfmBh8Kh0ABMBYZJg7tbYpyATMVVQg3Uz73qmWo jxIhWU1zy0XWRjyxHHLKTQBKd65JnYhsH/xbhvaKMH5TwNApTHNtmtTOTE0nJ5ist3MV zogg== X-Gm-Message-State: AOAM532Cb4rlrGN6nYJl3JoB5GZk/bS35elbUjOJHB6CP4LMSPlEcO5d owjGNpMl8E097RC+1s4bxZiuDvNd0Vw= X-Received: by 2002:adf:dcc7:: with SMTP id x7mr35350058wrm.203.1602580257188; Tue, 13 Oct 2020 02:10:57 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:56 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:15 +0200 Message-Id: <20201013091017.1899676-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/9] avfilter/af_mcompand: Remove redundant calls to AVFilter.uninit 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" X-TUID: gbTIo5CispcZ Content-Length: 5390 uninit is already called automatically (even when configuring the filter failed). Signed-off-by: Andreas Rheinhardt --- libavfilter/af_mcompand.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/libavfilter/af_mcompand.c b/libavfilter/af_mcompand.c index f142573bea..ce4f366ad7 100644 --- a/libavfilter/af_mcompand.c +++ b/libavfilter/af_mcompand.c @@ -361,10 +361,8 @@ static int config_output(AVFilterLink *outlink) char *p2, *p3, *saveptr2 = NULL, *saveptr3 = NULL; double radius; - if (!tstr) { - uninit(ctx); + if (!tstr) return AVERROR(EINVAL); - } p = NULL; p2 = tstr; @@ -372,7 +370,6 @@ static int config_output(AVFilterLink *outlink) tstr2 = av_strtok(p2, " ", &saveptr2); if (!tstr2) { av_log(ctx, AV_LOG_ERROR, "at least one attacks/decays rate is mandatory\n"); - uninit(ctx); return AVERROR(EINVAL); } p2 = NULL; @@ -381,7 +378,6 @@ static int config_output(AVFilterLink *outlink) count_items(tstr2, &nb_attacks, ','); if (!nb_attacks || nb_attacks & 1) { av_log(ctx, AV_LOG_ERROR, "number of attacks rate plus decays rate must be even\n"); - uninit(ctx); return AVERROR(EINVAL); } @@ -417,7 +413,6 @@ static int config_output(AVFilterLink *outlink) tstr2 = av_strtok(p2, " ", &saveptr2); if (!tstr2) { av_log(ctx, AV_LOG_ERROR, "transfer function curve in dB must be set\n"); - uninit(ctx); return AVERROR(EINVAL); } sscanf(tstr2, "%lf", &s->bands[i].transfer_fn.curve_dB); @@ -427,7 +422,6 @@ static int config_output(AVFilterLink *outlink) tstr2 = av_strtok(p2, " ", &saveptr2); if (!tstr2) { av_log(ctx, AV_LOG_ERROR, "transfer points missing\n"); - uninit(ctx); return AVERROR(EINVAL); } @@ -435,38 +429,31 @@ static int config_output(AVFilterLink *outlink) s->bands[i].transfer_fn.nb_segments = (nb_points + 4) * 2; s->bands[i].transfer_fn.segments = av_calloc(s->bands[i].transfer_fn.nb_segments, sizeof(CompandSegment)); - if (!s->bands[i].transfer_fn.segments) { - uninit(ctx); + if (!s->bands[i].transfer_fn.segments) return AVERROR(ENOMEM); - } ret = parse_points(tstr2, nb_points, radius, &s->bands[i].transfer_fn, ctx); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "transfer points parsing failed\n"); - uninit(ctx); return ret; } tstr2 = av_strtok(p2, " ", &saveptr2); if (!tstr2) { av_log(ctx, AV_LOG_ERROR, "crossover_frequency is missing\n"); - uninit(ctx); return AVERROR(EINVAL); } new_nb_items += sscanf(tstr2, "%lf", &s->bands[i].topfreq) == 1; if (s->bands[i].topfreq < 0 || s->bands[i].topfreq >= outlink->sample_rate / 2) { av_log(ctx, AV_LOG_ERROR, "crossover_frequency: %f, should be >=0 and lower than half of sample rate: %d.\n", s->bands[i].topfreq, outlink->sample_rate / 2); - uninit(ctx); return AVERROR(EINVAL); } if (s->bands[i].topfreq != 0) { ret = crossover_setup(outlink, &s->bands[i].filter, s->bands[i].topfreq); - if (ret < 0) { - uninit(ctx); + if (ret < 0) return ret; - } } tstr2 = av_strtok(p2, " ", &saveptr2); From patchwork Tue Oct 13 09:10:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22911 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 185AC44B5BD for ; Tue, 13 Oct 2020 12:11:07 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0887868BBE6; Tue, 13 Oct 2020 12:11:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7569E68BB44 for ; Tue, 13 Oct 2020 12:10:59 +0300 (EEST) Received: by mail-wr1-f52.google.com with SMTP id n18so23079540wrs.5 for ; Tue, 13 Oct 2020 02:10:59 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=KSvCi2Vbv3UgobXSx7+AbjSb6RbwFHwXOepIlCIaHiM=; b=nCb5oUeZgZDvGFE7nbc1/YREBe0/UasGHB/z2NxpdFaqkNDLhJl8iCZiPinNBeUn4o a23Mtg5CsXOX/iZNJhcMkXaojyE2TKNdILJQ2Ax8FiiG7GJDern/FD9Kj550WEquToda LF8BG5bfmIunhHu1F38vPUEZJiXEpegC3y1T88L/UXa6BS12oQwR7YnX8fjrAbqFkUXG rzPmaADvoGcTa3Z1yhn0clJIwd+cQOMVNvp+qcupebPOK9y/DPhzmidTxxpgRVG4nUAB izeWeJdxICb2eeP7HEJ+R408vUWEnzESAgHlP8hWPKz4mUhImy9b7k2YV4NWW8Ey3L8L 7tcA== 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:mime-version:content-transfer-encoding; bh=KSvCi2Vbv3UgobXSx7+AbjSb6RbwFHwXOepIlCIaHiM=; b=dOK3cZh3gXpzVz8boYQ/6KiqteI+I0Ca5V1g1RHLsuXX/5iJ5A2CycFDxKrLEy59Vk tMunBp1/RJlAF2Ru+7cf+J1E/ZKl16GJQNGkuLxxlQAUreQmJ2bEI3MoKZMhjmwJrFSR zoFjKqFFgE3PKzI4LOCTmFGWeFU+/gu38xDgzcPMa9X6VhlOAoSBKGngmqr2Z9zTsCrB IGW0rPMjy6TWVXTUJ/Xzzd5dcNnbHS1mq/hQ1an7ws/7qEmBTY+M4UbgEsU2HfZ23pWY W3qsogq+oZuYB5IB+j/5SNwbCCKAloiWIU8FEFD7J71mLXzcTqOtrczhxJg0uhzn0qjj LMDg== X-Gm-Message-State: AOAM532oWuUtHx5YJ7piHJ3bNDjp/dqdF88tHANhpiheLRJMlCv5cp2J jtMfNI0ijBx+kOjc4HYpyz7APcoK9Hk= X-Google-Smtp-Source: ABdhPJzl+kR8sZW+RVSGLfUDRTiK6lP7PuAqo8WCwLLMMAtMAO5/jOfgGMnezPmoUdjG0vJVh/iQDw== X-Received: by 2002:adf:df03:: with SMTP id y3mr14982433wrl.70.1602580258382; Tue, 13 Oct 2020 02:10:58 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:57 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:16 +0200 Message-Id: <20201013091017.1899676-8-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/9] avcodec/v3/408enc: Remove empty close functions 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/v308enc.c | 6 ------ libavcodec/v408enc.c | 7 ------- 2 files changed, 13 deletions(-) diff --git a/libavcodec/v308enc.c b/libavcodec/v308enc.c index 29b7f8bedd..0891251dea 100644 --- a/libavcodec/v308enc.c +++ b/libavcodec/v308enc.c @@ -68,11 +68,6 @@ static int v308_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return 0; } -static av_cold int v308_encode_close(AVCodecContext *avctx) -{ - return 0; -} - AVCodec ff_v308_encoder = { .name = "v308", .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"), @@ -80,6 +75,5 @@ AVCodec ff_v308_encoder = { .id = AV_CODEC_ID_V308, .init = v308_encode_init, .encode2 = v308_encode_frame, - .close = v308_encode_close, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }, }; diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c index a2ab66d911..d2d84d9c40 100644 --- a/libavcodec/v408enc.c +++ b/libavcodec/v408enc.c @@ -73,11 +73,6 @@ static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return 0; } -static av_cold int v408_encode_close(AVCodecContext *avctx) -{ - return 0; -} - #if CONFIG_AYUV_ENCODER AVCodec ff_ayuv_encoder = { .name = "ayuv", @@ -86,7 +81,6 @@ AVCodec ff_ayuv_encoder = { .id = AV_CODEC_ID_AYUV, .init = v408_encode_init, .encode2 = v408_encode_frame, - .close = v408_encode_close, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }, }; #endif @@ -98,7 +92,6 @@ AVCodec ff_v408_encoder = { .id = AV_CODEC_ID_V408, .init = v408_encode_init, .encode2 = v408_encode_frame, - .close = v408_encode_close, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }, }; #endif From patchwork Tue Oct 13 09:10:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22922 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:3414:0:0:0:0:0 with SMTP id b20csp1645177yba; Tue, 13 Oct 2020 02:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0zFGzQWMabYujfhXfvbgdQUxD22Yj5ogiqjl18PtceNxvJiFAaO1PMNvuEkmLfv/HtOvQ X-Received: by 2002:a1c:4e1a:: with SMTP id g26mr14637706wmh.98.1602580299501; Tue, 13 Oct 2020 02:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602580299; cv=none; d=google.com; s=arc-20160816; b=cfT38rT7ykw0HMTdSaAyTfa1oRdRdbmBg76WoxS9U/wkmg54KBzQBhWm3JPeZjGny9 14i917XBcADDLJiWdoDtDqHjguiMrtTWceHaLOiM7DpfwMmZkzWgc5ACJ/SNvZTp6iZ6 v/AJ0qdaEdC52KxXsJGT1dqjm/lZOBSOs3pOFW+YGe4S3/raqPDOfYXWPpCRfdzMmfs3 brmlNaaB7Cb+ZQCcnkSWSspdRcVvTxmsIve+k9SdlnWVuJuqUyM/8RifthKPmo/zHQPj FawMBSRw7Bghrnvn2I779IA8/mJfrvzu98RebxXBzy6mkI5a9jyGgtXlHbxPWWjMvVuR 58pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=l7wtaRd6Djt9AP6ymhxKzBDuV4gCvM/KYELYSV7Dv78=; b=jhVNf2ZLVO6BU8De/EB8ED3c14ed8WX67S4Rny847i5+9HLGCPArfJGiHFRVBHbDgC M1mc0KUO9kKZx/mesiM+zu4d1oiUWuLrrANZ4QQOfRGE6UJNc+gkBAGiQIlXPTM6Fz4A aMWLPRyx/a8SvtGlbTLhFZMF10T9wNqt9HMhgsfKtAQsffbY9LNwkRuPGcZb/3cKgnnN 3AjoJHMBTwLd+NcwuiasILJU9DmTA+JcOcGwTP2cbyWT3q4QtZUgCHc3A+WMfh2SzMi+ Q664FqoXEPNqBiQ4y6/wlk5qGepb9woer6JbNe4ZHC6iGOiwq0bJPknwYRpiZZkozCdD 0DqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=jV13ttyW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z11si17096270wrp.347.2020.10.13.02.11.39; Tue, 13 Oct 2020 02:11:39 -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=@gmail.com header.s=20161025 header.b=jV13ttyW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6834268BBC4; Tue, 13 Oct 2020 12:11:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C985D68BB54 for ; Tue, 13 Oct 2020 12:11:00 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id h7so23097103wre.4 for ; Tue, 13 Oct 2020 02:11:00 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=c2qm5RwSu5zmAZ3dPwCaG2aamd/FLnuz1a4WCeiMr6M=; b=jV13ttyWJek76cDGPVFDcuBJ36eBmeWYmHUst/t6eOcMZAsd3+/umO/Sf09moDuTUq YwpHvmpPrNbkA0ORYlacW7jkMapM5P2o68an0urvmesBJqtD1T/dM6/tA8xgAnwATfUU 2Di/xpOaZ+KZEaNqKxn41SHj9LgLR2HG8JwUotGc4c/1PDB7CBM8msBwor7TqoEtFkb7 SJ9K31fku/bdl/6bqAffzNXCX/runUVwcx21PAqYlen5h/2nPmNb1fqkksSj45RFcBvz ah0q709vAz3hR/PrUqMczk7a34p0y+Okt2Z3KGFjUPU6NqmCGSNIe+IFc23wkpxjSqUe tLOw== 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:mime-version:content-transfer-encoding; bh=c2qm5RwSu5zmAZ3dPwCaG2aamd/FLnuz1a4WCeiMr6M=; b=SbBXnGPhJ3JFwX31J/oLZTBw7mpQre6Y80R1wipCnsE09fDl+aUMNfdLh62ENAHLNY Jhb7yl9ZkDY/jtmL3tTRqda2wdc4MbZ1FbiH7YmZWh2NurD+70b5VT4UY88k09Frca6r mHfq6lMUan7TjHSb6TgQuzWPSVye+zo9Qr2zx6NSMnXDS65XvK1iBTzAxN0vGPpOkV+J SalgATKW/TSpe0V1QbaeFXAv0R/i8riQ79byqgZhOhr5GkwGIH0sIL/VcXXjEedyqR9I H0Y2Bcl7jKIJjUNOgivKFhSdmfpYc9fcTAP2wrTUZbir3/0WnKR8qauXTNY3DzMvuURA 0Spg== X-Gm-Message-State: AOAM533qgS8xlwdESlv6ipNtklT7at0wCB9LKK+KTdCJxve6O7FEWdhp X+1f6Bhvfx3tVACxfAmu1MiBHaDluw4= X-Received: by 2002:adf:ee44:: with SMTP id w4mr1922328wro.114.1602580259881; Tue, 13 Oct 2020 02:10:59 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id g83sm25913159wmf.15.2020.10.13.02.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:10:59 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 11:10:17 +0200 Message-Id: <20201013091017.1899676-9-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> References: <20201013091017.1899676-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 9/9] avcodec/ylc: Inline constants 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" X-TUID: cYVrLJ69SRsD Content-Length: 2387 Signed-off-by: Andreas Rheinhardt --- libavcodec/ylc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index 2afe3fc9d5..ecfecc0292 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -371,7 +371,7 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; if (get_bits1(&gb)) { - int val = get_vlc2(&gb, s->vlc[0].table, s->vlc[0].bits, 3); + int val = get_vlc2(&gb, s->vlc[0].table, 10, 3); if (val < 0) { return AVERROR_INVALIDDATA; } else if (val < 0xE1) { @@ -394,10 +394,10 @@ static int decode_frame(AVCodecContext *avctx, } else { int y1, y2, u, v; - y1 = get_vlc2(&gb, s->vlc[1].table, s->vlc[1].bits, 3); - u = get_vlc2(&gb, s->vlc[2].table, s->vlc[2].bits, 3); - y2 = get_vlc2(&gb, s->vlc[1].table, s->vlc[1].bits, 3); - v = get_vlc2(&gb, s->vlc[3].table, s->vlc[3].bits, 3); + y1 = get_vlc2(&gb, s->vlc[1].table, 10, 3); + u = get_vlc2(&gb, s->vlc[2].table, 10, 3); + y2 = get_vlc2(&gb, s->vlc[1].table, 10, 3); + v = get_vlc2(&gb, s->vlc[3].table, 10, 3); if (y1 < 0 || y2 < 0 || u < 0 || v < 0) return AVERROR_INVALIDDATA; dst[x ] = y1;