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

相关推荐
黎明smaly14 分钟前
【排序】插入排序
c语言·开发语言·数据结构·c++·算法·排序算法
运营黑客34 分钟前
Grok 4,来了。
人工智能·学习·ai·aigc
LIN-JUN-WEI2 小时前
[ESP32]VSCODE+ESP-IDF环境搭建及blink例程尝试(win10 win11均配置成功)
c语言·开发语言·ide·vscode·单片机·学习·编辑器
艾莉丝努力练剑4 小时前
【C语言】学习过程教训与经验杂谈:思想准备、知识回顾(三)
c语言·开发语言·数据结构·学习·算法
ZZZS05164 小时前
stack栈练习
c++·笔记·学习·算法·动态规划
黑听人4 小时前
【力扣 困难 C】115. 不同的子序列
c语言·leetcode
位东风4 小时前
【c++学习记录】状态模式,实现一个登陆功能
c++·学习·状态模式
Star Curry4 小时前
【新手小白的嵌入式学习之路】-STM32的学习_GPIO 8种模式学习心得
stm32·嵌入式硬件·学习
AI视觉网奇5 小时前
rag学习笔记
笔记·学习
Feliz Da Vida7 小时前
[代码学习] c++ 通过H矩阵快速生成图像对应的mask
c++·学习