hello:
I tried to resize the frame from 720*576 to 352 *288 by using the resizer module base on SEED DM6446 EVM, I found the color of image is changed by resize Coprocessor.
this is my initial program code:
#define IN_HEIGHT 576
#define IN_WIDTH 720
#define IN_PITCH 1440
#define OUT_HEIGHT 288
#define OUT_WIDTH 352
#define OUT_PITCH 704
static rsz_params_t resizer_params = {
720, /* in_hsize */
576, /* in_vsize */
1440, /* in_pitch */
RSZ_INTYPE_YCBCR422_16BIT, /* inptyp */
0, /* vert_starting_pixel */
0, /* horz_starting_pixel */
0, /* cbilin */
RSZ_PIX_FMT_UYVY, /* pix_fmt */
352, /* out_hsize */
288, /* out_vsize */
704, /* out_pitch */
0, /* hstph */
0, /* vstph */
/*horizontal resizing filter coefficients: */
{
-1,
19,
110,
110,
19,
-1,
0,
0,
0,
7,
87,
125,
38,
-1,
0,
0,
0,
0,
61,
134,
61,
0,
0,
0,
0,
-1,
38,
125,
87,
7,
0,
0,
},
/*vertical resizing filter coefficients: */
{
39,
178,
39,
0,
25,
175,
56,
0,
14,
164,
78,
0,
8,
146,
101,
1,
4,
124,
124,
4,
1,
101,
146,
8,
0,
78,
164,
14,
0,
56,
175,
25,
},
{
RSZ_YENH_DISABLE,
}
};
int ch_fd = open("/dev/davinci_resizer", O_RDWR);
if (ch_fd < 0){
printf("\n Resizer device open failed%d\n",ch_fd);
return 0;
}
/* ==========================RSZ_BUF_IN========================== */
ch_req_inbufs.buf_type = RSZ_BUF_IN;
ch_req_inbufs.size = IN_HEIGHT * IN_WIDTH * 2;
ch_req_inbufs.count = 1;
if (ioctl(ch_fd, RSZ_REQBUF, &ch_req_inbufs) == -1) {
printf("\n buffer allocation error \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_BUF_OUT========================= */
ch_req_outbufs.buf_type = RSZ_BUF_OUT;
ch_req_outbufs.size = OUT_HEIGHT * OUT_WIDTH * 2;
ch_req_outbufs.count = 1;
if (ioctl(ch_fd, RSZ_REQBUF, &ch_req_outbufs) == -1) {
printf("\n buffer allocation error \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_G_STATUS======================== */
if (ioctl(ch_fd, RSZ_G_STATUS, &ch1_stat) == -1)
{
printf("\n Get Status failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_S_EXP=========================== */
if (ioctl(ch_fd, RSZ_S_EXP, &ch1_dig) == -1)
{
printf("\nGet Status failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_QUERYBUF IN==================== */
ch_bufd.buf_type = RSZ_BUF_IN;
ch_bufd.index = 0;
if (ioctl(ch_fd, RSZ_QUERYBUF, &ch_bufd) == -1)
{
printf("\nquery buffer failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
ch_resize.in_buf.offset = ch_bufd.offset;
ch_inBuf =(char *) mmap(0, IN_HEIGHT * IN_WIDTH * 2, PROT_READ | PROT_WRITE,MAP_SHARED, ch_fd, ch_bufd.offset);
/* ==========================RSZ_QUERYBUF OUT=================== */
ch_bufd.buf_type = RSZ_BUF_OUT;
ch_bufd.index = 0;
if (ioctl(ch_fd, RSZ_QUERYBUF, &ch_bufd) == -1)
{
printf("\nquery buffer failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
ch_resize.out_buf.offset = ch_bufd.offset;
ch_outBuf = (char *) mmap(0, OUT_HEIGHT * OUT_WIDTH * 2,PROT_READ | PROT_WRITE, MAP_SHARED, ch_fd,ch_bufd.offset);
/* ==========================RSZ_S_PARAM========================= */
resizer_params.yenh_params.type = RSZ_YENH_DISABLE;
resizer_params.yenh_params.gain = 0x7f;
resizer_params.yenh_params.slop = 0x7f;
resizer_params.yenh_params.core = 0;
if (ioctl(ch_fd, RSZ_S_PARAM, &resizer_params) == -1)
{
printf("\nSetting parameters failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_S_PRIORITY====================== */
ch_prio.priority = 0;
if (ioctl(ch_fd, RSZ_S_PRIORITY, &ch_prio) == -1)
{
printf("\nquery buffer failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
/* ==========================RSZ_S_EXP=========================== */
rszSpeed = 0;
if ( ioctl( ch_fd, RSZ_S_EXP, &rszSpeed ) == -1 ) //set the resizer speed to fastest
{
printf("\nSetting speed failed \n%d",ch_fd);
close(ch_fd);
return 0;
}
ch_resize.in_buf.index = -1;
ch_resize.out_buf.index = -1;
ch_resize.in_buf.size = IN_HEIGHT * IN_WIDTH * 2; //IN_HEIGHT * IN_WIDTH;
ch_resize.out_buf.size = OUT_HEIGHT * OUT_WIDTH * 2; //IN_HEIGHT * IN_WIDTH;
can any one suggest me where is the problem???
Regards
yuan shu