From patchwork Wed Jun 19 23:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13628 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 A77F9448AA5 for ; Thu, 20 Jun 2019 02:55:52 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8902F68AB72; Thu, 20 Jun 2019 02:55:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C304268AB25 for ; Thu, 20 Jun 2019 02:55:44 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id u8so1256304wmm.1 for ; Wed, 19 Jun 2019 16:55:44 -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=lZANIsXtcdY9XebHU7WuB8cCgFO+d/4KFpszVRzJAak=; b=p688j0Vm4fhtTVbPJdITQtXvK9cWn7Yxq1sZCLAI1oz0Zt/jFNEKA2H56iWtiiYepH lzw+flo4nH9EQBJzC6ZQKeEIeKxQ07KoTb6Brv5xOyUcUu36gPi2NzLmmaIXzkn/CUgX RTxD3VzLr6nQdUJA5XDaSxhzNX7vtDNm0tiJAhjcDNR01w8/wYD859yD/jzkTFnIaKo3 jrJwKNhph/7GbUx+M7lgMVGo2k8YWfqifsWeaTtH+uGz4VF73GudhrEkyeQC3qb3H4nW DkGVO6eR6yrloK8Ln65GxXq3lplo6aiL40mTnb6RCsSfuWIpk2ncvepttFlebIviUC5r KxKA== 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=lZANIsXtcdY9XebHU7WuB8cCgFO+d/4KFpszVRzJAak=; b=J0eQhS5Fa+hjym7pXDLmqucpRZQqrxjYlYpt9BqEaG/MQqKyHkXRzDiOFYfcSenje6 F7l7xXzqaCB+felrtztQozpv5HcuoHwmfscVQp5J+CFLSBhXsABN60wLunGFZZUQ3dXm 2umcaAduGYBeLvcii/sZdAiqEvVzyQZiqj9IS9Fy8fTkdE8zs+iwWRI/ESvKCD7jsk/k /KEc298zpB2bTxlo2+teTHP7yfEu99+ne069Iu3O2F74xJEsqA/B8jeC/qSI3QReZAjp hS2TZ10jvy65Lb8lLL3e52td6MtJzmdlqi4W00K1CL6kldd3whHsOaJPTL6e5h8DSHGa Um2w== X-Gm-Message-State: APjAAAVAafk69vaO2iZ1/m5r4uNy6rSVnkrR250D03xLaE45BzYjZVEH MO38Ax6bNCS5kHfMQ8qoXFnQen/N X-Google-Smtp-Source: APXvYqz1q1XkXhlBPku9iP33BJUwW9Yv+cB04j6IjoVYJPdzNXb5wx5UC4bALygCg5dinWWFVGyvwA== X-Received: by 2002:a1c:e108:: with SMTP id y8mr9809212wmg.65.1560988544073; Wed, 19 Jun 2019 16:55:44 -0700 (PDT) Received: from localhost.localdomain (ipbcc063db.dynamic.kabel-deutschland.de. [188.192.99.219]) by smtp.gmail.com with ESMTPSA id t63sm2758989wmt.6.2019.06.19.16.55.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 16:55:43 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 20 Jun 2019 01:45:11 +0200 Message-Id: <20190619234521.15619-13-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190619234521.15619-1-andreas.rheinhardt@gmail.com> References: <20190617034223.21195-1-andreas.rheinhardt@gmail.com> <20190619234521.15619-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 21/31] cbs: Remove useless initializations 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, a temporary variable was used and initialized every time a value was read in CBS; if reading turned out to be successfull, this value was overwritten (without having ever been looked at) with the value read if reading was successfull; on failure the variable wasn't touched either. Therefore these initializations can be and have been removed. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_av1.c | 14 +++++++------- libavcodec/cbs_h2645.c | 8 ++++---- libavcodec/cbs_jpeg.c | 2 +- libavcodec/cbs_mpeg2.c | 2 +- libavcodec/cbs_vp9.c | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index eb6b801790..288ef8e14b 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -574,7 +574,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) #define RWContext GetBitContext #define xf(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value = range_min; \ + uint32_t value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ @@ -582,7 +582,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) } while (0) #define xsu(width, name, var, subs, ...) do { \ - int32_t value = 0; \ + int32_t value; \ CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), &value, \ MIN_INT_BITS(width), \ @@ -591,27 +591,27 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) } while (0) #define uvlc(name, range_min, range_max) do { \ - uint32_t value = range_min; \ + uint32_t value; \ CHECK(cbs_av1_read_uvlc(ctx, rw, #name, \ &value, range_min, range_max)); \ current->name = value; \ } while (0) #define ns(max_value, name, subs, ...) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(cbs_av1_read_ns(ctx, rw, max_value, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), &value)); \ current->name = value; \ } while (0) #define increment(name, min, max) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(cbs_av1_read_increment(ctx, rw, min, max, #name, &value)); \ current->name = value; \ } while (0) #define subexp(name, max, subs, ...) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(cbs_av1_read_subexp(ctx, rw, max, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), &value)); \ current->name = value; \ @@ -629,7 +629,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) } while (0) #define leb128(name) do { \ - uint64_t value = 0; \ + uint64_t value; \ CHECK(cbs_av1_read_leb128(ctx, rw, #name, &value)); \ current->name = value; \ } while (0) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 117e13e0c7..125f9146c6 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -290,28 +290,28 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, #define RWContext GetBitContext #define xu(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value = range_min; \ + uint32_t value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ var = value; \ } while (0) #define xue(name, var, range_min, range_max, subs, ...) do { \ - uint32_t value = range_min; \ + uint32_t value; \ CHECK(cbs_read_ue_golomb(ctx, rw, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ var = value; \ } while (0) #define xi(width, name, var, range_min, range_max, subs, ...) do { \ - int32_t value = range_min; \ + int32_t value; \ CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ var = value; \ } while (0) #define xse(name, var, range_min, range_max, subs, ...) do { \ - int32_t value = range_min; \ + int32_t value; \ CHECK(cbs_read_se_golomb(ctx, rw, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 83857bbba2..c46abd0a45 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -45,7 +45,7 @@ #define FUNC(name) cbs_jpeg_read_ ## name #define xu(width, name, range_min, range_max, subs, ...) do { \ - uint32_t value = range_min; \ + uint32_t value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index ac2a7b0b1a..2466f569f6 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -57,7 +57,7 @@ #define RWContext GetBitContext #define xui(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index 5579d9b0af..7102bb87d3 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -267,14 +267,14 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, #define RWContext GetBitContext #define xf(width, name, var, subs, ...) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, 0, (1 << width) - 1)); \ var = value; \ } while (0) #define xs(width, name, var, subs, ...) do { \ - int32_t value = 0; \ + int32_t value; \ CHECK(cbs_vp9_read_s(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), &value)); \ var = value; \ @@ -282,7 +282,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, #define increment(name, min, max) do { \ - uint32_t value = 0; \ + uint32_t value; \ CHECK(cbs_vp9_read_increment(ctx, rw, min, max, #name, &value)); \ current->name = value; \ } while (0) @@ -315,7 +315,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, } while (0) #define fixed(width, name, value) do { \ - av_unused uint32_t fixed_value = value; \ + av_unused uint32_t fixed_value; \ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ 0, &fixed_value, value, value)); \ } while (0)