zoukankan      html  css  js  c++  java
  • FFmpeg——AVFrame中 的 data

    AVFrame中 的 data 的定义如下:

    typedef struct AVFrame {
    #define AV_NUM_DATA_POINTERS 8
        /**
         * pointer to the picture/channel planes.
         * This might be different from the first allocated byte
         *
         * Some decoders access areas outside 0,0 - width,height, please
         * see avcodec_align_dimensions2(). Some filters and swscale can read
         * up to 16 bytes beyond the planes, if these filters are to be used,
         * then 16 extra bytes must be allocated.
         *
         * NOTE: Except for hwaccel formats, pointers not needed by the format
         * MUST be set to NULL.
         */
        uint8_t *data[AV_NUM_DATA_POINTERS];
    
        // ...
    } AVFrame;
    对于planar模式的YUV:
    • data[0]指向Y分量的开始位置
    • data[1]指向U分量的开始位置
    • data[2]指向V分量的开始位置
     
    对于packed模式YUV:
    • data[0]指向数据的开始位置
    • data[1]和data[2]都为NULL
     
    对于图像文件来说,如果是plannar模式的图像格式,其存储必然是先存完一张图像所有的所有Y、紧接着再存一张图像的所有U、紧接着存一张图像的所有V。
    这刚好和data数组的三个指针的对应的。
     
    所以无论是planar还是packed模式,我们直接使用data[0]即可,不用分开读写。

            
     
  • 相关阅读:
    Vue生命周期
    Vue-Router
    Vue组件
    Vue基础以及指令
    ES6 常用语法
    缓存、序列化、信号
    四、全局事务的commit和rollback
    三、全局事务begin请求GlobalBeginRequest
    二、分布式事务协调者DefaultCoordinator
    一、seata-server的main启动方法
  • 原文地址:https://www.cnblogs.com/zoneofmine/p/10838943.html
Copyright © 2011-2022 走看看