LibGfx/JPEGWriter: Rename y<=>x, u<=>v

Usually x and u go horizontally and y and v go vertically.

No behavior change.
This commit is contained in:
Nico Weber 2024-01-26 19:44:38 -05:00 committed by Sam Atkins
parent 08a3c562f3
commit 494fc1234e

View file

@ -162,19 +162,19 @@ public:
auto const sum_xy = [&](u8 u, u8 v) {
double sum {};
for (u8 x {}; x < 8; ++x) {
for (u8 y {}; y < 8; ++y)
sum += component[x * 8 + y] * cosine_table[u * 8 + x] * cosine_table[v * 8 + y];
for (u8 y {}; y < 8; ++y) {
for (u8 x {}; x < 8; ++x)
sum += component[y * 8 + x] * cosine_table[u * 8 + x] * cosine_table[v * 8 + y];
}
return sum;
};
for (u8 u {}; u < 8; ++u) {
double const cu = u == 0 ? inverse_sqrt_2 : 1;
for (u8 v {}; v < 8; ++v) {
auto const table_index = u * 8 + v;
for (u8 v {}; v < 8; ++v) {
double const cv = v == 0 ? inverse_sqrt_2 : 1;
for (u8 u {}; u < 8; ++u) {
auto const table_index = v * 8 + u;
double const cv = v == 0 ? inverse_sqrt_2 : 1;
double const cu = u == 0 ? inverse_sqrt_2 : 1;
// A.3.3 - FDCT and IDCT
double const fdct = cu * cv * sum_xy(u, v) / 4;