Merge "Use lookup table to simplify logic"
This commit is contained in:
@@ -115,6 +115,16 @@ const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = {
|
|||||||
TX_16X16, TX_16X16, TX_16X16, TX_32X32
|
TX_16X16, TX_16X16, TX_16X16, TX_32X32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
|
||||||
|
TX_4X4, // ONLY_4X4
|
||||||
|
TX_8X8, // ALLOW_8X8
|
||||||
|
TX_16X16, // ALLOW_16X16
|
||||||
|
TX_32X32, // ALLOW_32X32
|
||||||
|
TX_32X32, // TX_MODE_SELECT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
||||||
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
||||||
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
||||||
@@ -133,3 +143,4 @@ const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
|||||||
{{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}},
|
{{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZES];
|
|||||||
extern const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES];
|
extern const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES];
|
||||||
extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES];
|
extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES];
|
||||||
extern const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES];
|
extern const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES];
|
||||||
|
extern const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES];
|
||||||
extern const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2];
|
extern const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2];
|
||||||
|
|
||||||
#endif // VP9_COMMON_VP9_COMMON_DATA_H
|
#endif // VP9_COMMON_VP9_COMMON_DATA_H
|
||||||
|
|||||||
@@ -78,17 +78,13 @@ static TX_SIZE read_tx_size(VP9D_COMP *pbi, TX_MODE tx_mode,
|
|||||||
vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
MACROBLOCKD *const xd = &pbi->mb;
|
MACROBLOCKD *const xd = &pbi->mb;
|
||||||
|
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8) {
|
||||||
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
|
|
||||||
return read_selected_tx_size(cm, xd, bsize, r);
|
return read_selected_tx_size(cm, xd, bsize, r);
|
||||||
else if (tx_mode >= ALLOW_32X32 && bsize >= BLOCK_32X32)
|
} else {
|
||||||
return TX_32X32;
|
const TX_SIZE max_tx_size_block = max_txsize_lookup[bsize];
|
||||||
else if (tx_mode >= ALLOW_16X16 && bsize >= BLOCK_16X16)
|
const TX_SIZE max_tx_size_txmode = tx_mode_to_biggest_tx_size[tx_mode];
|
||||||
return TX_16X16;
|
return MIN(max_tx_size_block, max_tx_size_txmode);
|
||||||
else if (tx_mode >= ALLOW_8X8 && bsize >= BLOCK_8X8)
|
}
|
||||||
return TX_8X8;
|
|
||||||
else
|
|
||||||
return TX_4X4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_segment_id(VP9_COMMON *cm, BLOCK_SIZE bsize,
|
static void set_segment_id(VP9_COMMON *cm, BLOCK_SIZE bsize,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "vp9/common/vp9_reconinter.h"
|
#include "vp9/common/vp9_reconinter.h"
|
||||||
#include "vp9/common/vp9_seg_common.h"
|
#include "vp9/common/vp9_seg_common.h"
|
||||||
#include "vp9/common/vp9_tile_common.h"
|
#include "vp9/common/vp9_tile_common.h"
|
||||||
|
|
||||||
#include "vp9/encoder/vp9_encodeframe.h"
|
#include "vp9/encoder/vp9_encodeframe.h"
|
||||||
#include "vp9/encoder/vp9_encodeintra.h"
|
#include "vp9/encoder/vp9_encodeintra.h"
|
||||||
#include "vp9/encoder/vp9_encodemb.h"
|
#include "vp9/encoder/vp9_encodemb.h"
|
||||||
@@ -46,14 +45,6 @@
|
|||||||
#define DBG_PRNT_SEGMAP 0
|
#define DBG_PRNT_SEGMAP 0
|
||||||
|
|
||||||
|
|
||||||
static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
|
|
||||||
TX_4X4, // ONLY_4X4
|
|
||||||
TX_8X8, // ONLY_8X8
|
|
||||||
TX_16X16, // ONLY_16X16
|
|
||||||
TX_32X32, // ONLY_32X32
|
|
||||||
TX_32X32, // TX_MODE_SELECT
|
|
||||||
};
|
|
||||||
|
|
||||||
// #define ENC_DEBUG
|
// #define ENC_DEBUG
|
||||||
#ifdef ENC_DEBUG
|
#ifdef ENC_DEBUG
|
||||||
int enc_debug = 0;
|
int enc_debug = 0;
|
||||||
|
|||||||
@@ -715,22 +715,12 @@ static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
BLOCK_SIZE bs) {
|
BLOCK_SIZE bs) {
|
||||||
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
|
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
|
||||||
VP9_COMMON *const cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
|
const TX_SIZE largest_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
|
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
|
||||||
if (max_tx_size == TX_32X32 &&
|
|
||||||
(cm->tx_mode == ALLOW_32X32 ||
|
mbmi->tx_size = MIN(max_tx_size, largest_tx_size);
|
||||||
cm->tx_mode == TX_MODE_SELECT)) {
|
|
||||||
mbmi->tx_size = TX_32X32;
|
|
||||||
} else if (max_tx_size >= TX_16X16 &&
|
|
||||||
(cm->tx_mode == ALLOW_16X16 ||
|
|
||||||
cm->tx_mode == ALLOW_32X32 ||
|
|
||||||
cm->tx_mode == TX_MODE_SELECT)) {
|
|
||||||
mbmi->tx_size = TX_16X16;
|
|
||||||
} else if (cm->tx_mode != ONLY_4X4) {
|
|
||||||
mbmi->tx_size = TX_8X8;
|
|
||||||
} else {
|
|
||||||
mbmi->tx_size = TX_4X4;
|
|
||||||
}
|
|
||||||
txfm_rd_in_plane(x, &cpi->rdcost_stack, rate, distortion, skip,
|
txfm_rd_in_plane(x, &cpi->rdcost_stack, rate, distortion, skip,
|
||||||
&sse[mbmi->tx_size], ref_best_rd, 0, bs,
|
&sse[mbmi->tx_size], ref_best_rd, 0, bs,
|
||||||
mbmi->tx_size);
|
mbmi->tx_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user