Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用improcess, 从源buf的指定sx,sy,sw,sh复制一个区域到目标buf指定dx,dy,dw,dh,其中sw=dw,sh=dh,图像显示错位问题? #1

Open
nickyang2008 opened this issue Sep 27, 2023 · 1 comment

Comments

@nickyang2008
Copy link

基于Linux Kernel version 5.10.110
libRga版本:v1.9.3
Rga驱动版本:v1.2.22

问题:使用improcess, 从源buf的指定sx,sy,sw,sh复制一个区域到目标buf指定dx,dy,dw,dh,其中sw=dw,sh=dh,图像显示错位,不知是对improcess的理解不正确,还是这是一个BUG,向各位讨教。

librga源码中没有这样使用的例子,是我参考imtranslate源码实现,imtranslate与我代码不同点仅是imtranslate中sx,sy为0。

代码如下:

void drm_2da_cp_rect(uint8_t * dst, uint8_t * src, int bw, int bh, int sx,int sy, int sw, int sh, int dx,int dy) {
int usage = 0;
int ret = 0;
rga_buffer_t pat;

    im_rect srect;
    im_rect drect;
    im_rect prect;

rga_buffer_t     rga_src;
rga_buffer_t     rga_dst;

static im_handle_param_t param;

param.width = bw;
param.height = bh;
param.format = RK_FORMAT_RGBA_8888;

    rga_buffer_handle_t src_handle = importbuffer_virtualaddr(src, &param);
if (src_handle <= 0) {
	printf("Failed to import virtualaddr for src channel!\n");
	return;
}

rga_buffer_handle_t dst_handle = importbuffer_virtualaddr(dst, &param);
if (dst_handle <= 0) {
		printf("Failed to import virtualaddr for dst channel!\n");
	return;
}

rga_src = wrapbuffer_handle(src_handle, bw, bh, RK_FORMAT_RGBA_8888,bw,bh);
rga_dst = wrapbuffer_handle(dst_handle, bw, bh, RK_FORMAT_RGBA_8888,bw,bh);

empty_structure(NULL, NULL, &pat, &srect, &drect, &prect);

    if ((rga_src.width != rga_dst.width) || (rga_src.height != rga_dst.height))
       return;

srect.x = sx;
srect.y = sy;
srect.width = sw;
srect.height = sh;

drect.x = dx;
drect.y = dy;
drect.width = sw;
drect.height = sh;

ret = imcheck(rga_src, rga_dst, srect, drect);
if (ret != IM_STATUS_NOERROR) {
	printf("%d, check error! %s \n", __LINE__, imStrError((IM_STATUS)ret));
} else {
	usage |= IM_SYNC;
	printf("src buff: %d-%d    dst Buff: %d-%d \n", rga_src.wstride,rga_src.hstride,rga_dst.wstride,rga_dst.hstride);
	printf("sx:%d  sy:%d  sw:%d  sh:%d  dx:%d  dy:%d  dw:%d  dh:%d \n",srect.x,srect.y,srect.width,srect.height,drect.x,drect.y,drect.width,drect.height);
	ret = improcess(rga_src, rga_dst, pat, srect, drect, prect, usage);
	if (ret != IM_STATUS_SUCCESS) 
		printf("%d, rga copy error! %s \n", __LINE__, imStrError((IM_STATUS)ret));
}
releasebuffer_handle(src_handle);
    releasebuffer_handle(dst_handle);

}

@tsukumijima
Copy link
Owner

Sorry, I am only mirroring this code and am not familiar with the internal code or API specs.
However, I will keep this Issue open in the future as there may be others who can advise me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants