vp9_block.h revision 6ac915abcdb404a00d927fe6308a47fcf09d9519
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/*
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  Use of this source code is governed by a BSD-style license
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  that can be found in the LICENSE file in the root of the source
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  tree. An additional intellectual property rights grant can be found
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  in the file PATENTS.  All contributing project authors may
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *  be found in the AUTHORS file in the root of the source tree.
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef VP9_ENCODER_VP9_BLOCK_H_
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define VP9_ENCODER_VP9_BLOCK_H_
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "vp9/common/vp9_entropymv.h"
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "vp9/common/vp9_entropy.h"
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "vpx_ports/mem.h"
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "vp9/common/vp9_onyxc_int.h"
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifdef __cplusplus
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)extern "C" {
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// motion search site
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef struct {
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MV mv;
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int offset;
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} search_site;
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Structure to hold snapshot of coding context during the mode picking process
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef struct {
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MODE_INFO mic;
3258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  uint8_t *zcoeff_blk;
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *coeff[MAX_MB_PLANE][3];
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *qcoeff[MAX_MB_PLANE][3];
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *dqcoeff[MAX_MB_PLANE][3];
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  uint16_t *eobs[MAX_MB_PLANE][3];
37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // dual buffer pointers, 0: in use, 1: best in store
39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int16_t *coeff_pbuf[MAX_MB_PLANE][3];
40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int16_t *qcoeff_pbuf[MAX_MB_PLANE][3];
41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  int is_coded;
4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  int num_4x4_blk;
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int skip;
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int_mv best_ref_mv[2];
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int rate;
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int distortion;
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  int best_mode_index;
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int rddiv;
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int rdmult;
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int hybrid_pred_diff;
552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int comp_pred_diff;
562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int single_pred_diff;
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int64_t tx_rd_diff[TX_MODES];
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // motion vector cache for adaptive motion search control in partition
612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // search loop
622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int_mv pred_mv[MAX_REF_FRAMES];
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  INTERP_FILTER pred_interp_filter;
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} PICK_MODE_CONTEXT;
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct macroblock_plane {
67f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
68f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int16_t *qcoeff;
692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *coeff;
702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  uint16_t *eobs;
712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  struct buf_2d src;
722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Quantizer setings
742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *quant;
752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *quant_shift;
762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *zbin;
772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t *round;
782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Zbin Over Quant value
802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int16_t zbin_extra;
812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* The [2] dimension is for whether we skip the EOB node (i.e. if previous
842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * coefficient in this block was zero) or not. */
852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2]
862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   [COEFF_CONTEXTS][ENTROPY_TOKENS];
872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef struct macroblock MACROBLOCK;
89f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)struct macroblock {
90f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  struct macroblock_plane plane[MAX_MB_PLANE];
91f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
92f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  MACROBLOCKD e_mbd;
93f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int skip_block;
94f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int select_txfm_size;
952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int skip_recode;
962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int skip_optimize;
97f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int q_index;
982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  search_site *ss;
1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int ss_count;
1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int searches_per_step;
1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int errorperbit;
1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int sadperbit16;
1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int sadperbit4;
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int rddiv;
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int rdmult;
1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned int mb_energy;
1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned int *mb_activity_ptr;
1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int *mb_norm_activity_ptr;
1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  signed int act_zbin_adj;
1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mv_best_ref_index[MAX_REF_FRAMES];
1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned int max_mv_context[MAX_REF_FRAMES];
1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned int source_variance;
1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned int pred_sse[MAX_REF_FRAMES];
1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int pred_mv_sad[MAX_REF_FRAMES];
1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvjointcost[MV_JOINTS];
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvcosts[2][MV_VALS];
1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int *nmvcost[2];
1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvcosts_hp[2][MV_VALS];
1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int *nmvcost_hp[2];
1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int **mvcost;
1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvjointsadcost[MV_JOINTS];
1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvsadcosts[2][MV_VALS];
1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int *nmvsadcost[2];
1292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int nmvsadcosts_hp[2][MV_VALS];
1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int *nmvsadcost_hp[2];
1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int **mvsadcost;
1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mbmode_cost[INTRA_MODES];
1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES];
1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES];
1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned char sb_index;   // index of 32x32 block inside the 64x64 block
1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned char mb_index;   // index of 16x16 block inside the 32x32 block
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned char b_index;    // index of 8x8 block inside the 16x16 block
1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  unsigned char ab_index;   // index of 4x4 block inside the 8x8 block
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
14458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // These define limits to motion vector components to prevent them
1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // from extending outside the UMV borders
1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mv_col_min;
1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mv_col_max;
1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mv_row_min;
1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int mv_row_max;
1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  uint8_t zcoeff_blk[TX_SIZES][256];
1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int skip;
1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int encode_breakout;
1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int in_active_map;
1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // note that token_costs is the cost when eob node is skipped
1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  vp9_coeff_cost token_costs[TX_SIZES];
1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int optimize;
1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // indicate if it is in the rd search loop or encoding process
1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int use_lp32x32fdct;
16558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  int skip_encode;
1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Used to store sub partition's choices.
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int_mv pred_mv[MAX_REF_FRAMES];
1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
17058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // TODO(jingning): Need to refactor the structure arrays that buffers the
1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // coding mode decisions of each partition type.
1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT ab4x4_context[4][4][4];
1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb8x4_context[4][4][4];
1742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb4x8_context[4][4][4];
1752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb8x8_context[4][4][4];
1762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb8x16_context[4][4][2];
1772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb16x8_context[4][4][2];
1782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT mb_context[4][4];
1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb32x16_context[4][2];
1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb16x32_context[4][2];
181f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // when 4 MBs share coding parameters:
1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb32_context[4];
1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb32x64_context[2];
1842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb64x32_context[2];
1852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PICK_MODE_CONTEXT sb64_context;
1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
1872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
188a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  BLOCK_SIZE b_partitioning[4][4][4];
189a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  BLOCK_SIZE mb_partitioning[4][4];
190a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  BLOCK_SIZE sb_partitioning[4];
1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  BLOCK_SIZE sb64_partitioning;
1922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride);
1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// TODO(jingning): the variables used here are little complicated. need further
1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// refactoring on organizing the temporary buffers, when recursive
1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// partition down to 4x4 block size is enabled.
1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)static INLINE PICK_MODE_CONTEXT *get_block_context(MACROBLOCK *x,
2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                                   BLOCK_SIZE bsize) {
2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  switch (bsize) {
2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_64X64:
2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb64_context;
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_64X32:
2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb64x32_context[x->sb_index];
2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_32X64:
2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb32x64_context[x->sb_index];
2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_32X32:
209a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      return &x->sb32_context[x->sb_index];
2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_32X16:
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb32x16_context[x->sb_index][x->mb_index];
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_16X32:
2132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb16x32_context[x->sb_index][x->mb_index];
2142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_16X16:
2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->mb_context[x->sb_index][x->mb_index];
2162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_16X8:
2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb16x8_context[x->sb_index][x->mb_index][x->b_index];
2182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_8X16:
21958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      return &x->sb8x16_context[x->sb_index][x->mb_index][x->b_index];
2202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_8X8:
2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb8x8_context[x->sb_index][x->mb_index][x->b_index];
2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_8X4:
2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb8x4_context[x->sb_index][x->mb_index][x->b_index];
2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_4X8:
2252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->sb4x8_context[x->sb_index][x->mb_index][x->b_index];
2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    case BLOCK_4X4:
2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      return &x->ab4x4_context[x->sb_index][x->mb_index][x->b_index];
2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    default:
22958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      assert(0);
230c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      return NULL;
2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifdef __cplusplus
2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // extern "C"
2367d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif
2377d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
2387d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif  // VP9_ENCODER_VP9_BLOCK_H_
2397d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)