Sco*_*ian 2 c compiler-errors libjpeg ios
当我尝试构建此代码时,该行struct my_error_mgr jerr;显示错误“变量的类型不完整'struct my_error_mgr'
#import "Engine.h"
#include "jpeglib.h"
@implementation Engine
+(void)test{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
FILE * infile;
if ((infile = fopen(filename, "rb")) == NULL) {
fprintf(stderr, "can't open %s\n", filename);
return 0;
}
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo);
fclose(infile);
return 0;
}
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
(void) jpeg_read_header(&cinfo, TRUE);
jvirt_barray_ptr* coeffs_array;
coeffs_array = jpeg_read_coefficients(&cinfo);
BOOL done = FALSE;
for (int ci = 0; ci < 3; ci++)
{
JBLOCKARRAY buffer_one;
JCOEFPTR blockptr_one;
jpeg_component_info* compptr_one;
compptr_one = cinfo.comp_info + ci;
for (int by = 0; by < compptr_one->height_in_blocks; by++)
{
buffer_one = (cinfo.mem->access_virt_barray)((j_common_ptr)&cinfo, coeffs_array[ci], by, (JDIMENSION)1, FALSE);
for (int bx = 0; bx < compptr_one->width_in_blocks; bx++)
{
blockptr_one = buffer_one[0][bx];
for (int bi = 0; bi < 64; bi++)
{
blockptr_one[bi]++;
}
}
}
}
write_jpeg(output, &cinfo, coeffs_array); // saving modified JPEG to the output file
jpeg_destroy_decompress(&cinfo);
fclose(infile);
}
@end
Run Code Online (Sandbox Code Playgroud)
当我尝试注释掉与此错误相关的所有EXC_BAD_ACCESS行时,然后在该行上出现运行时错误
(void) jpeg_read_header(&cinfo, infile);
Run Code Online (Sandbox Code Playgroud)
我试图修改iOS中已保存JPEG图像的DCT系数,最终目标是创建JPEG隐写应用程序。我有以下代码尝试向每个DCT系数加一个。我正在使用libjpeg库。该代码是Objective-C和C的组合。
快速说明,变量文件名等于“ / Users / ScottBouloutian / Library / Application Support / iPhone Simulator / 7.0.3 / Applications / 27A0450E-4685-4C3E-AAC8-A0CC6C85359E / Crypsis.app / screen.jpg”是我要修改的JPEG图像的路径。
我的代码有什么问题?这是愚蠢的,例如缺少包含项还是我的文件路径有问题?
| 归档时间: |
|
| 查看次数: |
6644 次 |
| 最近记录: |