当前位置: 首页 > news >正文

做阿里云网站的公司英文外链seo兼职

做阿里云网站的公司,英文外链seo兼职,开发一个app最少需要多少钱,wordpress 日期 浏览LCD控制器会将LCD上的屏幕数据映射在相应的显存位置上。 通过libjpeg把jpg图片解压出来RGB原始数据。 libjpeg是使用c语言实现的读写jpeg文件的库。 使用libjpeg的应用程序是以"scanline"为单位进行图像处理的。 libjpeg解压图片的步骤: libjpeg的使…

LCD控制器会将LCD上的屏幕数据映射在相应的显存位置上。

在这里插入图片描述

通过libjpeg把jpg图片解压出来RGB原始数据。

libjpeg是使用c语言实现的读写jpeg文件的库。

使用libjpeg的应用程序是以"scanline"为单位进行图像处理的。

libjpeg解压图片的步骤:
在这里插入图片描述

libjpeg的使用

Directory Listing of /files (ijg.org)

bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg$ tar -vxzf jpegsrc.v9f.tar.gz

生成配置文件:

bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg$ ls
jpeg-9f  jpegsrc.v9f.tar.gz
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg$ cd jpeg-9f/
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f$ mkdir tmp
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f$ ./configure --prefix=/home/bleaaach/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f/tmp/ --host=arm-gnueabihf-linux
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f$ sudo make install
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f$ ls tmp
bin  include  lib  share

今天仔细看了一下arm-linux-gnueabihf的头文件在/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/

bleaaach@bleaaach-virtual-machine:/usr/local/include$ ls
freetype2  jconfig.h  jerror.h  jmorecfg.h  jpeglib.h
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f/tmp/lib$ sudo cp * /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib -rf
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/jpeg-9f/tmp/lib$ sudo cp ../include/* /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/ -rf

输出图像信息

把韦东山老师写的代码拷进来:
在这里插入图片描述

编译1th:

#include <stdio.h>
#include "jpeglib.h"
#include <setjmp.h>/*
Allocate and initialize a JPEG decompression object    // 分配和初始化一个decompression结构体
Specify the source of the compressed data (eg, a file) // 指定源文件
Call jpeg_read_header() to obtain image info		   // 用jpeg_read_header获得jpg信息
Set parameters for decompression					   // 设置解压参数,比如放大、缩小
jpeg_start_decompress(...); 						   // 启动解压:jpeg_start_decompress
while (scan lines remain to be read)jpeg_read_scanlines(...);						   // 循环调用jpeg_read_scanlines
jpeg_finish_decompress(...);						   // jpeg_finish_decompress
Release the JPEG decompression object				   // 释放decompression结构体
*//* Uage: jpg2rgb <jpg_file>*/int main(int argc, char **argv)
{struct jpeg_decompress_struct cinfo;struct jpeg_error_mgr jerr;FILE * infile;// 分配和初始化一个decompression结构体cinfo.err = jpeg_std_error(&jerr);jpeg_create_decompress(&cinfo);// 指定源文件if ((infile = fopen(argv[1], "rb")) == NULL) {fprintf(stderr, "can't open %s\n", argv[1]);return -1;}jpeg_stdio_src(&cinfo, infile);// 用jpeg_read_header获得jpg信息jpeg_read_header(&cinfo, TRUE);/* 源信息 */printf("image_width = %d\n", cinfo.image_width);printf("image_height = %d\n", cinfo.image_height);printf("num_components = %d\n", cinfo.num_components);// 设置解压参数,比如放大、缩小// 启动解压:jpeg_start_decompressjpeg_start_decompress(&cinfo);/* 输出的图象的信息 */printf("output_width = %d\n", cinfo.output_width);printf("output_height = %d\n", cinfo.output_height);printf("output_components = %d\n", cinfo.output_components);// 循环调用jpeg_read_scanlines来一行一行地获得解压的数据jpeg_finish_decompress(&cinfo);jpeg_destroy_decompress(&cinfo);return 0;
}
bleaaach@bleaaach-virtual-machine:~/linux/IMX6ULL/frame/04_libjpeg/1th$ arm-linux-gnueabihf-gcc -o jpg2rgb jpg2rgb.c -ljpeg

把文件拷贝到开发板:
在这里插入图片描述

在开发板上测试:

在这里插入图片描述

调整压缩比

// 设置解压参数,比如放大、缩小
printf("enter M/N:\n");
scanf("%d/%d", &cinfo.scale_num, &cinfo.scale_denom);
printf("scale to : %d/%d\n", cinfo.scale_num, cinfo.scale_denom);

