You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
binkvideo: simplify and remove invalid shifts
Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
@@ -595,7 +595,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
|
|||||||
{
|
{
|
||||||
int coef_list[128];
|
int coef_list[128];
|
||||||
int mode_list[128];
|
int mode_list[128];
|
||||||
int i, t, mask, bits, ccoef, mode, sign;
|
int i, t, bits, ccoef, mode, sign;
|
||||||
int list_start = 64, list_end = 64, list_pos;
|
int list_start = 64, list_end = 64, list_pos;
|
||||||
int coef_count = 0;
|
int coef_count = 0;
|
||||||
int coef_idx[64];
|
int coef_idx[64];
|
||||||
@@ -609,8 +609,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
|
|||||||
coef_list[list_end] = 2; mode_list[list_end++] = 3;
|
coef_list[list_end] = 2; mode_list[list_end++] = 3;
|
||||||
coef_list[list_end] = 3; mode_list[list_end++] = 3;
|
coef_list[list_end] = 3; mode_list[list_end++] = 3;
|
||||||
|
|
||||||
bits = get_bits(gb, 4) - 1;
|
for (bits = get_bits(gb, 4) - 1; bits >= 0; bits--) {
|
||||||
for (mask = 1 << bits; bits >= 0; mask >>= 1, bits--) {
|
|
||||||
list_pos = list_start;
|
list_pos = list_start;
|
||||||
while (list_pos < list_end) {
|
while (list_pos < list_end) {
|
||||||
if (!(mode_list[list_pos] | coef_list[list_pos]) || !get_bits1(gb)) {
|
if (!(mode_list[list_pos] | coef_list[list_pos]) || !get_bits1(gb)) {
|
||||||
@@ -636,7 +635,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
|
|||||||
if (!bits) {
|
if (!bits) {
|
||||||
t = 1 - (get_bits1(gb) << 1);
|
t = 1 - (get_bits1(gb) << 1);
|
||||||
} else {
|
} else {
|
||||||
t = get_bits(gb, bits) | mask;
|
t = get_bits(gb, bits) | 1 << bits;
|
||||||
sign = -get_bits1(gb);
|
sign = -get_bits1(gb);
|
||||||
t = (t ^ sign) - sign;
|
t = (t ^ sign) - sign;
|
||||||
}
|
}
|
||||||
@@ -657,7 +656,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
|
|||||||
if (!bits) {
|
if (!bits) {
|
||||||
t = 1 - (get_bits1(gb) << 1);
|
t = 1 - (get_bits1(gb) << 1);
|
||||||
} else {
|
} else {
|
||||||
t = get_bits(gb, bits) | mask;
|
t = get_bits(gb, bits) | 1 << bits;
|
||||||
sign = -get_bits1(gb);
|
sign = -get_bits1(gb);
|
||||||
t = (t ^ sign) - sign;
|
t = (t ^ sign) - sign;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user