惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
L
LangChain Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
腾讯CDC
GbyAI
GbyAI
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
F
Fortinet All Blogs
Y
Y Combinator Blog
V
V2EX
A
About on SuperTechFans

博客园 - ahuo

dts删除节点方法 Ubuntu ap桥接到有线 MQTT 3.1.1 客户端如何使用共享订阅 mdns shell Ubuntu笔记本盖上不休眠 win10+ubuntu24 双系统 http代理-docker拉取 Ubuntu20 IP显示登录界面 串口启用密码或者不用密码的配置方法(/etc/inittab) mkpasswd Linux下串口的RTS控制 万用表测量MCU的GPIO trackerslist Linux串口通讯监听-jpnevulator NV12数据转OpenCV的Mat Ubuntu 22 root桌面登录 Ubuntu22 向日葵黑屏 vscode ssh key登录 Samba 访问失败,提示“你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问。” Linux NAT转发
crop_yuv420_sp
ahuo · 2024-12-20 · via 博客园 - ahuo
void crop_yuv420_sp(unsigned char *srcbuf, int src_width, int src_height,
                    unsigned char *dstbuf, int x, int y, int w, int h) {
    int i;
    int dst_y_size = w * h;
    int dst_uv_size = (w / 2) * (h / 2);
    int src_y_line_size = src_width;
    int src_uv_line_size = src_width;

    // Crop Y component
    for (i = 0; i < h; i++) {
        memcpy(dstbuf + i * w, srcbuf + (y + i) * src_y_line_size + x, w);
    }

    // Crop UV component (interleaved)
    for (i = 0; i < h / 2; i++) {
        memcpy(dstbuf + dst_y_size + i * w, srcbuf + src_y_line_size * src_height + ((y / 2) + i) * src_uv_line_size + (x / 2) * 2, w);
    }
}