Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS553300 多媒體編碼技術導論 P ROJECT II H.264 C ODE T RACING x264_macroblock_write_cabac 9862515 朱逸樵.

Similar presentations


Presentation on theme: "CS553300 多媒體編碼技術導論 P ROJECT II H.264 C ODE T RACING x264_macroblock_write_cabac 9862515 朱逸樵."— Presentation transcript:

1 CS553300 多媒體編碼技術導論 P ROJECT II H.264 C ODE T RACING x264_macroblock_write_cabac 9862515 朱逸樵

2 O UTLINE Introduction Function Overview Lossless Coding Intra Coding P/B Frame Coding Write Residual 2

3 I NTRODUCTION (1/2) Slice Syntax 3

4 I NTRODUCTION (2/2) x264_macroblock_write_cabac() Call by x264_slice_write() Encode 16x16 MB based on MB type Intra-frame prediction Inter-frame prediction in P slice Inter-frame prediction in B slice 4

5 F UNCTION O VERVIEW (1/2) 5 I_PCM Lossless Coding i_mb_type INTRAP_L0P_8x8B_8x8!B_DIRECT Write Mode & chroma Write ref &MVD Write ref &MVD Write ref &MVD Write ref &MVD Write Residual Write MB Header No Yes

6 F UNCTION O VERVIEW (2/2) Encode in sequence as slice syntax show i_mb_type define different mb type Different mb type different accuracy write Call a function write byte x264_cabac_encode_decision() 6 mb_typemb_predCoded residual

7 L OSSLESS C ODING (1/1) By pass CABAC Copy macro block to stream Write to buffer for next reference Reinitialize CABAC variables 7

8 I NTRA F RAME C ODING (1/3) Intra frame prediction has different type I_16x16, I_8x8, I_4x4 I_16x16 together with chroma prediction Suit for smooth areas of a picture 8

9 I NTRA F RAME C ODING (2/3) If mb type is I_8x8 or I_4x4 Find predict intra mode i_pred x264_mb_predict_intra4x4_mode() Find real intra mode i_mode x264_mb_pred_mode4x4_fix() Write mode to stream x264_cabac_mb_intra4x4_pred_mode() decide based on i_pred and i_mode 9 Intra chroma pred mode Write intra predict mode Find intra mode Find intra caculate mode I_16x16 No Yes Write transform size

10 I NTRA F RAME C ODING (3/3) Encode chorma x264_cabac_mb_intra_chroma_pred_mode() Especially for I_8x8 10 Intra chroma pred mode Write intra predict mode Find intra mode Find intra caculate mode I_16x16 No Yes Write transform size

11 I NTER F RAME C ODING (1/8) Inter –frame prediction in P slices P_L0 11 16 88 8 8

12 I NTER F RAME C ODING (2/8) Inter –frame prediction in P slices P_8x8 12 8 8 88 8 48 4 44 4 4 8 8 subtype

13 I NTER F RAME C ODING (3/8) P_L0 done by two function If reference previous frame then write reference x264_cabac_mb_ref() Write mvd x264_cabac_mb_mvd() P_8x8 more complicate because of subtype D_L0_8x8, D_L0_8x4, D_L0_4x8, D_L0_4x4 13

14 I NTER F RAME C ODING (4/8) P_L0 encode flow 14 D_16x16D_16x8 Write MVD Ref Write MVD Write Ref No Yes No Yes No Yes No Yes No 16 88 8 8

15 I NTER F RAME C ODING (5/8) P_8x8 done by three function Write sub partition for each 8*8 mb x264_cabac_mb_sub_p_partitionI() If reference previous frame then write reference x264_cabac_mb_ref() Write mvd based on different sub partition x264_cabac_mb8x8_mvd() 15 Write sub partition Ref 8 8 88 Write MVD Write Ref Yes No

16 I NTER F RAME C ODING (6/8) Inter –frame prediction in B slices B_8x8 D_DIRECT_8x8, D_BI_8x8, D_L0_8x8, D_L1_8x8 D_DIRECT_8x8 write nothing All other B mode except B_DIRECT D_16x16, D_16x8, D_8x16 B slices reference bidirectional frame h->mb.pic.i_fref[0] backward reference h->mb.pic.i_fref[1] forward reference 16

17 I NTER F RAME C ODING (7/8) B_8x8 done by following steps Write sub partition for each 8*8 mb x264_cabac_mb_sub_b_partition() Write forward and/or backward reference x264_cabac_mb_ref() Write forward and/or backward mvd x264_cabac_mb_mvd() 17 Wrtie sub partition Forward Ref Wrtie Ref Backward Ref Wrtie Ref Forward Ref Wrtie MVD Backward Ref Wrtie MVD Yes No Yes No Yes No Yes No

18 I NTER F RAME C ODING (8/8) All other B mode done by following steps Write forward and/or backward reference x264_cabac_mb_ref() If D_8x16 or D_16x8 write twice for each mb Write forward and/or backward mvd x264_cabac_mb_mvd() 18

19 W RITE R ESIDUAL (1/3) Write coded block pattern luma and chroma For all except I_16x16 x264_cabac_mb_cbp_luma x264_cabac_mb_cbp_chroma If MB size equal or smaller than 8x8 Write this information x264_cabac_mb_transform_size 19

20 W RITE R ESIDUAL (2/3) Write residual - luma I_16x16 Write DCT_LUMA_DC and DCT_LUMA_AC block_residual_write_cabac_cbf transform_8x8 block_residual_write_cabac_8x8 Others block_residual_write_cabac_cbf 20

21 W RITE R ESIDUAL (3/3) Write residual – chroma If cbp shows chroma write chroma DC and AC block_residual_write_cabac_cbf 21


Download ppt "CS553300 多媒體編碼技術導論 P ROJECT II H.264 C ODE T RACING x264_macroblock_write_cabac 9862515 朱逸樵."

Similar presentations


Ads by Google