• 大小: 987KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-01
  • 语言: C/C++
  • 标签: yuv  

资源简介

纯C++实现的将YUV444快速下采样转换成YUV420的方法。自带实例可直接运行。

资源截图

代码片段和文件信息

#include 
#include 
using namespace std;

void fastYUV444P2YUV420P(int width int height
                         uint8_t* src_image_array[]
                         uint8_t* dst_image_array[]){
    uint8_t* src_yp = src_image_array[0];
    uint8_t* src_up = src_image_array[1];
    uint8_t* src_vp = src_image_array[2];
    uint8_t* dst_yp = dst_image_array[0];
    uint8_t* dst_up = dst_image_array[1];
    uint8_t* dst_vp = dst_image_array[2];
    int half_width = width / 2;
    int half_height = height / 2;
    //Y
    memcpy(dst_yp src_yp width * height);

    //UV
    for(int i = 0; i < half_height; i++) {
        for(int j = 0; j < half_width; j++) {
            *dst_up = *src_up;
            *dst_vp = *src_vp;
            dst_up++;
            dst_vp++;
       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-08-28 15:08  yuv444P2yuv420p\
     目录           0  2018-08-28 15:17  yuv444P2yuv420p\.idea\
     文件        1832  2018-08-28 15:03  yuv444P2yuv420p\.idea\misc.xml
     文件         282  2018-08-28 15:02  yuv444P2yuv420p\.idea\modules.xml
     文件       12798  2018-08-28 15:17  yuv444P2yuv420p\.idea\workspace.xml
     文件        1158  2018-08-28 15:03  yuv444P2yuv420p\.idea\yuv444P2yuv420p.iml
     目录           0  2018-08-28 15:05  yuv444P2yuv420p\build\
     目录           0  2018-08-28 15:08  yuv444P2yuv420p\build\bin\
     文件     1573632  2018-08-28 15:08  yuv444P2yuv420p\build\bin\YUV420.yuv
     文件     3147264  2018-08-28 15:07  yuv444P2yuv420p\build\bin\YUV444.yuv
     文件       73945  2018-08-28 15:08  yuv444P2yuv420p\build\bin\yuv444P2yuv420p.exe
     目录           0  2018-08-28 15:05  yuv444P2yuv420p\build\lib\
     文件         686  2018-08-28 15:05  yuv444P2yuv420p\CMakeLists.txt
     目录           0  2018-08-28 15:07  yuv444P2yuv420p\libs\
     文件     3147264  2018-08-28 15:07  yuv444P2yuv420p\libs\YUV444.yuv
     文件        1905  2018-08-28 15:08  yuv444P2yuv420p\main.cpp

评论

共有 条评论