91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 28KB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-21
  • 語言: 其他
  • 標簽: OpenCL??采樣器??

資源簡介

使用 OpenCL 采樣器對象,從原始圖像中截取部分矩形區域。

資源截圖

代碼片段和文件信息

#include?
#include?

#ifdef?__APPLE__
#include?
#else
#include?
#endif

#include?“util.h“

extern?void?scissor(uint8_t?*src?uint8_t?*des?int?orig_width?int?orig_height
int?new_width?int?new_height);

int?main()
{
/*?RGBA?image?format?*/
uint?orig_width?=?512
?????orig_height?=?512
?????size?=?orig_width?*?orig_height?*?4;

uint?new_width?=?256
?????new_height?=?256;

uint8_t?*img_buffer;
uint8_t?*out_buffer;

//?1.定義輸入文件和輸出文件
const?char?*img_file?=?“/data/local/tmp/lenna_rgba.bin“;
const?char?*out_file?=?“lenna_rgba_target.bin“;

//?2.分別為兩個文件預分配緩沖區
img_buffer?=?(uint8_t?*)malloc(size);
out_buffer?=?(uint8_t?*)malloc(size);
if?(!img_buffer?||?!out_buffer)?{
perror(“malloc?memory?fail“);
exit(EXIT_FAILURE);
}

//?3.將輸入文件保存到緩沖區中
load_data(img_file?img_buffer?size);

//?4.旋轉圖像
scissor(img_buffer?out_buffer?orig_width?orig_height
new_width?new_height);

//?5.把旋轉后的圖像數據保存到輸出文件中
store_data(out_file?out_buffer?384?*?384?*?4);

//?6.釋放緩沖區
free(img_buffer);
free(out_buffer);

return?0;
}

評論

共有 條評論