在这里插入图片描述

在这里插入图片描述

有些缩放比例并没有实现,所以没有效果。

输出JPG图片

#include <stdio.h>
#include "jpeglib.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/fb.h>
#include <string.h>
#include <stdlib.h>#define FB_DEVICE_NAME "/dev/fb0"
#define DBG_PRINTF printfstatic int g_fd;static struct fb_var_screeninfo g_tFBVar;
static struct fb_fix_screeninfo g_tFBFix;	
static unsigned char *g_pucFBMem;
static unsigned int g_dwScreenSize;static unsigned int g_dwLineWidth;
static unsigned int g_dwPixelWidth;static int FBDeviceInit(void)
{int ret;g_fd = open(FB_DEVICE_NAME, O_RDWR);if (0 > g_fd){DBG_PRINTF("can't open %s\n", FB_DEVICE_NAME);}ret = ioctl(g_fd, FBIOGET_VSCREENINFO, &g_tFBVar);if (ret < 0){DBG_PRINTF("can't get fb's var\n");return -1;}ret = ioctl(g_fd, FBIOGET_FSCREENINFO, &g_tFBFix);if (ret < 0){DBG_PRINTF("can't get fb's fix\n");return -1;}g_dwScreenSize = g_tFBVar.xres * g_tFBVar.yres * g_tFBVar.bits_per_pixel / 8;g_pucFBMem = (unsigned char *)mmap(NULL , g_dwScreenSize, PROT_READ | PROT_WRITE, MAP_SHARED, g_fd, 0);if (0 > g_pucFBMem){DBG_PRINTF("can't mmap\n");return -1;}g_dwLineWidth  = g_tFBVar.xres * g_tFBVar.bits_per_pixel / 8;g_dwPixelWidth = g_tFBVar.bits_per_pixel / 8;return 0;
}static int FBShowPixel(int iX, int iY, unsigned int dwColor)
{unsigned char *pucFB;unsigned short *pwFB16bpp;unsigned int *pdwFB32bpp;unsigned short wColor16bpp; /* 565 */int iRed;int iGreen;int iBlue;if ((iX >= g_tFBVar.xres) || (iY >= g_tFBVar.yres)){DBG_PRINTF("out of region\n");return -1;}pucFB      = g_pucFBMem + g_dwLineWidth * iY + g_dwPixelWidth * iX;pwFB16bpp  = (unsigned short *)pucFB;pdwFB32bpp = (unsigned int *)pucFB;switch (g_tFBVar.bits_per_pixel){case 8:{*pucFB = (unsigned char)dwColor;break;}case 16:{iRed   = (dwColor >> (16+3)) & 0x1f;iGreen = (dwColor >> (8+2)) & 0x3f;iBlue  = (dwColor >> 3) & 0x1f;wColor16bpp = (iRed << 11) | (iGreen << 5) | iBlue;*pwFB16bpp	= wColor16bpp;break;}case 32:{*pdwFB32bpp = dwColor;break;}default :{DBG_PRINTF("can't support %d bpp\n", g_tFBVar.bits_per_pixel);return -1;}}return 0;
}static int FBCleanScreen(unsigned int dwBackColor)
{unsigned char *pucFB;unsigned short *pwFB16bpp;unsigned int *pdwFB32bpp;unsigned short wColor16bpp; /* 565 */int iRed;int iGreen;int iBlue;int i = 0;pucFB      = g_pucFBMem;pwFB16bpp  = (unsigned short *)pucFB;pdwFB32bpp = (unsigned int *)pucFB;switch (g_tFBVar.bits_per_pixel){case 8:{memset(g_pucFBMem, dwBackColor, g_dwScreenSize);break;}case 16:{iRed   = (dwBackColor >> (16+3)) & 0x1f;iGreen = (dwBackColor >> (8+2)) & 0x3f;iBlue  = (dwBackColor >> 3) & 0x1f;wColor16bpp = (iRed << 11) | (iGreen << 5) | iBlue;while (i < g_dwScreenSize){*pwFB16bpp	= wColor16bpp;pwFB16bpp++;i += 2;}break;}case 32:{while (i < g_dwScreenSize){*pdwFB32bpp	= dwBackColor;pdwFB32bpp++;i += 4;}break;}default :{DBG_PRINTF("can't support %d bpp\n", g_tFBVar.bits_per_pixel);return -1;}}return 0;
}static int FBShowLine(int iXStart, int iXEnd, int iY, unsigned char *pucRGBArray)
{int i = iXStart * 3;int iX;unsigned int dwColor;//边界处理if (iY >= g_tFBVar.yres)return -1;if (iXStart >= g_tFBVar.xres)return -1;if (iXEnd >= g_tFBVar.xres){iXEnd = g_tFBVar.xres;}for (iX = iXStart; iX < iXEnd; iX++){/* 0xRRGGBB */dwColor = (pucRGBArray[i]<<16) + (pucRGBArray[i+1]<<8) + (pucRGBArray[i+2]<<0);i += 3;FBShowPixel(iX, iY, dwColor);}return 0;
}/*
Allocate and initialize a JPEG decompression object    // 分配和初始化一个decompression结构体
Specify the source of the compressed data (eg, a file) // 指定源文件
Call jpeg_read_header() to obtain image info		   // 用jpeg_read_header获得jpg信息
Set parameters for decompression					   // 设置解压参数,比如放大、缩小
jpeg_start_decompress(...); 						   // 启动解压:jpeg_start_decompress
while (scan lines remain to be read)jpeg_read_scanlines(...);						   // 循环调用jpeg_read_scanlines
jpeg_finish_decompress(...);						   // jpeg_finish_decompress
Release the JPEG decompression object				   // 释放decompression结构体
*//* Uage: jpg2rgb <jpg_file>*/int main(int argc, char **argv)
{struct jpeg_decompress_struct cinfo;struct jpeg_error_mgr jerr;FILE * infile;int row_stride;unsigned char *buffer;if (argc != 2){printf("Usage: \n");printf("%s <jpg_file>\n", argv[0]);return -1;}if (FBDeviceInit()){return -1;}FBCleanScreen(0);// 分配和初始化一个decompression结构体cinfo.err = jpeg_std_error(&jerr);jpeg_create_decompress(&cinfo);// 指定源文件if ((infile = fopen(argv[1], "rb")) == NULL) {fprintf(stderr, "can't open %s\n", argv[1]);return -1;}jpeg_stdio_src(&cinfo, infile);// 用jpeg_read_header获得jpg信息jpeg_read_header(&cinfo, TRUE);/* 源信息 */printf("image_width = %d\n", cinfo.image_width);printf("image_height = %d\n", cinfo.image_height);printf("num_components = %d\n", cinfo.num_components);// 设置解压参数,比如放大、缩小printf("enter scale M/N:\n");scanf("%d/%d", &cinfo.scale_num, &cinfo.scale_denom);printf("scale to : %d/%d\n", cinfo.scale_num, cinfo.scale_denom);// 启动解压:jpeg_start_decompressjpeg_start_decompress(&cinfo);/* 输出的图象的信息 */printf("output_width = %d\n", cinfo.output_width);printf("output_height = %d\n", cinfo.output_height);printf("output_components = %d\n", cinfo.output_components);// 一行的数据长度row_stride = cinfo.output_width * cinfo.output_components;buffer = malloc(row_stride);// 循环调用jpeg_read_scanlines来一行一行地获得解压的数据while (cinfo.output_scanline < cinfo.output_height) {(void) jpeg_read_scanlines(&cinfo, &buffer, 1);// 写到LCD去FBShowLine(0, cinfo.output_width, cinfo.output_scanline, buffer);}free(buffer);jpeg_finish_decompress(&cinfo);jpeg_destroy_decompress(&cinfo);return 0;
}

