From patchwork Fri Nov 20 07:19: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: 23947 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:c00a:0:0:0:0:0 with SMTP id c10csp952794ybf; Thu, 19 Nov 2020 23:32:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrNzDWoFk3baV9TjU6extzmJg+HQlNgQ6cqS2wGfAd2HC/yno4hYGGDpNIzg2esoxOYFpW X-Received: by 2002:adf:c3c8:: with SMTP id d8mr14246879wrg.366.1605857539500; Thu, 19 Nov 2020 23:32:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605857539; cv=none; d=google.com; s=arc-20160816; b=qkFoSm0O3WXVN33K3B7zTwF0ob6kZp91/b/OPg1lfg6fOjHpx8WNBk2NkEQqDJJcSA 0EYfEZ8LYFyns3oTJoovrVtm1bVoI3bK6ylrQBsPHvsGUGhM+GzyNJQvCziW77U15q4N 3iEkRiW1ZlJnzireJuPW2p4JMppxGvbL6OL/VJT4Hc3kdrE3LDx94rrKmCqok+I5/UR3 lo+jtCJVkggBZ16+IeHyYXnYYBbp9GUXopj5c6I55d4RLShLQab9Unkv2ZEgrbfN72bV YWQsD+EYxw4dy47dK++qv4V1fqTyeqqs8FbOET/2I+2FvmMvYb6DZoGnItO4X/+TD8e+ jkvA== 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=SHNTlb7uR8zzLd17qvNyn6s2IXzYoJF+Or2n6dB7z14=; b=Bg01tMDQXUu3ceaFU24vI6gpq/7w8V4t2Dp0u/jb2hiT2998h2MzJsBF0MXdHGyTri TEg+BqXFB5vAvP/WRfScQ7Aa3H2fzrVzEU+TpbF6PizTBotywnd2IUbssU9TahUYlrA+ g9/v/JVLc+BAbZUiKMblEMyebL8zJ65gSzbVoQ8vHeeBKkCMzAN7rdODz7PVe8a9VCb7 90gZxAJrsll4zMsUxEJDqVTGMWJEe+sbznX3b2MCtNfUr04XQ2pw+oe6q0wZtLdIHP7C ZnlYNyCbDiEseemK2CfS4fw+Ki6JP723Z5a5Bs8MZCmCi4tp3AEl7AzVYg8TxTARubCR xN1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cngTFlKI; 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 22si213507wmo.200.2020.11.19.23.32.19; Thu, 19 Nov 2020 23:32:19 -0800 (PST) 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=cngTFlKI; 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 94FB468BAD0; Fri, 20 Nov 2020 09:25:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6B12B68BACF for ; Fri, 20 Nov 2020 09:24:54 +0200 (EET) Received: by mail-ed1-f68.google.com with SMTP id k4so8505770edl.0 for ; Thu, 19 Nov 2020 23:24:54 -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=UeqgSPKZskcNQGrngNAXnbSNdEWUtcJxlHQ9bDFmTLI=; b=cngTFlKIvJ7ke291WKzdJcHr9G3gAoVL3o4nCVNWUq0MrdJQez0VJJYdljpbnNenCv CcB/K0bXb3ePxgQ4+tQ9/x6ePVREPRcf77EBOUNwFGomA7hWLy6svOvs3V9t9GRfRdxh 5nVd6iPj/dCdNX+3zXebXmjoJT8KLZSUHgABzJ40wkzhxodLOH9ZxpcxAApP1BZfP9y5 FWDTEUe0BShs1UKj0oo+er6apDVeOF4/foU8swRJxRPhhxDvNIZRbaa/0q9I7locvQVo F3B5ar9tdUPHjhefa/up9+bgRCNwJDNZbQQCZGDqnBlCPMVLTqWwAYPqYaJkalHtO3k0 qt4g== 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=UeqgSPKZskcNQGrngNAXnbSNdEWUtcJxlHQ9bDFmTLI=; b=iqeZ6UJ16rEaJWvLlMTJ2FpANKWbX+by7rBOsD26ItGRWTAhQ0oc42hQgIxzkL2Tvs euB9UzN7+7YPp3hrZd+23jh/UdaHgRA4m/yAPArx0lcILTrH89cH0uf4rznIPUs4K/EK SufDXjp1hmD1R4dU5FF6LfF8KGoO3uOpjOC4lX6dwIqsTlXwKLgSqUf1qrJl0FpEjkgG wps4+Ar+EVSG+doQ1JsfpzUa/M+Lcyt6tXVpzWUxOsQghcXUdgiXJ75OGNiCvW08Z+P1 8YQmUvdzeNEs12XH8aGSUNmrYYn4aQvIh3gNvvqQv91ZJo1hDdG6SACNjKaNAc4/2XWb yDKw== X-Gm-Message-State: AOAM530Jwozsz+j0h9ICulH78R3HBWUlyaBSEK/C9bzgdHMto44s74wJ TmayE1W1SUb5Rj1TLVxyDi4wjt8rgIOAHg== X-Received: by 2002:a05:6402:1284:: with SMTP id w4mr9831530edv.324.1605857093657; Thu, 19 Nov 2020 23:24:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:24:53 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:19:16 +0100 Message-Id: <20201120072116.818090-44-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 043/162] avcodec/motionpixels: Use symbols table 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: c4hVGNIA0U6h Content-Length: 2728 If allows us to directly store the deltas in the VLC table and therefore avoids a level of indirection. Signed-off-by: Andreas Rheinhardt --- libavcodec/motionpixels.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index a65250efe5..927f9fdc14 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -192,10 +192,8 @@ static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const Yuv static av_always_inline int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb) { - int i; - - i = (mp->codes_count == 1) ? 0 : get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1); - return mp->codes[i].delta; + return mp->vlc.table ? get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1) + : mp->codes[0].delta; } static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y) @@ -322,9 +320,14 @@ static int mp_decode_frame(AVCodecContext *avctx, if (sz == 0) goto end; - if (mp->codes_count > 1) - if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0)) - goto end; + if (mp->codes_count > 1) { + ret = ff_init_vlc_sparse(&mp->vlc, mp->max_codes_bits, mp->codes_count, + &mp->codes[0].size, sizeof(HuffCode), 1, + &mp->codes[0].code, sizeof(HuffCode), 4, + &mp->codes[0].delta, sizeof(HuffCode), 1, 0); + if (ret < 0) + goto end; + } mp_decode_frame_helper(mp, &gb); ff_free_vlc(&mp->vlc);