[完美解决]如何在JZ2440 4.3寸LCD显示屏显示jpg图片

操作系统:Ubuntu14.04

内核版本:Linux version 4.4.0-130-generic

交叉编译工具:gcc-3.4.5-glibc-2.3.6

libjpeg库版本:jpegsrc.v9c

材料准备:4.3(480*272)寸jpg图像,编译好的生成文件,上传到开发板(可以参考我之前写过的文章)

代码如下(包含BMP和JPGE代码),详情请看代码注释

欢迎大家在评论留言~~~~~~~~~~~~~~~~

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <sys/mman.h>

//jpeg库的标准头文件
#include <stdio.h>
#include "jpeglib.h"
#include <setjmp.h>

int lcd;  //全局变量
short * fb_mem;  //这块的数据类型一定要注意,如果使用就要跟一个像素匹配两个字节(一个像素由多少个字节组成有关)

/*jpeg显示所需的结构体*/
struct my_error_mgr {
  struct jpeg_error_mgr pub;	/* "public" fields */

  jmp_buf setjmp_buffer;	/* for return to caller */
};

typedef struct my_error_mgr * my_error_ptr;


/*jpeg显示所需的结构体*/
METHODDEF(void)
my_error_exit (j_common_ptr cinfo)
{
  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
  my_error_ptr myerr = (my_error_ptr) cinfo->err;

  /* Always display the message. */
  /* We could postpone this until after returning, if we chose. */
  (*cinfo->err->output_message) (cinfo);

  /* Return control to the setjmp point */
  longjmp(myerr-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值