这段代码使用libjpeg库将一个JPEG格式的图片文件解码并显示到Linux系统的Framebuffer设备上。以下是详细的代码功能解读:

  1. 包含头文件与定义常量

    • 引入了stdio.hjpeglib.hsetjmp.h等C标准库头文件以及sys/types.hsys/stat.hfcntl.hsys/ioctl.hsys/mman.hlinux/fb.h等系统相关头文件。
    • 定义了Framebuffer设备名FB_DEVICE_NAME、调试打印宏DBG_PRINTF以及全局变量g_fdg_tFBVarg_tFBFixg_pucFBMemg_dwScreenSizeg_dwLineWidthg_dwPixelWidth
  2. Framebuffer设备初始化函数

    • FBDeviceInit()函数负责打开Framebuffer设备文件、获取其变量信息(g_tFBVar)和固定信息(g_tFBFix),计算屏幕尺寸、内存映射,并初始化行宽和像素宽度。
  3. Framebuffer显示相关函数

    • FBShowPixel()函数根据给定的颜色值和坐标,在Framebuffer上显示一个像素。

    • FBCleanScreen()函数清除整个Framebuffer,用指定颜色填充。

    • FBShowLine()函数接收一个RGB数据数组,将该数组表示的一行像素数据按照指定坐标写入Framebuffer。

      • int iXStart: 要绘制的线条起点的 x 坐标。
      • int iXEnd: 要绘制的线条终点的 x 坐标。
      • int iY: 线条在屏幕上的固定 y 坐标。
      • unsigned char *pucRGBArray: 指向一个包含 RGB 像素值的字节数组,数组中的每个连续三个字节表示一个像素的 R、G、B 分量(各占 8 位)。

      在这里插入图片描述

  4. JPEG解码相关函数

    • 这部分代码未直接定义JPEG解码函数,而是使用libjpeg库提供的接口。
    • main()函数中,首先检查命令行参数是否正确(需要提供一个JPEG文件路径),然后调用FBDeviceInit()初始化Framebuffer设备。
    • 初始化jpeg_decompress_struct结构体cinfo和错误处理结构体jerr,并关联标准错误处理方法。
    • 打开指定的JPEG文件,将其作为解码源设置到cinfo结构体中。
    • 调用jpeg_read_header()读取JPEG文件头信息,获取原始图像尺寸、颜色组件数等。
    • 提示用户输入缩放比例(M/N),并设置到cinfo结构体中。
    • 调用jpeg_start_decompress()启动解码过程。
  5. JPEG图像解码与显示

    • 根据解码后输出的图像尺寸分配临时缓冲区buffer,用于存放一行像素数据。

    • 使用循环调用jpeg_read_scanlines(),每次读取一行像素数据并将其存储在buffer中。

      buffer是一个指针数组,存储一行数据的起始位置。

      在这里插入图片描述

      我们要把buffer传入到这个typedef unsiged char** JSAMPARRAY变量里,buffer[0]实际上是一个unsigned char *地址的指针,是指针的指针。

    • 对于每一行解码得到的像素数据,调用FBShowLine()将其显示到Framebuffer对应行上。

    • 解码完成后,释放buffer,调用jpeg_finish_decompress()jpeg_destroy_decompress()完成解码过程的清理工作。
      综上所述,这段代码的主要目的是将一个JPEG格式的图片文件解码,根据用户指定的缩放比例调整图像尺寸,然后逐行将解码后的像素数据写入Linux系统的Framebuffer设备,最终在连接到该设备的屏幕上显示解码后的图像。

