| |
| |
| #### 11.2 Luma Modes {#h-11-02} |
| |
| |
| First comes the luma specification of type `intra_mbmode`, coded using the `kf_ymode_tree`, as described in Chapter 8 and repeated here for convenience: |
| |
| |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| typedef enum |
| { |
| DC_PRED, /* predict DC using row above and column to the left */ |
| V_PRED, /* predict rows using row above */ |
| H_PRED, /* predict columns using column to the left */ |
| TM_PRED, /* propagate second differences a la "True Motion" */ |
| |
| B_PRED, /* each Y subblock is independently predicted */ |
| |
| num_uv_modes = B_PRED, /* first four modes apply to chroma */ |
| num_ymodes /* all modes apply to luma */ |
| } |
| intra_mbmode; |
| |
| const tree_index kf_ymode_tree [2 * (num_ymodes - 1)] = |
| { |
| -B_PRED, 2, /* root: B_PRED = "0", "1" subtree */ |
| 4, 6, /* "1" subtree has 2 descendant subtrees */ |
| -DC_PRED, -V_PRED, /* "10" subtree: DC_PRED = "100", |
| V_PRED = "101" */ |
| -H_PRED, -TM_PRED /* "11" subtree: H_PRED = "110", |
| TM_PRED = "111" */ |
| }; |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| {:lang="c"} |
| |
| |
| For key frames, the Y mode is decoded using a fixed probability array as follows: |
| |
| |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| const Prob kf_ymode_prob [num_ymodes - 1] = { 145, 156, 163, 128}; |
| Ymode = (intra_mbmode) treed_read( d, kf_ymode_tree, kf_ymode_prob); |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| {:lang="c"} |
| |
| |
| `d` is of course the `bool_decoder` being used to read the first data partition. |
| |
| If the Ymode is `B_PRED`, it is followed by a (tree-coded) mode for each of the 16 Y subblocks. The 10 subblock modes and their coding tree as follows: |
| |
| |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| typedef enum |
| { |
| B_DC_PRED, /* predict DC using row above and column |
| to the left */ |
| B_TM_PRED, /* propagate second differences a la |
| "True Motion" */ |
| |
| B_VE_PRED, /* predict rows using row above */ |
| B_HE_PRED, /* predict columns using column to the left */ |
| |
| B_LD_PRED, /* southwest (left and down) 45 degree diagonal |
| prediction */ |
| B_RD_PRED, /* southeast (right and down) "" */ |
| |
| B_VR_PRED, /* SSE (vertical right) diagonal prediction */ |
| B_VL_PRED, /* SSW (vertical left) "" */ |
| B_HD_PRED, /* ESE (horizontal down) "" */ |
| B_HU_PRED, /* ENE (horizontal up) "" */ |
| |
| num_intra_bmodes |
| } |
| intra_bmode; |
| |
| /* Coding tree for the above, with implied codings as comments */ |
| |
| const tree_index bmode_tree [2 * (num_intra_bmodes - 1)] = |
| { |
| -B_DC_PRED, 2, /* B_DC_PRED = "0" */ |
| -B_TM_PRED, 4, /* B_TM_PRED = "10" */ |
| -B_VE_PRED, 6, /* B_VE_PRED = "110" */ |
| 8, 12, |
| -B_HE_PRED, 10, /* B_HE_PRED = "11100" */ |
| -B_RD_PRED, -B_VR_PRED, /* B_RD_PRED = "111010", |
| B_VR_PRED = "111011" */ |
| -B_LD_PRED, 14, /* B_LD_PRED = "111110" */ |
| -B_VL_PRED, 16, /* B_VL_PRED = "1111110" */ |
| -B_HD_PRED, -B_HU_PRED /* HD = "11111110", |
| HU = "11111111" */ |
| }; |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| {:lang="c"} |
| |
| |
| The first four modes are smaller versions of the similarly-named 16x16 modes above, albeit with slightly different numbering. The last six "diagonal" modes are unique to luma subblocks. |
| |