/**
* @date 2024/05/14
* CopyRight (c) 2023-2024 ni456xinmie@163.com All Right Reseverd
*/
#include
#include
#include
#include
#include //open 函数三部曲
#include //close read 等函数
#include //映射功能
#include "jpeglib.h"
#include
int *lcd_mp;
int cnt = 0;
int x, y;
int read_JPEG_file(char *filename, int start_x, int start_y)
{
struct jpeg_decompress_struct cinfo; // 解压缩实例的主记录
struct jpeg_error_mgr jerr; // 错误处理程序对象
FILE *infile; // 建立源文件流
unsigned char *buffer; // 行缓存
int row_stride; // 缓冲区中的物理行宽
if ((infile = fopen(filename, "rb")) == NULL)
{
fprintf(stderr, "can't open %sn", filename); // 如果不能打开文件,就输出错误信息并退出
return 0;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo); // 初始化解码对象
jpeg_stdio_src(&cinfo, infile); // 指定源文件数据
jpeg_read_header(&cinfo, TRUE); // 读取头文件信息
jpeg_start_decompress(&cinfo); // 开始解码
row_stride = cinfo.output_width * cinfo.output_components; // 计算物理地址一行宽的大小
buffer = calloc(1, row_stride); // 申请一行的堆空间,用于循环解码
int data = 0;
while (cinfo.output_scanline = 2 && x > 100 && x 190 && y = 2 && x > 500 && x 190 && y = 2 && x > 650 && x 30 && y