[satd] DC scaling

This commit is contained in:
Joose Sainio 2022-04-22 09:02:44 +03:00
parent 480a907c07
commit c16f42e9df

View file

@ -190,6 +190,9 @@ static int32_t hadamard_4x4_generic(int32_t diff[4*4])
for (int i = 0; i < 16; i++) {
satd += abs(d[i]);
}
satd -= abs(d[0]);
satd += abs(d[0]) >> 2;
satd = ((satd + 1) >> 1);
return satd;
@ -334,7 +337,11 @@ static unsigned satd_8x8_subblock_generic(const uvg_pixel * piOrg, const int32_t
sad += abs(((int*)m2)[i]);
}
sad -= abs(m2[0][0]);
sad += abs(m2[0][0]) >> 2;
sad = (sad + 2) >> 2;
return sad;
}
@ -375,7 +382,7 @@ static void satd_ ## n ## x ## n ## _dual_generic( \
for (y = 0; y < (n); y += 8) { \
unsigned row = y * (n); \
for (x = 0; x < (n); x += 8) { \
sum += satd_8x8_subblock_generic(&preds[0][row + x], (n), &orig[row + x], (n)); \
sum += satd_8x8_subblock_generic(&orig[row + x], (n), &preds[0][row + x], (n)); \
} \
} \
costs_out[0] = sum>>(UVG_BIT_DEPTH-8); \
@ -384,7 +391,7 @@ static void satd_ ## n ## x ## n ## _dual_generic( \
for (y = 0; y < (n); y += 8) { \
unsigned row = y * (n); \
for (x = 0; x < (n); x += 8) { \
sum += satd_8x8_subblock_generic(&preds[1][row + x], (n), &orig[row + x], (n)); \
sum += satd_8x8_subblock_generic(&orig[row + x], (n), &preds[1][row + x], (n)); \
} \
} \
costs_out[1] = sum>>(UVG_BIT_DEPTH-8); \