Commit d3a9cb6b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/prosumer: Factorize the 2 loops in fill_elements()

Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent f24701b0
...@@ -282,29 +282,24 @@ static void fill_elements(uint32_t idx, uint32_t shift, int size, uint32_t *e0, ...@@ -282,29 +282,24 @@ static void fill_elements(uint32_t idx, uint32_t shift, int size, uint32_t *e0,
{ {
uint32_t b, h = idx << (32 - shift); uint32_t b, h = idx << (32 - shift);
for (int i = 0; i < size; i++) { for (int j = 0; j < 2; j++) {
b = 4 * (table[2 * i + 1] & 0xF); for (int i = 0; i < size; i++) {
if (shift >= b && (h & (0xFFF00000u << (12 - b))) == (table[2 * i + 1] & 0xFFFF0000u)) { b = 4 * (table[2 * i + 1] & 0xF);
if (table[2 * i] >> 8 == 0x80u) { if (shift >= b && (h & (0xFFF00000u << (12 - b))) == (table[2 * i + 1] & 0xFFFF0000u)) {
return; if (table[2 * i] >> 8 == 0x80u) {
} else { return;
*e1 = table[2 * i]; } else {
*e0 = (*e0 & 0xFFFFFFu) | (((12 + b - shift) & 0xFFFFFFFCu | 0x40u) << 22); if (j == 0) {
shift -= b; *e1 = table[2 * i];
h <<= b; *e0 = (*e0 & 0xFFFFFFu) | (((12 + b - shift) & 0xFFFFFFFCu | 0x40u) << 22);
break; shift -= b;
} h <<= b;
} } else {
} *e1 |= table[2 * i] << 16;
for (int i = 0; i < size; i++) { *e0 = (*e0 & 0xFFFFFFu) | (((12 + b - shift) & 0xFFFFFFFCu | 0x80u) << 22);
b = 4 * (table[2 * i + 1] & 0xF); }
if (shift >= b && (h & (0xFFF00000u << (12 - b))) == (table[2 * i + 1] & 0xFFFF0000u)) { break;
if (table[2 * i] >> 8 == 0x80u) { }
return;
} else {
*e1 |= table[2 * i] << 16;
*e0 = (*e0 & 0xFFFFFFu) | (((12 + b - shift) & 0xFFFFFFFCu | 0x80u) << 22);
break;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment