aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/binkaudio.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-09-17 16:20:36 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-09-18 09:27:23 -0400
commitee90119e9ee0e2c54f1017bbe1460bfcd50555d0 (patch)
tree2e27c2ec3aeaab20bd369fc6a19ab83eeafe1934 /libavcodec/binkaudio.c
parent7bfd1766d1c18f07b0a2dd042418a874d49ea60d (diff)
downloadffmpeg-ee90119e9ee0e2c54f1017bbe1460bfcd50555d0.tar.gz
binkaudio: remove unneeded GET_BITS_SAFE macro
Normal get_bits() already has overread protection.
Diffstat (limited to 'libavcodec/binkaudio.c')
-rw-r--r--libavcodec/binkaudio.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index 957af79c03..af56526cca 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -158,12 +158,6 @@ static const uint8_t rle_length_tab[16] = {
2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
};
-#define GET_BITS_SAFE(out, nbits) do { \
- if (get_bits_left(gb) < nbits) \
- return AVERROR_INVALIDDATA; \
- out = get_bits(gb, nbits); \
-} while (0)
-
/**
* Decode Bink Audio block
* @param[out] out Output buffer (must contain s->block_size elements)
@@ -210,10 +204,9 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
if (s->version_b) {
j = i + 16;
} else {
- int v;
- GET_BITS_SAFE(v, 1);
+ int v = get_bits1(gb);
if (v) {
- GET_BITS_SAFE(v, 4);
+ v = get_bits(gb, 4);
j = i + rle_length_tab[v] * 8;
} else {
j = i + 8;
@@ -222,7 +215,7 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
j = FFMIN(j, s->frame_len);
- GET_BITS_SAFE(width, 4);
+ width = get_bits(gb, 4);
if (width == 0) {
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
i = j;
@@ -232,10 +225,10 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
while (i < j) {
if (s->bands[k] == i)
q = quant[k++];
- GET_BITS_SAFE(coeff, width);
+ coeff = get_bits(gb, width);
if (coeff) {
int v;
- GET_BITS_SAFE(v, 1);
+ v = get_bits1(gb);
if (v)
coeffs[i] = -q * coeff;
else