测试

在这里插入图片描述

在这里插入图片描述


文章转载自:
http://dinncofritillary.tqpr.cn
http://dinncoindubitability.tqpr.cn
http://dinncochiffchaff.tqpr.cn
http://dinncoinconsonance.tqpr.cn
http://dinncobuddhistical.tqpr.cn
http://dinncodisbelievingly.tqpr.cn
http://dinncoheterometabolous.tqpr.cn
http://dinncoconsignable.tqpr.cn
http://dinncotreetop.tqpr.cn
http://dinncodieter.tqpr.cn
http://dinncohoratio.tqpr.cn
http://dinncooffshoot.tqpr.cn
http://dinncotrackside.tqpr.cn
http://dinncomouthiness.tqpr.cn
http://dinncoexnihilo.tqpr.cn
http://dinncofigurante.tqpr.cn
http://dinncoantiapartheid.tqpr.cn
http://dinncohiggler.tqpr.cn
http://dinncoillegalization.tqpr.cn
http://dinncobackyard.tqpr.cn
http://dinncoimprese.tqpr.cn
http://dinncointroducer.tqpr.cn
http://dinncostyrol.tqpr.cn
http://dinncosarmentaceous.tqpr.cn
http://dinncocookery.tqpr.cn
http://dinncopyretotherapy.tqpr.cn
http://dinncouredosorus.tqpr.cn
http://dinncoentorganism.tqpr.cn
http://dinncodumpage.tqpr.cn
http://dinncoinspect.tqpr.cn
http://dinncocambrian.tqpr.cn
http://dinncocubiform.tqpr.cn
http://dinnconewtonian.tqpr.cn
http://dinncoharmonise.tqpr.cn
http://dinncojereed.tqpr.cn
http://dinncotailleur.tqpr.cn
http://dinncofaggotry.tqpr.cn
http://dinncomicrocephaly.tqpr.cn
http://dinncotroglodytism.tqpr.cn
http://dinncohypogeusia.tqpr.cn
http://dinncoagoraphobe.tqpr.cn
http://dinncoshocker.tqpr.cn
http://dinncocelotomy.tqpr.cn
http://dinncoamidone.tqpr.cn
http://dinncoczarist.tqpr.cn
http://dinncothymy.tqpr.cn
http://dinncogutta.tqpr.cn
http://dinncohurdies.tqpr.cn
http://dinncoalibility.tqpr.cn
http://dinncomarconigram.tqpr.cn
http://dinncopettitoes.tqpr.cn
http://dinncotriclinium.tqpr.cn
http://dinncoimpotence.tqpr.cn
http://dinncotranslationese.tqpr.cn
http://dinncocylindroma.tqpr.cn
http://dinncoascii.tqpr.cn
http://dinncoremould.tqpr.cn
http://dinncoflyway.tqpr.cn
http://dinncopassementerie.tqpr.cn
http://dinncobumblepuppy.tqpr.cn
http://dinncodespairing.tqpr.cn
http://dinncopolymeric.tqpr.cn
http://dinncocanterbury.tqpr.cn
http://dinncoposseman.tqpr.cn
http://dinncoedwardian.tqpr.cn
http://dinncochoregus.tqpr.cn
http://dinncounshunned.tqpr.cn
http://dinncocoroneted.tqpr.cn
http://dinncoemancipate.tqpr.cn
http://dinncominimine.tqpr.cn
http://dinncocounterthrust.tqpr.cn
http://dinncoassafetida.tqpr.cn
http://dinncographospasm.tqpr.cn
http://dinncoloving.tqpr.cn
http://dinncogrey.tqpr.cn
http://dinncofrankincense.tqpr.cn
http://dinncobatrachian.tqpr.cn
http://dinncofrisson.tqpr.cn
http://dinncocorruption.tqpr.cn
http://dinncoandrology.tqpr.cn
http://dinncovcd.tqpr.cn
http://dinncowhitleather.tqpr.cn
http://dinncovaginae.tqpr.cn
http://dinncostandpat.tqpr.cn
http://dinncohighjacking.tqpr.cn
http://dinncoperfoliate.tqpr.cn
http://dinncopelite.tqpr.cn
http://dinncoenvelop.tqpr.cn
http://dinncoassurable.tqpr.cn
http://dinncophilanthropic.tqpr.cn
http://dinncobedge.tqpr.cn
http://dinncodatabase.tqpr.cn
http://dinncodaughterhood.tqpr.cn
http://dinncoovonic.tqpr.cn
http://dinncolambda.tqpr.cn
http://dinncounwholesome.tqpr.cn
http://dinncononeconomic.tqpr.cn
http://dinncomealtime.tqpr.cn
http://dinncoserrulate.tqpr.cn
http://dinncochine.tqpr.cn
http://www.dinnco.com/news/118502.html

