1. x264_param_default设置默认参数
  2. Parse参数解析
  3. signalCtrl+C句柄关联设置
  4. Encode编码
    1. p_get_frame_total
    2. x264_encoder_open编码前的初始化与设置
      1. x264_validate_parameters验证参数有效性并设置
      2. x264_cqm_parse_file解析量化矩阵
      3. x264_sps_init序列参数集初始化
      4. x264_pps_init图像参数集初始化
      5. x264_validate_levels检查级别的有效性
      6. x264_cqm_init量化矩阵初始化
      7. x264_rdo_init CABAC表的初始化
      8. x264_predict_16x16_init帧内16*16 预测
      9. x264_predict_8x8c_init帧内色度预测
      10. x264_predict_8x8_init帧内8*8 预测
      11. x264_predict_4x4_init帧内4*4 预测
      12. x264_init_vlc_tablesVLC表
      13. x264_pixel_initSAD/satd等设置
      14. x264_dct_initDCT 变换
      15. x264_zigzag_initzigzag 扫描
      16. x264_mc_init运动补偿
      17. x264_quant_init量化
      18. x264_deblock_init去块滤波
      19. x264_dct_init_weightsdct变换的权重设置
      20. mbcmp_initmb宏块比较初始化
      21. x264_ratecontrol_new 创建码率控制结构体并初始化
    3. p_set_outfile_param
    4. x264_picture_alloc
    5. for( ;; )
      1. p_read_frame
      2. parse_qpfile
      3. Encode_frame
        1. x264_encoder_encode编码器编码
          1. 线程上下文同步
          2. x264_reference_update
          3. x264_frame_push_unused
          4. x264_frame_pop_unused
          5. x264_frame_push
          6. x264_frame_push_unused
          7. x264_frame_pop_unused
          8. x264_frame_pop_unused
          9. x264_frame_copy_picture
          10. x264_frame_expand_border_mod16
          11. x264_frame_push
          12. x264_frame_init_lowres
          13. x264_adaptive_quant_frame
          14. x264_encoder_frame_end
          15. x264_stack_align
          16. x264_frame_push
          17. x264_frame_shift
          18. 编码实体do_encode<标签非函数>↓
          19. x264_reference_reset
          20. 设置nal类型、参考等级、片头类型
          21. x264_reference_build_list
          22. build ref list 0/1
          23. Order ref0 from higher to lower poc
          24. Order ref1 from lower to higher poc (bubble sort) for B-frame
          25. In the standard, a P-frame's ref list is sorted by frame_num.
          26. x264_ratecontrol_start
          27. get_zone
          28. x264_encoder_reconfig
          29. 统计在本帧是P帧的情况下,其前面连续的B帧的数目
          30. 由各种不同的slice类型及vbv等参数获取的q值
          31. accum_p_qp_update
          32. x264_ratecontrol_qp
          33. x264_macroblock_bipred_init
          34. x264_slice_init
          35. x264_slice_header_init
          36. x264_macroblock_slice_init
          37. bs_init初始化比特流上下文
          38. x264_nal_start
          39. bs_write
          40. bs_rbsp_trailing
          41. x264_nal_end
          42. Write SPS and PPS
          43. x264_nal_start
          44. x264_sei_version_write
          45. x264_sps_write
          46. x264_pps_write
          47. x264_nal_end
          48. x264_pthread_create
          49. x264_slices_write
          50. x264_stack_align
          51. x264_slice_write
          52. x264_nal_start
          53. x264_slice_header_write
          54. bs_write_ue
          55. bs_write
          56. bs_write1
          57. bs_write_se
          58. bs_align_1
          59. x264_cabac_context_init
          60. x264_cabac_encode_init
          61. 循环对整个图像的每个宏块进行编码
          62. bs_pos
          63. x264_cabac_pos
          64. x264_fdec_filter_row
          65. x264_frame_deblock_row
          66. x264_frame_expand_border
          67. x264_frame_filter
          68. integral_init4h
          69. integral_init4v
          70. integral_init8h
          71. integral_init8v
          72. x264_frame_expand_border_filtered
          73. plane_expand_border
          74. x264_frame_cond_broadcast
          75. x264_macroblock_cache_load
          76. 首先初始化和当前宏块毗邻的已解码块
          77. 如果有有效的TOP-MB
          78. 同MB_TOP, 装入LEFT-MB相关参数
          79. 同MB_TOP,装入MB_TOPRIGHT相邻MB的相关参数
          80. 同MB_TOP,装入MB_TOPLEFT相邻MB的相关参数
          81. 装入编码图像块和参考图像数据
          82. 搬移重建数据到参考数据位置, 行方向的参考数据未搬移
          83. 运动向量、参考图像装入. 分成TOP, TOPLEFT, TOPRIGHT, LEFT
          84. x264_macroblock_cache_skip
          85. x264_mb_predict_mv_pskip
          86. x264_macroblock_analyse
          87. x264_ratecontrol_qp
          88. x264_adaptive_quant
          89. x264_mb_analyse_init
          90. 对不同类型的块采用不同的处理步骤
          91. 对于I帧采用帧内编码,其没有采用运动估计
          92. x264_mb_cache_fenc_satd
          93. x264_mb_analyse_intra
          94. x264_intra_rd
          95. 比较得到最佳的帧内预测模式
          96. x264_intra_rd_refine
          97. P模式(P模式内包括I模式,而B模式仅是P模式的简单延伸)
          98. prefetch_ref
          99. x264_macroblock_probe_pskip
          100. x264_mb_analyse_load_costs
          101. x264_mb_analyse_inter_p16x16
          102. x264_mb_analyse_inter_p8x8_mixed_ref
          103. x264_mb_analyse_inter_p8x8
          104. 如果8×8代价值小于16×16, 则进行子宏块分割的判断
          105. x264_mb_analyse_inter_p4x4
          106. x264_mb_analyse_inter_p8x4
          107. x264_mb_analyse_inter_p4x8
          108. x264_mb_cache_mv_p8x8
          109. 检测16×8和8×16模式
          110. x264_mb_analyse_inter_p16x8
          111. x264_mb_analyse_inter_p8x16
          112. 帧间模式选择后, 对该模式进行亚象素精细搜索, 以进一步减少误差
          113. x264_me_refine_qpel
          114. 分析宏块的帧内编码,包括亮度和色度
          115. x264_mb_analyse_intra_chroma
          116. x264_mb_analyse_intra
          117. x264_mb_analyse_p_rd
          118. x264_mb_analyse_transform_rd
          119. x264_intra_rd
          120. 比较得到最佳的帧内预测模式
          121. x264_intra_rd_refine
          122. x264_macroblock_cache_ref
          123. x264_me_refine_qpel_rd
          124. B模式(其仅是P模式的简单延伸).
          125. x264_mb_predict_mv_direct16x16
          126. x264_mb_mc
          127. x264_macroblock_probe_bskip
          128. x264_mb_predict_mv_direct16x16
          129. x264_macroblock_probe_bskip
          130. x264_mb_analyse_load_costs
          131. x264_mb_analyse_inter_direct
          132. x264_mb_analyse_inter_b16x16
          133. x264_mb_analyse_b_rd
          134. x264_analyse_update_cache
          135. x264_mb_analyse_inter_b8x8
          136. x264_mb_analyse_inter_b16x8
          137. x264_mb_analyse_inter_b8x16
          138. x264_me_refine_qpel
          139. x264_mb_analyse_b_rd
          140. x264_mb_analyse_intra
          141. x264_mb_analyse_transform_rd
          142. x264_intra_rd
          143. x264_intra_rd_refine
          144. x264_refine_bidir
          145. x264_analyse_update_cache
          146. x264_me_refine_qpel_rd
          147. x264_analyse_update_cache
          148. x264_mb_analyse_transform
          149. x264_psy_trellis_init
          150. x264_macroblock_encode
          151. P_SKIP
          152. x264_macroblock_encode_pskip
          153. B_SKIP
          154. x264_mb_mc
          155. x264_macroblock_encode_skip
          156. I_16x16
          157. x264_predict_lossless_16x16
          158. 用函数指针h->predict_16x16[i_mode]进行帧内预测
          159. x264_mb_encode_i16x16
          160. I_8x8
          161. x264_predict_8x8_filter
          162. x264_predict_lossless_8x8
          163. 用函数指针完成4个宏块的帧内预测
          164. x264_mb_encode_i8x8
          165. I_4x4
          166. x264_predict_lossless_4x4
          167. 用函数指针完成4个宏块的帧内预测
          168. x264_mb_encode_i4x4
          169. Inter MB
          170. x264_mb_mc
          171. 然后分多种情形
          172. 无损压缩情况
          173. sub_8x8
          174. sub_4x4
          175. 指定采用8x8DCT情况
          176. sub16x16_dct8
          177. 对4个8x8的DCT系数块进行处理:包括可能的去噪x264_denoise_dct,量化(标量/矢量)
          178. denoise_dct
          179. x264_quant_8x8
          180. scan_8x8
          181. dequant_8x8
          182. add8x8_idct8
          183. 对一般情况的处理
          184. sub16x16_dct
          185. denoise_dct
          186. x264_quant_4x4
          187. scan_4x4
          188. dequant_4x4
          189. decimate_score16
          190. add8x8_idct
          191. 对色度块编码
          192. 处理色差分量,如果是Intra的则进行预测
          193. x264_predict_lossless_8x8_chroma色度块8*8无损预测
          194. 如果是Intra的则进行预测
          195. x264_mb_encode_8x8_chroma
          196. 存储宏块编码模式,以待下次使用或参考
          197. x264_bitstream_check_buffer
          198. 处理码流输出,分CABAC和CAVLC两种情况
          199. x264_cabac_encode_terminal
          200. x264_cabac_mb_skip
          201. x264_macroblock_write_cabac
          202. x264_cabac_mb_type
          203. IS_SKIP
          204. x264_cabac_encode_decision_noup
          205. SLICE_TYPE_I
          206. x264_cabac_mb_type_intra
          207. SLICE_TYPE_P
          208. P_L0
          209. x264_cabac_encode_decision_noup
          210. D_16x16
          211. D_16x8
          212. D_8x16
          213. P_8x8
          214. x264_cabac_encode_decision_noup
          215. intra
          216. x264_cabac_encode_decision_noup
          217. x264_cabac_mb_type_intra
          218. SLICE_TYPE_B
          219. B_DIRECT
          220. x264_cabac_encode_decision_noup
          221. B_8x8
          222. x264_cabac_encode_decision_noup
          223. x264_cabac_encode_decision
          224. IS_INTRA
          225. x264_cabac_encode_decision_noup
          226. x264_cabac_encode_decision
          227. x264_cabac_mb_type_intra
          228. else{}
          229. x264_cabac_encode_decision_noup
          230. x264_cabac_encode_decision
          231. IS_INTRA
          232. x264_cabac_mb_transform_size
          233. x264_mb_predict_intra4x4_mode
          234. x264_mb_pred_mode4x4_fix
          235. x264_cabac_mb_intra4x4_pred_mode
          236. x264_cabac_mb_intra_chroma_pred_mode
          237. P_L0
          238. D_16x16
          239. x264_cabac_mb_ref
          240. x264_cabac_mb_mvd
          241. D_16x8
          242. x264_cabac_mb_ref
          243. x264_cabac_mb_mvd
          244. D_8x16
          245. x264_cabac_mb_ref
          246. x264_cabac_mb_mvd
          247. P_8x8
          248. x264_cabac_mb_sub_p_partition
          249. x264_cabac_mb_ref
          250. x264_cabac_mb8x8_mvd
          251. B_8x8
          252. x264_cabac_mb_sub_b_partition
          253. x264_cabac_mb_ref
          254. x264_cabac_mb8x8_mvd
          255. B_DIRECT
          256. D_16x16
          257. x264_cabac_mb_ref
          258. x264_cabac_mb_mvd
          259. D_16x8
          260. x264_cabac_mb_ref
          261. x264_cabac_mb_mvd
          262. D_8x16
          263. x264_cabac_mb_ref
          264. x264_cabac_mb_mvd
          265. x264_cabac_mb_cbp_luma
          266. x264_cabac_mb_cbp_chroma
          267. x264_mb_transform_8x8_allowed
          268. x264_cabac_mb_transform_size
          269. x264_cabac_mb_qp_delta
          270. block_residual_write_cabac
          271. block_residual_write_cabac_8x8
          272. bs_write_ue
          273. x264_macroblock_write_cavlc
          274. Write: - type - prediction - mv
          275. IS_SKIP
          276. bs_write1
          277. I_4x4 I_8x8
          278. bs_write_ue
          279. bs_write1
          280. x264_mb_predict_intra4x4_mode
          281. x264_mb_pred_mode4x4_fix
          282. I_16x16
          283. bs_write_ue
          284. P_L0
          285. D_16x16
          286. bs_write_ue
          287. bs_write_te
          288. x264_mb_predict_mv
          289. bs_write_se
          290. D_16x8
          291. bs_write_ue
          292. bs_write_te
          293. x264_mb_predict_mv
          294. bs_write_se
          295. D_8x16
          296. bs_write_ue
          297. bs_write_te
          298. x264_mb_predict_mv
          299. bs_write_se
          300. P_8x8
          301. bs_write_ue
          302. bs_write
          303. bs_write_te
          304. cavlc_mb8x8_mvd
          305. B_8x8
          306. bs_write_ue
          307. bs_write_te
          308. cavlc_mb8x8_mvd
          309. !B_DIRECT
          310. bs_write_ue
          311. bs_write_te
          312. B_DIRECT
          313. bs_write_ue
          314. Coded block patern
          315. bs_write_ue
          316. transform size 8x8 flag
          317. x264_mb_transform_8x8_allowed
          318. bs_write1
          319. write residual
          320. cavlc_qp_delta
          321. block_residual_write_cavlc
          322. x264_macroblock_luma_write_cavlc
          323. x264_macroblock_cache_save
          324. x264_macroblock_store_pic
          325. x264_prefetch_fenc
          326. prefetch_fenc
          327. save intra4x4
          328. save I_PCM
          329. save non zero count
          330. 更新宏块统计
          331. x264_ratecontrol_mb
          332. row_bits_so_far
          333. x264_ratecontrol_set_estimated_size
          334. update_predictor
          335. predict_row_size_sum
          336. row_bits_so_far
          337. x264_cabac_encode_flush
          338. x264_cabac_putbyte
          339. bs_write_ue
          340. bs_rbsp_trailing
          341. x264_nal_end
          342. x264_fdec_filter_row
          343. x264_frame_deblock_row
          344. x264_frame_expand_border
          345. x264_frame_filter
          346. integral_init4h
          347. integral_init4v
          348. integral_init8h
          349. integral_init8v
          350. x264_frame_expand_border_filtered
          351. plane_expand_border
          352. x264_frame_cond_broadcast
          353. bs_pos
          354. x264_frame_sort_pts
          355. x264_frame_sort
          356. x264_frame_unshift
          357. x264_frame_push
          358. x264_encoder_frame_end
          359. x264_frame_push_unused
          360. 终止比特流,设置输出
          361. 设置输出图像的属性
          362. 更新编码器的状态
          363. 更新码率控制部分
          364. x264_ratecontrol_end
          365. 统计i p b类型的Mb的个数,并计算平均QP
          366. 恢复CPU状态(即使用Float运算前).
          367. x264_emms
          368. 去噪更新
          369. x264_noise_reduction_update
          370. Compute/Print statistics
          371. x264_thread_sync_stat
          372. x264_frame_dump
        2. NALU封装
          1. 处理NALU溢出
          2. x264_free
          3. x264_malloc
          4. x264_nal_encode NAL层编码
          5. 进行字节流格式的码流编码
          6. 长的开始前缀码
          7. NAL头部
          8. 脱壳操作,防止竞争
          9. 计算处理的数据长度,返回
          10. p_write_nalu写NALU到比特流文件中
          11. p_set_eop
    6. Encode_frameB帧编码-Flush delayed B-frames
      1. Encode_frame
    7. x264_picture_clean
      1. x264_free
    8. x264_encoder_close
      1. 做一些清理工作,主要是释放空间
      2. x264_pthread_join
      3. x264_frame_delete
      4. x264_log
      5. x264_print_intra
      6. x264_ratecontrol_summary
      7. x264_ratecontrol_delete
      8. x264_frame_delete
      9. x264_macroblock_cache_end
      10. x264_free
    9. x264_free
    10. p_close_infile
    11. p_close_outfile
    12. 计算fps并打印