Use lookup table to simplify logic
In deciding the transform size for a given block in a given TX_MODE. Change-Id: I1467da09853e69cd320695a24c04e19a2f3d04fb
This commit is contained in:
parent
518fc282f4
commit
30d1ec38a7
@ -115,6 +115,16 @@ const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = {
|
||||
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] = {
|
||||
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 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}},
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ extern const PARTITION_TYPE partition_lookup[][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_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];
|
||||
|
||||
#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_COMMON *const cm = &pbi->common;
|
||||
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);
|
||||
else if (tx_mode >= ALLOW_32X32 && bsize >= BLOCK_32X32)
|
||||
return TX_32X32;
|
||||
else if (tx_mode >= ALLOW_16X16 && bsize >= BLOCK_16X16)
|
||||
return TX_16X16;
|
||||
else if (tx_mode >= ALLOW_8X8 && bsize >= BLOCK_8X8)
|
||||
return TX_8X8;
|
||||
else
|
||||
return TX_4X4;
|
||||
} else {
|
||||
const TX_SIZE max_tx_size_block = max_txsize_lookup[bsize];
|
||||
const TX_SIZE max_tx_size_txmode = tx_mode_to_biggest_tx_size[tx_mode];
|
||||
return MIN(max_tx_size_block, max_tx_size_txmode);
|
||||
}
|
||||
}
|
||||
|
||||
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_seg_common.h"
|
||||
#include "vp9/common/vp9_tile_common.h"
|
||||
|
||||
#include "vp9/encoder/vp9_encodeframe.h"
|
||||
#include "vp9/encoder/vp9_encodeintra.h"
|
||||
#include "vp9/encoder/vp9_encodemb.h"
|
||||
@ -46,14 +45,6 @@
|
||||
#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
|
||||
#ifdef ENC_DEBUG
|
||||
int enc_debug = 0;
|
||||
|
@ -715,22 +715,12 @@ static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
BLOCK_SIZE bs) {
|
||||
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
|
||||
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;
|
||||
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
|
||||
if (max_tx_size == TX_32X32 &&
|
||||
(cm->tx_mode == ALLOW_32X32 ||
|
||||
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;
|
||||
}
|
||||
|
||||
mbmi->tx_size = MIN(max_tx_size, largest_tx_size);
|
||||
|
||||
txfm_rd_in_plane(x, &cpi->rdcost_stack, rate, distortion, skip,
|
||||
&sse[mbmi->tx_size], ref_best_rd, 0, bs,
|
||||
mbmi->tx_size);
|
||||
|
Loading…
Reference in New Issue
Block a user