i965_image__nv12_rotatoin (VADriverContextP ctx,
const struct i965_surface *src_surface,///表示源帧?
const VARectangle *src_rect,//这是表示输入源帧的起码坐标位置与高宽么?
struct i965_surface *dst_surface,//输出目标帧?
const VARectangle *dst_rect)//这是表示输出目标帧的起码坐标位置与高宽么?)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_post_processing_context *pp_context = i965->pp_context;
int fourcc = pp_get_surface_fourcc(ctx, src_surface);//得到图像类型
int width, height;
pp_get_surface_size(ctx, src_surface, &width, &height);//得到图像宽与高
switch (fourcc) {
case fourcc VA_FOURCC_NV12:
const int ix = get_global_id(0);//得到图像像素点的X坐标,这里不知道怎么来写。
const int iy = get_global_id(1);//得到图像像素点的Y坐标
int xc = width/2;//(中心坐标)
int yc = height/2;//(中心坐标)
int xpos = ( ix-xc)*cosTheta - (iy-yc)*sinTheta+xc;//(变换公式,cosTheta,Theta=90,180,270)
int ypos = (ix-xc)*sinTheta + ( iy-yc)*cosTheta+yc;//(变换公式)
if ((xpos>=0) && (xpos< width) && (ypos>=0) && (ypos< height)) //(边界检查)
{
dst_surface->base[ypos*width+xpos]=src_surface->base[iy*width+ix];//(大概是这样的思路)
}
break;
}
上面的流程主要有两个地方不懂
1.如何编写获取图像像素坐标;
2.确定坐标后如何读与写该位置的像素值