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]即可,不用分开读写。

            
     
  • 相关阅读:
    如何安装Tomcat服务器
    浅谈数据库中的锁机制
    彻底理解js中this的指向
    Javascript模块化编程的写法
    滚屏加载--无刷新动态加载数据技术的应用
    JavaScript正则表达式
    CSS:水平居中与垂直居中
    Linux常用命令大全
    HTML的元素嵌套规则
    clearfix清除浮动进化史
  • 原文地址:https://www.cnblogs.com/zoneofmine/p/10838943.html
Copyright © 2011-2022 走看看