X 264 Code Tracing 9762827 Outlines x 264macroblockcacheload
X 264 Code Tracing 9762827 陳俊達
Outlines x 264_macroblock_cache_load macroblock. c/315 x 264_slices_write x 264_cabac_mb_skip cabac. c/6 x 264_macroblock_cache_save macroblock. c/163 x 264_ratecontrol_mb ratecontrol. c/94
x 264_macroblock_cache_load() • Brief: load neighbor info to cache. • Input: – x 264_t *h; // a structure that save the encoder info. – int i_mb_x, i_mb_y; // MB position inside a frame. • Output: – x 264_t *h; • Caller: x 264_slice_write().
x 264_macroblock_cache_load() • init index • load cache – load intra 4 x 4 – load non_zero_count – load picture pointers – load ref/mv/mvd – load skip Start init index load cache load intra 4 x 4 load non_zero_count load picture pointers load ref/mv/mvd load skip
x 264_scan 8 • To deal with the relative positions between the current Mb and its neighbors, x 264 define some arrays with the 48 elements, like – – – • mb. cache. intra 4 x 4_pred_mode, mb. cache. non_zero_count, mb. cache. ref, mb. cache. mvd static const int x 264_scan 8[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, Each element in those array means a 4 x 4 block. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 47 /* 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 };
Indexing of mb. pred_mode and mb. non_zero_count mb. intra 4 x 4_pred_mode mb. non_zero_count 4 5 6 3 0 1 2 3 Cb Y 16 17 18 19 0 1 2 3 4 5 6 7 8 9 10 11 Cr 12 13 14 15 20 21 22 23
pred_mode and non_zero_count : top
pred_mode and non_zero_count: left
pred_mode and non_zero_count: topright and topleft
i_neighbour 8 and i_neighbour 4 • i_neighbour 8 records whether the intra neighbors of each 8 x 8 block that are available • i_neighbour 4 records whether the intra neighbors of each 4 x 4 block that are available • we can determine their neighbors by i_neighbour_intra (16 x 16 block) 0 2 1 3 Indexing of i_neighbour 8 0 1 4 5 2 3 6 7 8 9 12 13 10 11 14 15 Indexing of i_neighbour 4
x 264_macroblock_cache_save() • Brief: save neighbor info. • Input: – x 264_t *h; // a structure that save the encoder info. • Output: – x 264_t *h; • Caller: x 264_slice_write().
x 264_macroblock_cache_save() • save cache – save intra 4 x 4 – save non zero count – save picture pointers – save ref/mv/mvd – save skip Start save cache save intra 4 x 4 save non_zero_count save picture pointers save ref/mv/mvd save skip
x 264_cabac_mb_skip() • Brief: Deal with skip MB in RDO CABAC. Encode the mb_skip_flag of P, SP, or B slice • Input: – x 264_t *h; // a structure that save the encoder info. – int b_skip; // mb_skip_flag • Output: – x 264_t *h; • Caller: x 264_slice_write().
x 264_cabac_mb_skip() • Deal with skip MB in RDO CABAC • Encode the mb_skip_flag of P, SP, or B slice
x 264_ratecontrol_mb() • Brief: Row MB level rate control • Input: – x 264_t *h; // a structure that save the encoder info. – int bits; // mb bit size • Output: – x 264_t *h; • Caller: x 264_slice_write().
x 264_ratecontrol_mb() Row MB level rate control: Modify the row QPs when a sufficient amount of the bits of the frame have been processed. Start Update row QP Is it the last MB in a row? Yes Check QP range Modify QP
- Slides: 16