我试图利用libjpeg进行图像解压缩,但是我需要知道如何读取数据。仔细阅读jpeg_read_scanlines的源代码后,我发现了一些函数指针,而我似乎找不到声明它们的位置,这使我陷入困境。
这是有问题的源代码: https://code.woboq.org/qt5/qtbase/src/3rdparty/libjpeg/src/jdapistd.c.html#263
GLOBAL(JDIMENSION)
jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines,
JDIMENSION max_lines)
{
JDIMENSION row_ctr;
if (cinfo->global_state != DSTATE_SCANNING)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
if (cinfo->output_scanline >= cinfo->output_height) {
WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
return 0;
}
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long)cinfo->output_scanline;
cinfo->progress->pass_limit = (long)cinfo->output_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Process some data */
row_ctr = 0;
// This is the function pointer that processes the data.
// I cannot seem to find where this is initialized and what it does.
(*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
cinfo->output_scanline += row_ctr;
return row_ctr;
}
如果任何人都可以指出正确的方向,我将非常感谢您的帮助!谢谢!