c ffmpeg 学习

  1. int8_t <==> char u_int8_t == unsigned char

int16_t == short

int32_t ==int

  1. #define X(x) x,x,x,x,x,x,x,x //表示8个x 主要用于数组赋值

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #define X8(x) x,x,x,x,x,x,x,x //X8(x) 表示8个x
    #define X64(x) x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x,
    x,x,x,x,x,x,x,x //X64(x) 表示64个x

    int main(void){

    复制代码
     int32_t a[] = {
     X8(13036),  // tg * (2<<16) + 0.5
     X8(27146),  // tg * (2<<16) + 0.5
     X8(-21746)  // tg * (2<<16) + 0.5
     };
     
     printf("%d\n",a[0]);
     int  b[64]={X64(1)};
     printf("%d\n",b[63]);
    
     return 0;

    }

与memset(b,1 ,64) 等效

  1. fwrite fread

fwrite(参数1,参数2,参数3,文件号) 参数2:相同单位内的字节数

参数3:表示有多少个相同单位

利用参数2,3能方便写入和读取二维数组元素

4。DECLARE_ALIGEND( n, 类型,名字) 内存对齐,我理解这个内存对齐是ffmpeg为了兼容不同操作系统用的,对于linux X86 来说,直接按n的大小选数据类型就可以了,比如是8,就是char,16 就选short。下面的例子就是

short fdct_tg_all_16[24]={....}

//concatenated table, for forward DCT transformation

DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = {

X8(13036), // tg * (2<<16) + 0.5

X8(27146), // tg * (2<<16) + 0.5

X8(-21746) // tg * (2<<16) + 0.5

};

  1. 开根号 sqrt()

比如1/2 开根号,必须写成: sqrt(1.0/2) 1必须写成1.0

相关推荐
·云扬·4 小时前
【MySQL】实战:用pt-table-sync修复主从数据一致性问题
数据库·mysql·ffmpeg
摇滚侠4 小时前
如何选择 nodejs 版本,nodejs 版本号详解
学习
醇氧5 小时前
【学习】IP地址:数字世界的“门牌号”怎么读?
网络协议·学习·tcp/ip
talen_hx2966 小时前
《零基础入门Spark》学习笔记 Day 11
笔记·学习·spark
ZhiqianXia7 小时前
gem5 模拟器学习笔记(1):核心术语整理
笔记·学习
三道渊7 小时前
C语言:文件I/O
c语言·开发语言·数据结构·c++
GHL2842710907 小时前
MCP学习
学习·ai
kali-Myon7 小时前
CTFshow-Pwn142-Off-by-One(堆块重叠)
c语言·数据结构·安全·gdb·pwn·ctf·
凌波粒8 小时前
D2L学习笔记:安装、张量与数据处理
笔记·python·学习·pandas