相关文章:

  • 义乌网站备案国家大事新闻近三天
  • 经典网站欣赏怎么在百度上注册店铺
  • 网站建设页面美工旅游最新资讯 新闻
  • 有没有专门做中考卷子的网站金城武重庆森林经典台词
  • 桂阳城乡建设局网站百度seo关键词排名推荐
  • 上海易雅达网站建设公司怎么样企业微信会话存档
  • 长春网站建设小程序徐州做网站的公司
  • 新疆网站建设咨询优化网站的方法有哪些
  • 深圳宝安美容医院网站建设网建公司
  • 网站如何做问卷调查nba最新比赛直播
  • wordpress迁移域名修改seo是什么部位
  • 网站后台发布了但看不见核心关键词举例
  • 那些网站权重高电商网站规划
  • 做网站找客源网站搭建费用
  • 免费二级域名注册平台百度seo排名报价
  • 博野网站建设青岛网络推广
  • dedecms网站上传服务器不是空间网站关键词快速排名服务
  • 郑州网站制作企业指数基金是什么意思
  • 中企动力做网站多少钱网络推广是网络营销的基础
  • 做电商网站前端的技术选型是哪个公司的网站制作
  • 做阿里巴巴的网站的费用微信广告推广价格表
  • 设计广告公司网站建设百度浏览器主页网址
  • 晋城商城网站开发设计全媒体运营师培训
  • 广西桂林十大特产北京seo运营
  • 怎么做一帘幽梦网站爱营销电信版下载app最新版
  • 扬州市住房建设局网站seo知识培训
  • 家居品牌网站建设福州seo经理招聘
  • 求一个做美食视频的网站怎么注册自己的网站域名
  • 微博登录网站开发百度竞价排名是什么
  • 电脑编程与网站建设东莞网站建设seo