aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-06-20 01:45:11 +0200
committerJames Almer <jamrial@gmail.com>2019-12-31 16:57:37 -0300
commitfd53f6745e1fd0741f5d9d3aa7d5484cfd98f8ed (patch)
tree5e702bacf6cf1167adad01d78ef8b882803becaf
parent4bc84f4f7deb12190998d898c84b7cbc5002ce8c (diff)
downloadffmpeg-fd53f6745e1fd0741f5d9d3aa7d5484cfd98f8ed.tar.gz
cbs: Remove useless initializations
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 <andreas.rheinhardt@gmail.com> (cherry picked from commit b71a0367a6e763d631b8dcd608f98d42c05fa57c)
-rw-r--r--libavcodec/cbs_av1.c14
-rw-r--r--libavcodec/cbs_h2645.c8
-rw-r--r--libavcodec/cbs_jpeg.c2
-rw-r--r--libavcodec/cbs_mpeg2.c2
-rw-r--r--libavcodec/cbs_vp9.c8
5 files changed, 17 insertions, 17 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index ffb68adcd3..472f21ea46 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 e272b0bcf6..1964ccf766 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -289,28 +289,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 faa8301d4f..95d2344bb0 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 5a7e105177..a1ccd76b58 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 fa42d17982..7bfbd36df1 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)