From patchwork Fri Nov 20 07:18:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23772 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 76FE9449F1B for ; Fri, 20 Nov 2020 09:28:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A114A68BA41; Fri, 20 Nov 2020 09:24:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4120168B9B8 for ; Fri, 20 Nov 2020 09:24:33 +0200 (EET) Received: by mail-ej1-f66.google.com with SMTP id lv15so5640555ejb.12 for ; Thu, 19 Nov 2020 23:24:33 -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=WDceH3BvzNWQRv6j0OzYBfD5y7uy3TDo/v+9lN2Nfc8=; b=GFue9nN3f23tbSqpr8981HE1eRVsmoRzlRRtXZ9OfWak35OF1lck5xg0LIyPUhU4nW D2eRT0EXkTBRdWQWgrWHu4NSSAeaRehnF2REdCol65JmVlI+8FlRQJnO8oifK0e6kz3C ilNUcOf/wg4VjS/Grh5YvHJt8qvbZnI6hDxuTr9Qa8UEAs4l8b568+LUx9BADdv+eEft nN7N76ME2gfM/flHfkCgVgeEin8AiRUABoNmSZ2v3Wwpj+4hIewyWKgrCko1LHtCboAU v8vhQm7bKpY5ufF3GzkjE+Q1wE+0auCF1VrZB5W4V6Fu6mSItF76pgYRsTtV8GJjaY09 qvpA== 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=WDceH3BvzNWQRv6j0OzYBfD5y7uy3TDo/v+9lN2Nfc8=; b=fUpjhomqYYHO7W3W9SRHeVVezIkELBLFpc1eRiOY4B/W/PVXXIFADoRTHgPZD+JNOp Y4iBWG+DAjCwj0WjLOplYyoQCydbRH/nrPx9sLtGTgP0ct6Oi5ORzBjQ9BEj5lBrMlQh tSfUJ5KuN61EK6PU6rroM7tzY3f0mQWWcp++tjsOu8MUa6dFBQHQFfsPbVau2bHONCwz F5ZNcd0QK1+j/iotruD7VcbHdSIOWkQgWpqPhAiNLq4x7Wg8cRwsvs+IcSDUYWHt0A/k NRMl/3bKej25S+HNWlmoLq7c1T/IH/khsrqcMLZ6hSjmqJNK96Z6M8A6L0g4wWCHISbY e6WQ== X-Gm-Message-State: AOAM532GXjjIF+76jKD/1vVhFTKwDXEFm/SUiRv+lzUUFvu12vyGI4dl s5BApy49AKhDAv8jPWmoT037nRrnrN555g== X-Google-Smtp-Source: ABdhPJwD07sWts8iQOwHPt8+enhVtqaYVgYld1xeDlAhfbTIvplMcU4+6m4i4yr2TPWjTqS3zAippQ== X-Received: by 2002:a17:907:11d9:: with SMTP id va25mr13254138ejb.431.1605857072398; Thu, 19 Nov 2020 23:24:32 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id lz27sm779419ejb.39.2020.11.19.23.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:24:31 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:18:56 +0100 Message-Id: <20201120072116.818090-24-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> References: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 023/162] avcodec/wnv1: Make array for initializing VLC smaller 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" This is possible by switching to ff_init_vlc_from_lengths() which allows to replace the table for the codes (which need an uint16_t) by a table of symbols which fit into an uint8_t. Also switch to an ordinary INIT_VLC macro while just at it. Signed-off-by: Andreas Rheinhardt --- libavcodec/wnv1.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index b5cd0f0f0c..f8a9b94746 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -29,11 +29,10 @@ #include "get_bits.h" #include "internal.h" - -static const uint16_t code_tab[16][2] = { - { 0x17F, 9 }, { 0xBF, 8 }, { 0x5F, 7 }, { 0x2F, 6 }, { 0x17, 5 }, { 0x0B, 4 }, { 0x005, 3 }, - { 0x000, 1 }, - { 0x01, 3 }, { 0x03, 4 }, { 0x07, 5 }, { 0x0F, 6 }, { 0x1F, 7 }, { 0x3F, 8 }, { 0x07F, 9 }, { 0xFF, 8 } +static const uint8_t code_tab[16][2] = { + { 7, 1 }, { 8, 3 }, { 6, 3 }, { 9, 4 }, { 5, 4 }, { 10, 5 }, { 4, 5 }, + { 11, 6 }, { 3, 6 }, { 12, 7 }, { 2, 7 }, { 13, 8 }, { 1, 8 }, { 14, 9 }, + { 0, 9 }, { 15, 8 } }; #define CODE_VLC_BITS 9 @@ -115,16 +114,12 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx) { - static VLC_TYPE code_table[1 << CODE_VLC_BITS][2]; - avctx->pix_fmt = AV_PIX_FMT_YUV422P; - code_vlc.table = code_table; - code_vlc.table_allocated = 1 << CODE_VLC_BITS; - init_vlc(&code_vlc, CODE_VLC_BITS, 16, - &code_tab[0][1], 4, 2, - &code_tab[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); - + INIT_VLC_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16, + &code_tab[0][1], 2, + &code_tab[0][0], 2, 1, + 0, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS); return 0; }