资源简介
纯c操作
根据要截取范围的左上角坐标以及他的宽高,
截取yuv420p 区域 并 输出到你的buffer
代码片段和文件信息
/*
x1 y1 要截取的方形区域的,左上角坐标
crop_width crop_height 要截取的宽、高
*/
void get_yuv420p_crop_img(uint8_t *img_buffer uint8_t *out_buffer
int x1 int y1 int crop_width int crop_height)
{
int i j k = 0;
int orig_y_size = IMG_WIDTH * IMG_HEIGHT
orig_u_size = orig_y_size >> 2;
int crop_x1 crop_y1 crop_x2 crop_y2;
int h_s h_e w_s w_e;
int loop_y_s1 loop_y_e1 loop_uv_s1 loop_uv_e1;
int loop_y_s2 loop_y_e2 loop_uv_s2 loop_uv_e2;
crop_x1 = x1;
crop_y1 = y1;
crop_x2 = x1+crop_width;
crop_y2 = y1+crop_height;
loop_y_s1 = y1;
loop_y_e1 = y1+crop_height;
loop_y_s2 = x1;
loop_y_e2 = x1+crop_width;
loop_uv_s1 = loop_y_s1/2;
loop_uv_e1 = loop_y_e1/2;
lo
评论
共有 条评论