1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

LibGfx: Move JPGLoader to a more regular JPG_DEBUG macro as used elsewhere

This commit is contained in:
Nico Weber 2020-11-19 11:51:33 -05:00 committed by Andreas Kling
parent 812892ef86
commit 3749e167b4

View file

@ -35,10 +35,7 @@
#include <LibGfx/JPGLoader.h> #include <LibGfx/JPGLoader.h>
#include <math.h> #include <math.h>
#define JPG_DBG 0 //#define JPG_DEBUG
#define jpg_dbg(x) \
if (JPG_DBG) \
dbg() << x
#define JPG_INVALID 0X0000 #define JPG_INVALID 0X0000
@ -378,10 +375,12 @@ static Optional<Vector<Macroblock>> decode_huffman_stream(JPGLoadingContext& con
Vector<Macroblock> macroblocks; Vector<Macroblock> macroblocks;
macroblocks.resize(context.mblock_meta.padded_total); macroblocks.resize(context.mblock_meta.padded_total);
jpg_dbg("Image width: " << context.frame.width); #ifdef JPG_DEBUG
jpg_dbg("Image height: " << context.frame.height); dbg() << "Image width: " << context.frame.width;
jpg_dbg("Macroblocks in a row: " << context.mblock_meta.hpadded_count); dbg() << "Image height: " << context.frame.height;
jpg_dbg("Macroblocks in a column: " << context.mblock_meta.vpadded_count); dbg() << "Macroblocks in a row: " << context.mblock_meta.hpadded_count;
dbg() << "Macroblocks in a column: " << context.mblock_meta.vpadded_count;
#endif
// Compute huffman codes for DC and AC tables. // Compute huffman codes for DC and AC tables.
for (auto& dc_table : context.dc_tables) for (auto& dc_table : context.dc_tables)
@ -698,8 +697,10 @@ static inline bool validate_luma_and_modify_context(const ComponentSpec& luma, J
// For easy reference to relevant sample factors. // For easy reference to relevant sample factors.
context.hsample_factor = luma.hsample_factor; context.hsample_factor = luma.hsample_factor;
context.vsample_factor = luma.vsample_factor; context.vsample_factor = luma.vsample_factor;
jpg_dbg(String::format("Horizontal Subsampling Factor: %i", luma.hsample_factor)); #ifdef JPG_DEBUG
jpg_dbg(String::format("Vertical Subsampling Factor: %i", luma.vsample_factor)); dbg() << String::format("Horizontal Subsampling Factor: %i", luma.hsample_factor);
dbg() << String::format("Vertical Subsampling Factor: %i", luma.vsample_factor);
#endif
return true; return true;
} }
return false; return false;