|
发表于 2016-1-7 14:25:32
14178 浏览 0 回复
关于4412的linux系统下的硬解码jpeg
安卓4.03相关代码Top4412_ICS_20150413\iTop4412_ICS\device\samsung\exynos4\libhwjpeg的jpeg_hal_unit.c
内核里相关代码iTop4412_Kernel_3.0_20150403.tar(1)\iTop4412_Kernel_3.0_20150403\iTop4412_Kernel_3.0\drivers\media\video\samsung\jpeg_v2x目录下
然后把安卓里面的代码抠出来,放在linux系统里编,我代码这样写的
//头文件
#include<jpeg_hal.h>
int dec_fd;
struct v4l2_format fmt;
struct jpeg_config *config;
struct jpeg_buf *out_buf;
struct jpeg_buf *in_buf;
unsigned char *m_tmpbuffer;
//源文件
config= (struct jpeg_config *)calloc(1, sizeof(struct jpeg_config));
out_buf=(struct jpeg_buf *)calloc(1, sizeof(struct jpeg_buf));
in_buf=(struct jpeg_buf *)calloc(1, sizeof(struct jpeg_buf));
dec_fd=jpeghal_dec_init();
m_tmpbuffer = (unsigned char *) calloc(1, (size_t)1024*768*4);
config->scaled_height=768;
config->scaled_width=1024;
config->height=768;
config->width=1024;
config->pix.dec_fmt.out_fmt=V4L2_PIX_FMT_RGB32;
config->pix.dec_fmt.in_fmt=V4L2_PIX_FMT_JPEG_422;
config->sizeJpeg=1024*768;
config->num_planes=3;
config->enc_qual=QUALITY_LEVEL_4;
out_buf->memory=V4L2_MEMORY_MMAP;
in_buf->memory=V4L2_MEMORY_MMAP;
out_buf->num_planes=3;
in_buf->num_planes=3;
if( jpeghal_dec_setconfig(dec_fd,config)>=0)
{
printf("set config succes\n");
}
if(jpeghal_set_inbuf(dec_fd, in_buf)>=0)
{
printf("set inbuf succes\n");
}
if( jpeghal_set_outbuf(dec_fd, out_buf)>=0)
{
printf("set outbuf succes\n");
}
while(1)
{
memcpy(in_buf->start[0],vd->tmpbuffer,vd->struvd->buf.bytesused);//拷贝摄像头压缩数据给解码器内存
jpeghal_dec_exe(dec_fd,in_buf,out_buf);
memcpy(m_tmpbuffer,out_buf->start[0],1024*768*4);
}
程序运行后打印信息
set config succes
set inbuf succes
set outbuf succes
Device information:
Device path: /dev/video5
Frame size: 1024x768
Frame rate: 30 fps
[ 7331.828197] ctx is null.
jpeg_v4l2_streamon:STREAMON failed:: Device or resource busy
jpeg_v4l2_streamon:STREAMON failed:: Device or resource busy
[ 7346.087380] ctx is null.
jpeg_v4l2_streamon:STREAMON failed:: Device or resource busy
jpeg_v4l2_streamon:STREAMON failed:: Device or resource busy
[ 7361.089575] ctx is null.
通过输出的m_tempbuffer我存了几张图,发现这有图像最上方的一窄条图像是正确的,其他的都不对
内核打印的信息ctx is null.也不知道只什么意思。。。。
有谁会这方面的给指教下,感激不尽那。。。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|
|
|
|
|
|
登录或注册
扫一扫关注迅为公众号
|