当前位置:网站首页>[codec] write H264 decoder (1) from scratch
[codec] write H264 decoder (1) from scratch
2022-06-28 13:35:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
1. background
Because of work , I have been in contact with codec for some time .AVC,HEVC, There are also some functions, large and small , I have been reading books and articles on the principle of codec . From introduction to a little understanding , It feels a little fragmented , Or incomplete , It doesn't seem to form a system . Some small functions , To know is to know , I don't know its meaning and function , Over time, you will gradually forget . Think about it , Maybe a lot of things , You still need to do it yourself , Will understand deeper and more thoroughly , Like Feynman's learning method , Can you say it , That means I understand , This one is the same , You can realize the function , That means you really understand the process and logic . So , During the Chinese new year this year , Suddenly came up with the idea of writing a decoder , And I couldn't hold it down as soon as I started , I've always wanted to move the keyboard and write . In fact, there are many open source and easy-to-use decoders on the market , image ffmpeg,x264 wait . Own this project , It should be a simple learning project , It is estimated that the effect and function of these famous projects will not be achieved in the end , But so what , The process and experience are also great , isn't it? ? At the beginning, I wanted to write an encoder , After thinking about it, I soon gave up , My current idea is just to familiarize myself with the agreement , Not focusing on coding algorithms , by comparison , The knowledge needed to write a decoder is exactly what I need . This has become the cause of this series of articles , Write your own code , Write a summary . Although from “ zero ” Start , But the basic knowledge of codec still needs some reserves , I will introduce and explain the knowledge points involved in decoding in each chapter , But it's too fragmented , It won't be explained one by one . If the knowledge point is too big , You may write a separate article to summarize .
2. plan
2.1 Writing plan
Follow the steps of a decoder , I'm going to divide it into these parts for the time being
- NALU: Format , Start code , EBSP RBSP SODB
- Columbus entropy coding of entropy coding
- SPS: Analyze the meaning of each member in the agreement
- PPS: Analyze the meaning of each member in the agreement
- SEI: Analyze the meaning of each member in the agreement
- SLICE Header: analysis Header
- SLICE data: analysis slice data
- MarcoBlock: How to restore a complete macroblock YUV data
- macroblock_layer
- mb_pred
- Intra predicted part The prediction mode of
- CAVLC
- residual Residual data acquisition
- Intra predicted part Forecast data for and Image data recovery
- deblocking
- …… undetermined
2.2 Project plan
- development environment C Language
- Include features : H264 It is divided 7 individual profile Of , Every profile Is a collection of different functions . See... For specific differences wiki Encyclopedias plan : The first stage is the most basic one baseline The decoder of ( nothing B frame , Only CAVLC, Only line by line is supported Progressive) The second stage is to do main or Extend The decoder of ( Yes B frame , Yes CABAC, Support Progressive and interlace)
The follow-up will not be supported . Decoding does not display , from h264 File solution YUV File can .
- Time arrangement : expect 6 Months to finish it baseline (8 month 30), The second stage will be arranged later .
3. Reference resources
3.1 Reference material
3.2 Reference Engineering
3.3 Reference blog
- Implement one from zero H.264 Stream resolver Supporting works
- Do it yourself H.264 decoder -ZigZagSin Supporting works
- H264 Video decoder C++ Project description Supporting works
4. Tool preparation
4.1 Bitstream analysis tool
- vega: I've used the most professional , Analyze the best software . However, it can only be used by units. Ha ha , Visual inspection should be expensive .
- H264 Visa : I am using 1.15 edition , Out-of-service vega Used when . The parameter analysis is comprehensive , It is very helpful to judge whether your parsing is correct in the early stage .
It is said that there is an upgraded version later H.264 CodecVisa, It doesn't work for the time being .
- elecard I tried it out , I don't think it's very easy to use , It is better to be beautiful and easy to use than vega, Wheel parameters are not as complete as H264 Visa. Not much use . Here is a record of ,elecard There are many kinds of software ,elecard stream analyzer, elecard stream eye,Elecard StreamEye Studio wait . Actually Elecard StreamEye Studio contains stream analyzer, Don't get confused by a bunch of names . among streamEye It has a comprehensive function .
4.2 YUV View tools
- 7yuv
4.3 player
- potplayer: see h264 stream
4.4 some YUV data source
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/150705.html Link to the original text :https://javaforall.cn
边栏推荐
- Mobile web training -flex layout test question 1
- Zhongang mining focuses on the fluorine chemical industry and lays out the new energy industry chain
- Hubble database x a joint-stock commercial bank: upgrade the number management system of Guanzi, so that every RMB has an "ID card"
- 全志V853芯片 如何在Tina V85x平台切换sensor?
- Why do more and more users give up swagger and choose apifox
- 行动诠释价值,城联优品韩董事长出席广东英德抗洪捐赠公益活动会
- 5A同步整流芯片 20V转12V2A/5V4.5A大电流 24W大功率同步整流芯片 大电流降压IC FS2462
- Kubernetes 深入理解kubernetes(一)
- G1垃圾收集器中重要的配置参数及其默认值
- PHP根据年月获取月初月末时间
猜你喜欢
Embedded development: seven techniques for estimating battery life
其他国产手机未能填补华为的空缺,苹果在高端手机市场已无对手
How vscade sets auto save code
全志V853芯片 如何在Tina V85x平台切换sensor?
设计人工智能产品:技术可能性、用户合意性、商业可行性
公司领导说,个人代码超10个Bug就开除,是什么体验?
真香啊!最全的 Pycharm 常用快捷键大全!
Introduction to PWN (1) binary Basics
MySQL多表联合查询
Oceanwide micro fh511 single chip microcomputer IC scheme small household appliances LED lighting MCU screen printing fh511
随机推荐
PCB understand Wang, are you? I am not
How vscade sets auto save code
PHP根据年月获取月初月末时间
You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration property
Pytorch Foundation
plt.savefig()的用法以及保存路径
Google Earth engine (GEE) - Global organic soil area of FAO (1992-2018)
2022年中国运维安全产品市场规模及发展趋势预测分析
中国广电5G套餐来了,比三大运营商低,却没预期那么低
Centos7 - installing mysql5.7
FS7022方案系列FS4059A双节两节锂电池串联充电IC和保护IC
G1垃圾收集器中重要的配置参数及其默认值
Stm32f1 and stm32cubeide programming example - matrix keyboard driver
En parlant d'exception - que se passe - t - il lorsque l'exception est lancée?
Talk about exception again -- what happens when an exception is thrown?
Make an ink screen electronic clock, cool!
codeblocks mingw安装配置问题
再談exception——异常拋出時會發生什麼?
redis和mysql数据不一致问题如何解决?
The English translation of heartless sword Zhu Xi's two impressions of reading