Skip to content

Commit

Permalink
[satd] DC scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovasa committed Jun 28, 2022
1 parent 480a907 commit c16f42e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/strategies/generic/picture-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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); \
Expand All @@ -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); \
Expand Down

0 comments on commit c16f42e

Please sign in to comment.