Commit f1702dde authored by Jingning Han's avatar Jingning Han

Add 2x2 block unit syntax

Add 2x2 block size syntax to the codec system. It prepares for the
4x4 coding block unit for 420 format. This change retains the same
coding statistics.

Change-Id: If8e9a31bd6b4b75bc994539dc4dd8021d455ba57
parent 5943d41e
This diff is collapsed.
......@@ -81,6 +81,11 @@ typedef enum BITSTREAM_PROFILE {
// type, so that we can save memory when they are used in structs/arrays.
typedef enum ATTRIBUTE_PACKED {
#if CONFIG_CB4X4
BLOCK_2X2,
BLOCK_2X4,
BLOCK_4X2,
#endif
BLOCK_4X4,
BLOCK_4X8,
BLOCK_8X4,
......
......@@ -98,6 +98,11 @@ static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
// 00000000
// 00000000
static const uint64_t left_prediction_mask[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0000000000000001ULL, // BLOCK_2X2,
0x0000000000000001ULL, // BLOCK_2X4,
0x0000000000000001ULL, // BLOCK_4X2,
#endif
0x0000000000000001ULL, // BLOCK_4X4,
0x0000000000000001ULL, // BLOCK_4X8,
0x0000000000000001ULL, // BLOCK_8X4,
......@@ -115,6 +120,11 @@ static const uint64_t left_prediction_mask[BLOCK_SIZES] = {
// 64 bit mask to shift and set for each prediction size.
static const uint64_t above_prediction_mask[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
#endif
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -133,6 +143,11 @@ static const uint64_t above_prediction_mask[BLOCK_SIZES] = {
// each 8x8 block that would be in the left most block of the given block
// size in the 64x64 block.
static const uint64_t size_mask[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
#endif
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -181,6 +196,11 @@ static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
// 16 bit left mask to shift and set for each uv prediction size.
static const uint16_t left_prediction_mask_uv[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0001, // BLOCK_2X2,
0x0001, // BLOCK_2X4,
0x0001, // BLOCK_4X2,
#endif
0x0001, // BLOCK_4X4,
0x0001, // BLOCK_4X8,
0x0001, // BLOCK_8X4,
......@@ -197,6 +217,11 @@ static const uint16_t left_prediction_mask_uv[BLOCK_SIZES] = {
};
// 16 bit above mask to shift and set for uv each prediction size.
static const uint16_t above_prediction_mask_uv[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
#endif
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......@@ -214,6 +239,11 @@ static const uint16_t above_prediction_mask_uv[BLOCK_SIZES] = {
// 64 bit mask to shift and set for each uv prediction size
static const uint16_t size_mask_uv[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
#endif
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......
......@@ -123,6 +123,10 @@ static const uint8_t orders_8x8[256] = {
/* clang-format off */
static const uint8_t *const orders[BLOCK_SIZES] = {
#if CONFIG_CB4X4
// 2X2, 2X4, 4X2
orders_8x8, orders_8x8, orders_8x8,
#endif
// 4X4
orders_8x8,
// 4X8, 8X4, 8X8
......@@ -140,6 +144,10 @@ static const uint8_t *const orders[BLOCK_SIZES] = {
#else
/* clang-format off */
static const uint8_t *const orders[BLOCK_SIZES] = {
#if CONFIG_CB4X4
// 2X2, 2X4, 4X2
orders_16x16, orders_16x16, orders_16x16,
#endif
// 4X4
orders_16x16,
// 4X8, 8X4, 8X8
......
......@@ -2928,6 +2928,9 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
/* clang-format off */
static const BLOCK_SIZE min_partition_size[BLOCK_SIZES] = {
#if CONFIG_CB4X4
BLOCK_2X2, BLOCK_2X2, BLOCK_2X2, // 2x2, 2x4, 4x2
#endif
BLOCK_4X4, // 4x4
BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, // 4x8, 8x4, 8x8
BLOCK_4X4, BLOCK_4X4, BLOCK_8X8, // 8x16, 16x8, 16x16
......@@ -2939,6 +2942,9 @@ static const BLOCK_SIZE min_partition_size[BLOCK_SIZES] = {
};
static const BLOCK_SIZE max_partition_size[BLOCK_SIZES] = {
#if CONFIG_CB4X4
BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, // 2x2, 2x4, 4x2
#endif
BLOCK_8X8, // 4x4
BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, // 4x8, 8x4, 8x8
BLOCK_32X32, BLOCK_32X32, BLOCK_32X32, // 8x16, 16x8, 16x16
......@@ -2951,6 +2957,9 @@ static const BLOCK_SIZE max_partition_size[BLOCK_SIZES] = {
// Next square block size less or equal than current block size.
static const BLOCK_SIZE next_square_size[BLOCK_SIZES] = {
#if CONFIG_CB4X4
BLOCK_2X2, BLOCK_2X2, BLOCK_2X2, // 2x2, 2x4, 4x2
#endif
BLOCK_4X4, // 4x4
BLOCK_4X4, BLOCK_4X4, BLOCK_8X8, // 4x8, 8x4, 8x8
BLOCK_8X8, BLOCK_8X8, BLOCK_16X16, // 8x16, 16x8, 16x16
......
......@@ -63,6 +63,9 @@ void av1_rd_cost_init(RD_COST *rd_cost) {
// This table is used to correct for block size.
// The factors here are << 2 (2 = x0.5, 32 = x8 etc).
static const uint8_t rd_thresh_block_size_factor[BLOCK_SIZES] = {
#if CONFIG_CB4X4
2, 2, 2,
#endif
2, 3, 3, 4, 6, 6, 8, 12, 12, 16, 24, 24, 32,
#if CONFIG_EXT_PARTITION
48, 48, 64
......
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