Download presentation
Presentation is loading. Please wait.
Published byNoreen Howard Modified over 8 years ago
1
X264 Code Tracing 9762827 陳俊達
2
Outlines x264_macroblock_cache_load x264_ratecontrol_mb x264_macroblock_cache_save x264_cabac_mb_skip macroblock.c/315 cabac.c/6 macroblock.c/163 ratecontrol.c/94 x264_slices_write
3
x264_macroblock_cache_load() Brief: load neighbor info to cache. Input: – x264_t *h; // a structure that save the encoder info. – int i_mb_x, i_mb_y; // MB position inside a frame. Output: – x264_t *h; Caller: x264_slice_write().
4
x264_macroblock_cache_load() init index load cache – load intra4x4 – load non_zero_count – load picture pointers – load ref/mv/mvd – load skip init index load cache load intra4x4 load non_zero_count load picture pointers load ref/mv/mvd load skip Start
5
x264_scan8 To deal with the relative positions between the current Mb and its neighbors, x264 define some arrays with the 48 elements, like – mb.cache.intra4x4_pred_mode, – mb.cache.non_zero_count, – mb.cache. ref, – mb.cache. mv, – mb.cache. mvd Each element in those array means a 4x4 block. static const int x264_scan8[16+2*4+3] = { /* Luma */ 4+1*8, 5+1*8, 4+2*8, 5+2*8, 6+1*8, 7+1*8, 6+2*8, 7+2*8, 4+3*8, 5+3*8, 4+4*8, 5+4*8, 6+3*8, 7+3*8, 6+4*8, 7+4*8, /* Cb */ 1+1*8, 2+1*8, 1+2*8, 2+2*8, /* Cr */ 1+4*8, 2+4*8, 1+5*8, 2+5*8, /* Luma DC */ 4+5*8, /* Chroma DC */ 5+5*8, 6+5*8 }; 01234567 89101112131415 1617181920212223 2425262728293031 3233343536373839 40414243444547
6
Indexing of mb.pred_mode and mb.non_zero_count mb.intra4x4_pred_mode 0123 4 5 6 3 0123 4567 891011 12131415 1617 1819 2021 2223 mb.non_zero_count Y Cb Cr
7
pred_mode and non_zero_count : top
8
pred_mode and non_zero_count: left
9
pred_mode and non_zero_count: topright and topleft
10
i_neighbour8 and i_neighbour4 0145 2367 891213 10111415 01 23 i_neighbour8 records whether the intra neighbors of each 8x8 block that are available i_neighbour4 records whether the intra neighbors of each 4x4 block that are available we can determine their neighbors by i_neighbour_intra (16x16 block) Indexing of i_neighbour8Indexing of i_neighbour4
11
x264_macroblock_cache_save() Brief: save neighbor info. Input: – x264_t *h; // a structure that save the encoder info. Output: – x264_t *h; Caller: x264_slice_write().
12
x264_macroblock_cache_save() save cache – save intra4x4 – save non zero count – save picture pointers – save ref/mv/mvd – save skip Start save cache save intra4x4 save non_zero_count save picture pointers save ref/mv/mvd save skip
13
x264_cabac_mb_skip() Brief: Deal with skip MB in RDO CABAC. Encode the mb_skip_flag of P, SP, or B slice Input: – x264_t *h; // a structure that save the encoder info. – int b_skip; // mb_skip_flag Output: – x264_t *h; Caller: x264_slice_write().
14
x264_cabac_mb_skip() Deal with skip MB in RDO CABAC Encode the mb_skip_flag of P, SP, or B slice
15
x264_ratecontrol_mb() Brief: Row MB level rate control Input: – x264_t *h; // a structure that save the encoder info. – int bits; // mb bit size Output: – x264_t *h; Caller: x264_slice_write().
16
x264_ratecontrol_mb() Update row QP Start Row MB level rate control: Modify the row QPs when a sufficient amount of the bits of the frame have been processed. Is it the last MB in a row? Yes Check QP range Modify QP
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.