1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '6ebd06a9b2508747a135ee4c880d8f612e08932b'

* commit '6ebd06a9b2508747a135ee4c880d8f612e08932b':
  intrax8: Drop lots of pointless parentheses

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
Derek Buitenhuis 2016-05-07 21:40:16 +01:00
commit f2c7812839
2 changed files with 40 additions and 40 deletions

View File

@ -215,9 +215,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
if (i < 46) { // [0-45] if (i < 46) { // [0-45]
int t, l; int t, l;
if (i < 0) { if (i < 0) {
(*level) = *level =
(*final) = // prevent 'may be used unilitialized' *final = // prevent 'may be used unilitialized'
(*run) = 64; // this would cause error exit in the ac loop *run = 64; // this would cause error exit in the ac loop
return; return;
} }
@ -228,20 +228,20 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
* i == 22 r = 0 l = 3; r = i & %00000 * i == 22 r = 0 l = 3; r = i & %00000
*/ */
(*final) = *final =
t = (i > 22); t = i > 22;
i -= 23 * t; i -= 23 * t;
/* l = lut_l[i / 2] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3 }[i >> 1]; /* l = lut_l[i / 2] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3 }[i >> 1];
* 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000 */ * 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000 */
l = (0xE50000 >> (i & (0x1E))) & 3; // 0x1E or (~1) or ((i >> 1) << 1) l = (0xE50000 >> (i & 0x1E)) & 3; // 0x1E or ~1 or (i >> 1 << 1)
/* t = lut_mask[l] = { 0x0f, 0x03, 0x01, 0x00 }[l]; /* t = lut_mask[l] = { 0x0f, 0x03, 0x01, 0x00 }[l];
* as i < 256 the higher bits do not matter */ * as i < 256 the higher bits do not matter */
t = (0x01030F >> (l << 3)); t = 0x01030F >> (l << 3);
(*run) = i & t; *run = i & t;
(*level) = l; *level = l;
} else if (i < 73) { // [46-72] } else if (i < 73) { // [46-72]
uint32_t sm; uint32_t sm;
uint32_t mask; uint32_t mask;
@ -254,9 +254,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
mask = sm & 0xff; mask = sm & 0xff;
sm >>= 8; // 1bit sm >>= 8; // 1bit
(*run) = (sm & 0xff) + (e & (mask)); // 6bits *run = (sm & 0xff) + (e & mask); // 6bits
(*level) = (sm >> 8) + (e & (~mask)); // 5bits *level = (sm >> 8) + (e & ~mask); // 5bits
(*final) = i > (58 - 46); *final = i > (58 - 46);
} else if (i < 75) { // [73-74] } else if (i < 75) { // [73-74]
static const uint8_t crazy_mix_runlevel[32] = { static const uint8_t crazy_mix_runlevel[32] = {
0x22, 0x32, 0x33, 0x53, 0x23, 0x42, 0x43, 0x63, 0x22, 0x32, 0x33, 0x53, 0x23, 0x42, 0x43, 0x63,
@ -265,14 +265,14 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
0x28, 0x92, 0x36, 0x74, 0x29, 0xa2, 0x46, 0x84, 0x28, 0x92, 0x36, 0x74, 0x29, 0xa2, 0x46, 0x84,
}; };
(*final) = !(i & 1); *final = !(i & 1);
e = get_bits(w->gb, 5); // get the extra bits e = get_bits(w->gb, 5); // get the extra bits
(*run) = crazy_mix_runlevel[e] >> 4; *run = crazy_mix_runlevel[e] >> 4;
(*level) = crazy_mix_runlevel[e] & 0x0F; *level = crazy_mix_runlevel[e] & 0x0F;
} else { } else {
(*level) = get_bits(w->gb, 7 - 3 * (i & 1)); *level = get_bits(w->gb, 7 - 3 * (i & 1));
(*run) = get_bits(w->gb, 6); *run = get_bits(w->gb, 6);
(*final) = get_bits1(w->gb); *final = get_bits1(w->gb);
} }
return; return;
} }
@ -299,12 +299,12 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
i = get_vlc2(w->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD); i = get_vlc2(w->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
/* (i >= 17) { i -= 17; final =1; } */ /* (i >= 17) { i -= 17; final =1; } */
c = i > 16; c = i > 16;
(*final) = c; *final = c;
i -= 17 * c; i -= 17 * c;
if (i <= 0) { if (i <= 0) {
(*level) = 0; *level = 0;
return -i; return -i;
} }
c = (i + 1) >> 1; // hackish way to calculate dc_extra_sbits[] c = (i + 1) >> 1; // hackish way to calculate dc_extra_sbits[]
@ -313,8 +313,8 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
e = get_bits(w->gb, c); // get the extra bits e = get_bits(w->gb, c); // get the extra bits
i = dc_index_offset[i] + (e >> 1); i = dc_index_offset[i] + (e >> 1);
e = -(e & 1); // 0, 0xffffff e = -(e & 1); // 0, 0xffffff
(*level) = (i ^ e) - e; // (i ^ 0) -0 , (i ^ 0xff) - (-1) *level = (i ^ e) - e; // (i ^ 0) - 0, (i ^ 0xff) - (-1)
return 0; return 0;
} }
@ -345,7 +345,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const w, const int chroma)
w->flat_dc = 1; w->flat_dc = 1;
sum += 9; sum += 9;
// ((1 << 17) + 9) / (8 + 8 + 1 + 2) = 6899 // ((1 << 17) + 9) / (8 + 8 + 1 + 2) = 6899
w->predicted_dc = (sum * 6899) >> 17; w->predicted_dc = sum * 6899 >> 17;
} }
} }
if (chroma) if (chroma)
@ -390,8 +390,8 @@ static void x8_update_predictions(IntraX8Context *const w, const int orient,
static void x8_get_prediction_chroma(IntraX8Context *const w) static void x8_get_prediction_chroma(IntraX8Context *const w)
{ {
w->edges = 1 * (!(w->mb_x >> 1)); w->edges = 1 * !(w->mb_x >> 1);
w->edges |= 2 * (!(w->mb_y >> 1)); w->edges |= 2 * !(w->mb_y >> 1);
w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1)); // mb_x for chroma would always be odd w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1)); // mb_x for chroma would always be odd
w->raw_orient = 0; w->raw_orient = 0;
@ -408,8 +408,8 @@ static void x8_get_prediction(IntraX8Context *const w)
{ {
int a, b, c, i; int a, b, c, i;
w->edges = 1 * (!w->mb_x); w->edges = 1 * !w->mb_x;
w->edges |= 2 * (!w->mb_y); w->edges |= 2 * !w->mb_y;
w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1)); w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1));
switch (w->edges & 3) { switch (w->edges & 3) {
@ -659,7 +659,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
goto block_placed; goto block_placed;
} }
zeros_only = (dc_level == 0); zeros_only = dc_level == 0;
} }
if (!chroma) if (!chroma)
w->block[0][0] = dc_level * w->quant; w->block[0][0] = dc_level * w->quant;
@ -720,10 +720,10 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
w->dest[1] = frame->data[1]; w->dest[1] = frame->data[1];
w->dest[2] = frame->data[2]; w->dest[2] = frame->data[2];
w->dest[0] += w->mb_y * linesize << 3; w->dest[0] += w->mb_y * linesize << 3;
// chroma blocks are on add rows // chroma blocks are on add rows
w->dest[1] += (w->mb_y & (~1)) * uvlinesize << 2; w->dest[1] += (w->mb_y & ~1) * uvlinesize << 2;
w->dest[2] += (w->mb_y & (~1)) * uvlinesize << 2; w->dest[2] += (w->mb_y & ~1) * uvlinesize << 2;
} }
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, av_cold int ff_intrax8_common_init(AVCodecContext *avctx,

View File

@ -91,7 +91,7 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
c = *(ptr - 1); // area1, same mb as area2, no need to check c = *(ptr - 1); // area1, same mb as area2, no need to check
dst[area1 + i] = c; dst[area1 + i] = c;
c = *(ptr); c = *ptr;
sum += c; sum += c;
min_pix = FFMIN(min_pix, c); min_pix = FFMIN(min_pix, c);
@ -136,9 +136,9 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
sum += c; sum += c;
// edge pixel is not part of min/max // edge pixel is not part of min/max
} }
(*range) = max_pix - min_pix; *range = max_pix - min_pix;
sum += *(dst + area5) + *(dst + area5 + 1); sum += *(dst + area5) + *(dst + area5 + 1);
*psum = sum; *psum = sum;
} }
static const uint16_t zero_prediction_weights[64 * 2] = { static const uint16_t zero_prediction_weights[64 * 2] = {
@ -419,7 +419,7 @@ static void x8_loop_filter(uint8_t *ptr, const int a_stride, const int b_stride,
m = (m ^ sign) - sign; // abs(m) m = (m ^ sign) - sign; // abs(m)
m >>= 1; m >>= 1;
x = (5 * x) >> 3; x = 5 * x >> 3;
if (x > m) if (x > m)
x = m; x = m;