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

相关推荐
行云流水剑5 分钟前
【学习记录】如何使用 Python 提取 PDF 文件中的内容
python·学习·pdf
虾球xz1 小时前
CppCon 2015 学习:CLANG/C2 for Windows
开发语言·c++·windows·学习
CodeWithMe2 小时前
【C/C++】namespace + macro混用场景
c语言·开发语言·c++
蓝婷儿2 小时前
6个月Python学习计划 Day 17 - 继承、多态与魔术方法
开发语言·python·学习
持续前进的奋斗鸭2 小时前
Postman测试学习(1)
学习·postman
hello kitty w3 小时前
Python学习(7) ----- Python起源
linux·python·学习
一叶知秋秋3 小时前
python学习day39
人工智能·深度学习·学习
永日456703 小时前
学习日记-day24-6.8
开发语言·学习·php
安和昂3 小时前
【iOS】 Block再学习
学习·ios·cocoa
pop_xiaoli3 小时前
OC学习—命名规范
学习·ios