Commit ff4f1c4b authored by Jim Bankoski's avatar Jim Bankoski Committed by Gerrit Code Review

scan order / neighbors converted to lookup

Change-Id: I64b189dfeee1cf3e90134a1a93497072f3361e5e
parent 5b3a8563
......@@ -266,6 +266,62 @@ DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]);
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]);
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]);
const scan_order inter_scan_orders[TX_SIZES] = {
{vp9_default_scan_4x4, vp9_default_scan_4x4_neighbors}, // NEWMV
{vp9_default_scan_8x8, vp9_default_scan_8x8_neighbors}, // NEWMV
{vp9_default_scan_16x16, vp9_default_scan_16x16_neighbors}, // NEWMV
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // NEWMV
};
const scan_order intra_scan_orders[TX_SIZES][INTRA_MODES] = {
{ // 4X4
{vp9_default_scan_4x4, vp9_default_scan_4x4_neighbors}, // DC
{vp9_row_scan_4x4, vp9_row_scan_4x4_neighbors}, // V
{vp9_col_scan_4x4, vp9_col_scan_4x4_neighbors}, // H
{vp9_default_scan_4x4, vp9_default_scan_4x4_neighbors}, // D45
{vp9_default_scan_4x4, vp9_default_scan_4x4_neighbors}, // D135
{vp9_row_scan_4x4, vp9_row_scan_4x4_neighbors}, // D117
{vp9_col_scan_4x4, vp9_col_scan_4x4_neighbors}, // D153
{vp9_col_scan_4x4, vp9_col_scan_4x4_neighbors}, // D207
{vp9_row_scan_4x4, vp9_row_scan_4x4_neighbors}, // D63
{vp9_default_scan_4x4, vp9_default_scan_4x4_neighbors}, // TM
}, { // 8x8
{vp9_default_scan_8x8, vp9_default_scan_8x8_neighbors}, // DC
{vp9_row_scan_8x8, vp9_row_scan_8x8_neighbors}, // V
{vp9_col_scan_8x8, vp9_col_scan_8x8_neighbors}, // H
{vp9_default_scan_8x8, vp9_default_scan_8x8_neighbors}, // D45
{vp9_default_scan_8x8, vp9_default_scan_8x8_neighbors}, // D135
{vp9_row_scan_8x8, vp9_row_scan_8x8_neighbors}, // D117
{vp9_col_scan_8x8, vp9_col_scan_8x8_neighbors}, // D153
{vp9_col_scan_8x8, vp9_col_scan_8x8_neighbors}, // D207
{vp9_row_scan_8x8, vp9_row_scan_8x8_neighbors}, // D63
{vp9_default_scan_8x8, vp9_default_scan_8x8_neighbors}, // TM
}, { // 16x16
{vp9_default_scan_16x16, vp9_default_scan_16x16_neighbors}, // DC
{vp9_row_scan_16x16, vp9_row_scan_16x16_neighbors}, // V
{vp9_col_scan_16x16, vp9_col_scan_16x16_neighbors}, // H
{vp9_default_scan_16x16, vp9_default_scan_16x16_neighbors}, // D45
{vp9_default_scan_16x16, vp9_default_scan_16x16_neighbors}, // D135
{vp9_row_scan_16x16, vp9_row_scan_16x16_neighbors}, // D117
{vp9_col_scan_16x16, vp9_col_scan_16x16_neighbors}, // D153
{vp9_col_scan_16x16, vp9_col_scan_16x16_neighbors}, // D207
{vp9_row_scan_16x16, vp9_row_scan_16x16_neighbors}, // D63
{vp9_default_scan_16x16, vp9_default_scan_16x16_neighbors}, // TM
}, { // 32x32
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // DC
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // V
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // H
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D45
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D135
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D117
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D153
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D207
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // D63
{vp9_default_scan_32x32, vp9_default_scan_32x32_neighbors}, // TM
}
};
static int find_in_scan(const int16_t *scan, int l, int idx) {
int n, l2 = l * l;
for (n = 0; n < l2; n++) {
......
......@@ -15,6 +15,7 @@
#include "vpx_ports/mem.h"
#include "vp9/common/vp9_enums.h"
#include "vp9/common/vp9_blockd.h"
#define MAX_NEIGHBORS 2
......@@ -67,9 +68,16 @@ extern DECLARE_ALIGNED(16, int16_t,
extern DECLARE_ALIGNED(16, int16_t,
vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
void vp9_init_neighbors();
typedef struct {
const int16_t *scan;
const int16_t *neighbors;
} scan_order;
extern const scan_order intra_scan_orders[TX_SIZES][INTRA_MODES];
extern const scan_order inter_scan_orders[TX_SIZES];
static INLINE const int16_t* get_scan_4x4(TX_TYPE tx_type) {
switch (tx_type) {
case ADST_DCT:
......
......@@ -110,8 +110,20 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
const int16_t *scan, *nb;
const uint8_t *cat6;
const uint8_t *band_translate = get_band_translate(tx_size);
get_scan(xd, tx_size, type, block_idx, &scan, &nb);
const MODE_INFO *const mi = xd->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
scan_order const *so;
if (mbmi->ref_frame[0] > 0 || type != PLANE_TYPE_Y_WITH_DC || xd->lossless) {
so = &inter_scan_orders[tx_size];
} else {
MB_PREDICTION_MODE mode = mbmi->mode;
if (mbmi->sb_type < BLOCK_8X8)
mode = mi->bmi[block_idx].as_mode;
so = &intra_scan_orders[tx_size][mode];
}
scan = so->scan;
nb = so->neighbors;
while (c < seg_eob) {
int val;
if (c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment