| Index: source/libvpx/vp9/common/vp9_blockd.h
|
| ===================================================================
|
| --- source/libvpx/vp9/common/vp9_blockd.h (revision 232232)
|
| +++ source/libvpx/vp9/common/vp9_blockd.h (working copy)
|
| @@ -20,6 +20,7 @@
|
| #include "vp9/common/vp9_common.h"
|
| #include "vp9/common/vp9_common_data.h"
|
| #include "vp9/common/vp9_enums.h"
|
| +#include "vp9/common/vp9_filter.h"
|
| #include "vp9/common/vp9_mv.h"
|
| #include "vp9/common/vp9_scale.h"
|
| #include "vp9/common/vp9_seg_common.h"
|
| @@ -52,18 +53,10 @@
|
| typedef enum {
|
| KEY_FRAME = 0,
|
| INTER_FRAME = 1,
|
| - NUM_FRAME_TYPES,
|
| + FRAME_TYPES,
|
| } FRAME_TYPE;
|
|
|
| typedef enum {
|
| - EIGHTTAP = 0,
|
| - EIGHTTAP_SMOOTH = 1,
|
| - EIGHTTAP_SHARP = 2,
|
| - BILINEAR = 3,
|
| - SWITCHABLE = 4 /* should be the last one */
|
| -} INTERPOLATIONFILTERTYPE;
|
| -
|
| -typedef enum {
|
| DC_PRED, // Average of above and left pixels
|
| V_PRED, // Vertical
|
| H_PRED, // Horizontal
|
| @@ -101,10 +94,10 @@
|
| modes for the Y blocks to the left and above us; for interframes, there
|
| is a single probability table. */
|
|
|
| -union b_mode_info {
|
| +typedef struct {
|
| MB_PREDICTION_MODE as_mode;
|
| int_mv as_mv[2]; // first, second inter predictor motion vectors
|
| -};
|
| +} b_mode_info;
|
|
|
| typedef enum {
|
| NONE = -1,
|
| @@ -137,7 +130,7 @@
|
| TX_SIZE tx_size;
|
| int_mv mv[2]; // for each reference frame used
|
| int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
|
| - int_mv best_mv, best_second_mv;
|
| + int_mv best_mv[2];
|
|
|
| uint8_t mode_context[MAX_REF_FRAMES];
|
|
|
| @@ -147,14 +140,14 @@
|
| // Flags used for prediction status of various bit-stream signals
|
| unsigned char seg_id_predicted;
|
|
|
| - INTERPOLATIONFILTERTYPE interp_filter;
|
| + INTERPOLATION_TYPE interp_filter;
|
|
|
| BLOCK_SIZE sb_type;
|
| } MB_MODE_INFO;
|
|
|
| typedef struct {
|
| MB_MODE_INFO mbmi;
|
| - union b_mode_info bmi[4];
|
| + b_mode_info bmi[4];
|
| } MODE_INFO;
|
|
|
| static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
|
| @@ -203,23 +196,16 @@
|
| struct scale_factors scale_factor[2];
|
|
|
| MODE_INFO *last_mi;
|
| - MODE_INFO *this_mi;
|
| int mode_info_stride;
|
|
|
| - MODE_INFO *mic_stream_ptr;
|
| -
|
| // A NULL indicates that the 8x8 is not part of the image
|
| MODE_INFO **mi_8x8;
|
| MODE_INFO **prev_mi_8x8;
|
| + MODE_INFO *mi_stream;
|
|
|
| int up_available;
|
| int left_available;
|
| - int right_available;
|
|
|
| - // partition contexts
|
| - PARTITION_CONTEXT *above_seg_context;
|
| - PARTITION_CONTEXT *left_seg_context;
|
| -
|
| /* Distance of MB away from frame edges */
|
| int mb_to_left_edge;
|
| int mb_to_right_edge;
|
| @@ -228,14 +214,10 @@
|
|
|
| int lossless;
|
| /* Inverse transform function pointers. */
|
| - void (*inv_txm4x4_1_add)(int16_t *input, uint8_t *dest, int stride);
|
| - void (*inv_txm4x4_add)(int16_t *input, uint8_t *dest, int stride);
|
| - void (*itxm_add)(int16_t *input, uint8_t *dest, int stride, int eob);
|
| + void (*itxm_add)(const int16_t *input, uint8_t *dest, int stride, int eob);
|
|
|
| struct subpix_fn_table subpix;
|
|
|
| - int allow_high_precision_mv;
|
| -
|
| int corrupted;
|
|
|
| unsigned char sb_index; // index of 32x32 block inside the 64x64 block
|
| @@ -245,72 +227,16 @@
|
|
|
| int q_index;
|
|
|
| + /* Y,U,V,(A) */
|
| + ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
|
| + ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16];
|
| +
|
| + PARTITION_CONTEXT *above_seg_context;
|
| + PARTITION_CONTEXT left_seg_context[8];
|
| } MACROBLOCKD;
|
|
|
| -static INLINE unsigned char *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE subsize) {
|
| - switch (subsize) {
|
| - case BLOCK_64X64:
|
| - case BLOCK_64X32:
|
| - case BLOCK_32X64:
|
| - case BLOCK_32X32:
|
| - return &xd->sb_index;
|
| - case BLOCK_32X16:
|
| - case BLOCK_16X32:
|
| - case BLOCK_16X16:
|
| - return &xd->mb_index;
|
| - case BLOCK_16X8:
|
| - case BLOCK_8X16:
|
| - case BLOCK_8X8:
|
| - return &xd->b_index;
|
| - case BLOCK_8X4:
|
| - case BLOCK_4X8:
|
| - case BLOCK_4X4:
|
| - return &xd->ab_index;
|
| - default:
|
| - assert(0);
|
| - return NULL;
|
| - }
|
| -}
|
|
|
| -static INLINE void update_partition_context(MACROBLOCKD *xd, BLOCK_SIZE sb_type,
|
| - BLOCK_SIZE sb_size) {
|
| - const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
|
| - const int bwl = b_width_log2(sb_type);
|
| - const int bhl = b_height_log2(sb_type);
|
| - const int boffset = b_width_log2(BLOCK_64X64) - bsl;
|
| - const char pcval0 = ~(0xe << boffset);
|
| - const char pcval1 = ~(0xf << boffset);
|
| - const char pcvalue[2] = {pcval0, pcval1};
|
|
|
| - assert(MAX(bwl, bhl) <= bsl);
|
| -
|
| - // update the partition context at the end notes. set partition bits
|
| - // of block sizes larger than the current one to be one, and partition
|
| - // bits of smaller block sizes to be zero.
|
| - vpx_memset(xd->above_seg_context, pcvalue[bwl == bsl], bs);
|
| - vpx_memset(xd->left_seg_context, pcvalue[bhl == bsl], bs);
|
| -}
|
| -
|
| -static INLINE int partition_plane_context(MACROBLOCKD *xd, BLOCK_SIZE sb_type) {
|
| - int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
|
| - int above = 0, left = 0, i;
|
| - int boffset = mi_width_log2(BLOCK_64X64) - bsl;
|
| -
|
| - assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
|
| - assert(bsl >= 0);
|
| - assert(boffset >= 0);
|
| -
|
| - for (i = 0; i < bs; i++)
|
| - above |= (xd->above_seg_context[i] & (1 << boffset));
|
| - for (i = 0; i < bs; i++)
|
| - left |= (xd->left_seg_context[i] & (1 << boffset));
|
| -
|
| - above = (above > 0);
|
| - left = (left > 0);
|
| -
|
| - return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
|
| -}
|
| -
|
| static BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, PARTITION_TYPE partition) {
|
| const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
|
| assert(subsize < BLOCK_SIZES);
|
| @@ -321,7 +247,7 @@
|
|
|
| static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
|
| const MACROBLOCKD *xd, int ib) {
|
| - const MODE_INFO *const mi = xd->this_mi;
|
| + const MODE_INFO *const mi = xd->mi_8x8[0];
|
| const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
|
|
| if (plane_type != PLANE_TYPE_Y_WITH_DC ||
|
| @@ -336,13 +262,13 @@
|
| static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
|
| const MACROBLOCKD *xd) {
|
| return plane_type == PLANE_TYPE_Y_WITH_DC ?
|
| - mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
|
| + mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
|
| }
|
|
|
| static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
|
| const MACROBLOCKD *xd) {
|
| return plane_type == PLANE_TYPE_Y_WITH_DC ?
|
| - mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
|
| + mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
|
| }
|
|
|
| static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
|
| @@ -391,7 +317,7 @@
|
| const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
| foreach_transformed_block_visitor visit, void *arg) {
|
| const struct macroblockd_plane *const pd = &xd->plane[plane];
|
| - const MB_MODE_INFO* mbmi = &xd->this_mi->mbmi;
|
| + const MB_MODE_INFO* mbmi = &xd->mi_8x8[0]->mbmi;
|
| // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
|
| // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
|
| // transform size varies per plane, look it up in a common way.
|
| @@ -520,16 +446,19 @@
|
| }
|
|
|
| if (xd->mb_to_bottom_edge < 0) {
|
| - const int bh = 4 << b_height_log2(plane_bsize);
|
| - const int umv_border_start = bh + (xd->mb_to_bottom_edge >>
|
| - (3 + pd->subsampling_y));
|
| - int i;
|
| - const uint8_t c = buf[(umv_border_start - 1) * stride + x];
|
| - uint8_t *d = &buf[umv_border_start * stride + x];
|
| + if (xd->left_available || x >= 0) {
|
| + const int bh = 4 << b_height_log2(plane_bsize);
|
| + const int umv_border_start =
|
| + bh + (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y));
|
|
|
| - if (y + bh > umv_border_start)
|
| - for (i = 0; i < bh; ++i, d += stride)
|
| - *d = c;
|
| + if (y + bh > umv_border_start) {
|
| + const uint8_t c = buf[(umv_border_start - 1) * stride + x];
|
| + uint8_t *d = &buf[umv_border_start * stride + x];
|
| + int i;
|
| + for (i = 0; i < bh; ++i, d += stride)
|
| + *d = c;
|
| + }
|
| + }
|
| }
|
| }
|
| static void set_contexts_on_border(MACROBLOCKD *xd,
|
| @@ -586,7 +515,7 @@
|
| }
|
| }
|
|
|
| -static int get_tx_eob(struct segmentation *seg, int segment_id,
|
| +static int get_tx_eob(const struct segmentation *seg, int segment_id,
|
| TX_SIZE tx_size) {
|
| const int eob_max = 16 << (tx_size << 1);
|
| return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
|
|
|