}
}
-static inline void idct_1d(int *blk, int step)
+static inline void idct_1d(unsigned *blk, int step)
{
- const int t0 = blk[0 * step] + blk[4 * step];
- const int t1 = blk[0 * step] - blk[4 * step];
- const int t2 = blk[2 * step] + blk[6 * step];
- const int t3 = ((int)((blk[2 * step] - blk[6 * step]) * 362U) >> 8) - t2;
- const int t4 = t0 + t2;
- const int t5 = t0 - t2;
- const int t6 = t1 + t3;
- const int t7 = t1 - t3;
- const int t8 = blk[5 * step] + blk[3 * step];
- const int t9 = blk[5 * step] - blk[3 * step];
- const int tA = blk[1 * step] + blk[7 * step];
- const int tB = blk[1 * step] - blk[7 * step];
- const int tC = t8 + tA;
- const int tD = (int)((tB + t9) * 473U) >> 8;
- const int tE = (((int)(t9 * -669U) >> 8) - tC) + tD;
- const int tF = ((int)((tA - t8) * 362U) >> 8) - tE;
- const int t10 = (((int)(tB * 277U) >> 8) - tD) + tF;
+ const unsigned t0 = blk[0 * step] + blk[4 * step];
+ const unsigned t1 = blk[0 * step] - blk[4 * step];
+ const unsigned t2 = blk[2 * step] + blk[6 * step];
+ const unsigned t3 = ((int)((blk[2 * step] - blk[6 * step]) * 362U) >> 8) - t2;
+ const unsigned t4 = t0 + t2;
+ const unsigned t5 = t0 - t2;
+ const unsigned t6 = t1 + t3;
+ const unsigned t7 = t1 - t3;
+ const unsigned t8 = blk[5 * step] + blk[3 * step];
+ const unsigned t9 = blk[5 * step] - blk[3 * step];
+ const unsigned tA = blk[1 * step] + blk[7 * step];
+ const unsigned tB = blk[1 * step] - blk[7 * step];
+ const unsigned tC = t8 + tA;
+ const unsigned tD = (int)((tB + t9) * 473U) >> 8;
+ const unsigned tE = (((int)(t9 * -669U) >> 8) - tC) + tD;
+ const unsigned tF = ((int)((tA - t8) * 362U) >> 8) - tE;
+ const unsigned t10 = (((int)(tB * 277U) >> 8) - tD) + tF;
blk[0 * step] = t4 + tC;
blk[1 * step] = t6 + tE;
static inline void idct2_1d(int *blk, int step)
{
- const int t0 = blk[0 * step];
- const int t1 = blk[1 * step];
- const int t2 = (int)(t1 * 473U) >> 8;
- const int t3 = t2 - t1;
- const int t4 = ((int)(t1 * 362U) >> 8) - t3;
- const int t5 = (((int)(t1 * 277U) >> 8) - t2) + t4;
+ const unsigned int t0 = blk[0 * step];
+ const unsigned int t1 = blk[1 * step];
+ const unsigned int t2 = (int)(t1 * 473U) >> 8;
+ const unsigned int t3 = t2 - t1;
+ const unsigned int t4 = ((int)(t1 * 362U) >> 8) - t3;
+ const unsigned int t5 = (((int)(t1 * 277U) >> 8) - t2) + t4;
blk[0 * step] = t1 + t0;
blk[1 * step] = t0 + t3;
case 1:
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = ((pfill[0] * qtab[0]) >> 5) + 128;
+ block[0] = ((int)((unsigned)pfill[0] * qtab[0]) >> 5) + 128;
s->bdsp.fill_block_tab[1](dst, block[0], linesize, 8);
break;
case 2:
memset(block, 0, sizeof(*block) * 64);
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = pfill[0] * qtab[0];
+ block[0] = (unsigned)pfill[0] * qtab[0];
block[1] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[1];
block[8] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[8];
block[9] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[9];
case 3:
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = pfill[0] * qtab[0];
+ block[0] = (unsigned)pfill[0] * qtab[0];
for (int i = 1; i < 64; i++)
block[zigzag[i]] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[zigzag[i]];
idct_put(dst, linesize, block);
case 1:
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = (pfill[0] * qtab[0]) >> 5;
+ block[0] = (int)((unsigned)pfill[0] * qtab[0]) >> 5;
update_inter_block(dst, linesize, src, in_linesize, block[0]);
break;
case 2:
memset(block, 0, sizeof(*block) * 64);
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = pfill[0] * qtab[0];
+ block[0] = (unsigned)pfill[0] * qtab[0];
block[1] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[1];
block[8] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[8];
block[9] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[9];
case 3:
fill = sign_extend(bytestream2_get_ne16(gbyte), 16);
pfill[0] += fill;
- block[0] = pfill[0] * qtab[0];
+ block[0] = (unsigned)pfill[0] * qtab[0];
for (int i = 1; i < 64; i++)
block[zigzag[i]] = sign_extend(bytestream2_get_ne16(gbyte), 16) * qtab[zigzag[i]];
idct_add(dst, linesize, src, in_linesize, block);
for (int i = 0; i < nb_codes;) {
int value = get_vlc2(gb, cbp_tab.table, cbp_tab.bits, 1);
- if (value < 0)
- return AVERROR_INVALIDDATA;
-
if (value > 0) {
int x = get_bits(gb, value);