From b820f9ffbd7ee372b5e29c10cbc52a9c2bbf3633 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 5 Mar 2023 15:05:22 -0500 Subject: [PATCH] LibGfx/JPEG: Rename `mb_index` to `macroblock_index` --- .../LibGfx/ImageFormats/JPEGLoader.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp index 1487f67273..24ff773710 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp @@ -434,8 +434,8 @@ static ErrorOr add_ac(JPEGLoadingContext& context, Macroblock& macroblock, * we're building in the macroblock matrix. `vfactor_i` and `hfactor_i` are cursors * that iterate over the vertical and horizontal subsampling factors, respectively. * When we finish one iteration of the innermost loop, we'll have the coefficients - * of one of the components of block at position `mb_index`. When the outermost loop - * finishes first iteration, we'll have all the luminance coefficients for all the + * of one of the components of block at position `macroblock_index`. When the outermost + * loop finishes first iteration, we'll have all the luminance coefficients for all the * macroblocks that share the chrominance data. Next two iterations (assuming that * we are dealing with three components) will fill up the blocks with chroma data. */ @@ -445,9 +445,9 @@ static ErrorOr build_macroblocks(JPEGLoadingContext& context, Vector 0) { @@ -455,7 +455,7 @@ static ErrorOr build_macroblocks(JPEGLoadingContext& context, Vector& macroblo u32 const* table = component.qtable_id == 0 ? context.luma_table : context.chroma_table; for (u32 vfactor_i = 0; vfactor_i < component.vsample_factor; vfactor_i++) { for (u32 hfactor_i = 0; hfactor_i < component.hsample_factor; hfactor_i++) { - u32 mb_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor); - Macroblock& block = macroblocks[mb_index]; + u32 macroblock_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor); + Macroblock& block = macroblocks[macroblock_index]; int* block_component = get_component(block, i); for (u32 k = 0; k < 64; k++) block_component[k] *= table[k]; @@ -1078,8 +1078,8 @@ static void inverse_dct(JPEGLoadingContext const& context, Vector& m auto& component = context.components[component_i]; for (u8 vfactor_i = 0; vfactor_i < component.vsample_factor; vfactor_i++) { for (u8 hfactor_i = 0; hfactor_i < component.hsample_factor; hfactor_i++) { - u32 mb_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor); - Macroblock& block = macroblocks[mb_index]; + u32 macroblock_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor); + Macroblock& block = macroblocks[macroblock_index]; i32* block_component = get_component(block, component_i); for (u32 k = 0; k < 8; ++k) { float const g0 = block_component[0 * 8 + k] * s0; @@ -1231,10 +1231,10 @@ static void ycbcr_to_rgb(JPEGLoadingContext const& context, Vector& // Overflows are intentional. for (u8 vfactor_i = context.vsample_factor - 1; vfactor_i < context.vsample_factor; --vfactor_i) { for (u8 hfactor_i = context.hsample_factor - 1; hfactor_i < context.hsample_factor; --hfactor_i) { - u32 mb_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hcursor + hfactor_i); - i32* y = macroblocks[mb_index].y; - i32* cb = macroblocks[mb_index].cb; - i32* cr = macroblocks[mb_index].cr; + u32 macroblock_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hcursor + hfactor_i); + i32* y = macroblocks[macroblock_index].y; + i32* cb = macroblocks[macroblock_index].cb; + i32* cr = macroblocks[macroblock_index].cr; for (u8 i = 7; i < 8; --i) { for (u8 j = 7; j < 8; --j) { const u8 pixel = i * 8 + j;