scan order / neighbors converted to lookup

Change-Id: I64b189dfeee1cf3e90134a1a93497072f3361e5e
This commit is contained in:
Jim Bankoski 2013-11-19 12:50:48 -08:00 коммит произвёл Gerrit Code Review
Родитель 5b3a8563de
Коммит ff4f1c4b76
3 изменённых файлов: 78 добавлений и 2 удалений

Просмотреть файл

@ -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_16x16[256]);
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]); 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) { static int find_in_scan(const int16_t *scan, int l, int idx) {
int n, l2 = l * l; int n, l2 = l * l;
for (n = 0; n < l2; n++) { for (n = 0; n < l2; n++) {

Просмотреть файл

@ -15,6 +15,7 @@
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
#include "vp9/common/vp9_enums.h" #include "vp9/common/vp9_enums.h"
#include "vp9/common/vp9_blockd.h"
#define MAX_NEIGHBORS 2 #define MAX_NEIGHBORS 2
@ -67,9 +68,16 @@ extern DECLARE_ALIGNED(16, int16_t,
extern DECLARE_ALIGNED(16, int16_t, extern DECLARE_ALIGNED(16, int16_t,
vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]); vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
void vp9_init_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) { static INLINE const int16_t* get_scan_4x4(TX_TYPE tx_type) {
switch (tx_type) { switch (tx_type) {
case ADST_DCT: case ADST_DCT:

Просмотреть файл

@ -110,8 +110,20 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
const int16_t *scan, *nb; const int16_t *scan, *nb;
const uint8_t *cat6; const uint8_t *cat6;
const uint8_t *band_translate = get_band_translate(tx_size); 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) { while (c < seg_eob) {
int val; int val;
if (c) if (c)