2013-07-10 16:19:09 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
*/
|
|
|
|
|
2013-07-11 01:51:07 +02:00
|
|
|
|
|
|
|
#include "vp9/common/vp9_blockd.h"
|
2013-07-10 16:19:09 +02:00
|
|
|
#include "vp9/common/vp9_common_data.h"
|
|
|
|
|
|
|
|
// Log 2 conversion lookup tables for block width and height
|
2013-08-10 02:47:32 +02:00
|
|
|
const int b_width_log2_lookup[BLOCK_SIZES] =
|
2013-07-10 16:19:09 +02:00
|
|
|
{0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int b_height_log2_lookup[BLOCK_SIZES] =
|
2013-07-10 16:19:09 +02:00
|
|
|
{0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int num_4x4_blocks_wide_lookup[BLOCK_SIZES] =
|
2013-07-23 15:51:44 +02:00
|
|
|
{1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int num_4x4_blocks_high_lookup[BLOCK_SIZES] =
|
2013-07-23 15:51:44 +02:00
|
|
|
{1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16};
|
2013-07-10 16:26:08 +02:00
|
|
|
// Log 2 conversion lookup tables for modeinfo width and height
|
2013-08-10 02:47:32 +02:00
|
|
|
const int mi_width_log2_lookup[BLOCK_SIZES] =
|
2013-07-10 16:26:08 +02:00
|
|
|
{0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int num_8x8_blocks_wide_lookup[BLOCK_SIZES] =
|
2013-07-23 15:51:44 +02:00
|
|
|
{1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int mi_height_log2_lookup[BLOCK_SIZES] =
|
2013-07-10 16:26:08 +02:00
|
|
|
{0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3};
|
2013-08-10 02:47:32 +02:00
|
|
|
const int num_8x8_blocks_high_lookup[BLOCK_SIZES] =
|
2013-07-23 15:51:44 +02:00
|
|
|
{1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8};
|
|
|
|
|
2013-07-24 02:57:15 +02:00
|
|
|
// MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize)))
|
2013-08-10 02:47:32 +02:00
|
|
|
const int size_group_lookup[BLOCK_SIZES] =
|
2013-07-24 02:57:15 +02:00
|
|
|
{0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3};
|
|
|
|
|
2013-08-10 02:47:32 +02:00
|
|
|
const int num_pels_log2_lookup[BLOCK_SIZES] =
|
2013-08-01 21:56:12 +02:00
|
|
|
{4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12};
|
|
|
|
|
2013-07-24 02:57:15 +02:00
|
|
|
|
2013-08-10 02:47:32 +02:00
|
|
|
const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = {
|
2013-07-23 15:51:44 +02:00
|
|
|
{ // 4X4
|
|
|
|
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
|
|
|
PARTITION_NONE, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID
|
|
|
|
}, { // 8X8
|
2013-08-05 21:15:52 +02:00
|
|
|
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
2013-07-23 15:51:44 +02:00
|
|
|
PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID
|
|
|
|
}, { // 16X16
|
2013-08-05 21:15:52 +02:00
|
|
|
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
2013-07-23 15:51:44 +02:00
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
|
|
|
PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID
|
|
|
|
}, { // 32X32
|
2013-08-05 21:15:52 +02:00
|
|
|
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
2013-07-23 15:51:44 +02:00
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT,
|
|
|
|
PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
|
|
|
|
PARTITION_INVALID, PARTITION_INVALID
|
|
|
|
}, { // 64X64
|
2013-08-05 21:15:52 +02:00
|
|
|
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
2013-07-23 15:51:44 +02:00
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
|
|
|
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ,
|
|
|
|
PARTITION_NONE
|
|
|
|
}
|
|
|
|
};
|
2013-07-11 01:51:07 +02:00
|
|
|
|
2013-08-26 20:33:16 +02:00
|
|
|
const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
|
2013-07-11 01:51:07 +02:00
|
|
|
{ // PARTITION_NONE
|
2013-08-08 00:33:17 +02:00
|
|
|
BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
|
|
|
|
BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
|
2013-08-02 19:48:27 +02:00
|
|
|
BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
|
|
|
|
BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
|
|
|
|
BLOCK_64X64,
|
2013-07-11 01:51:07 +02:00
|
|
|
}, { // PARTITION_HORZ
|
2013-08-08 00:33:17 +02:00
|
|
|
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID,
|
2013-08-02 19:48:27 +02:00
|
|
|
BLOCK_64X32,
|
2013-07-11 01:51:07 +02:00
|
|
|
}, { // PARTITION_VERT
|
2013-08-08 00:33:17 +02:00
|
|
|
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID,
|
2013-08-02 19:48:27 +02:00
|
|
|
BLOCK_32X64,
|
2013-07-11 01:51:07 +02:00
|
|
|
}, { // PARTITION_SPLIT
|
2013-08-08 00:33:17 +02:00
|
|
|
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_4X4, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_8X8, BLOCK_INVALID, BLOCK_INVALID,
|
|
|
|
BLOCK_16X16, BLOCK_INVALID, BLOCK_INVALID,
|
2013-08-02 19:48:27 +02:00
|
|
|
BLOCK_32X32,
|
2013-07-11 01:51:07 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-10 02:47:32 +02:00
|
|
|
const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
|
2013-08-08 00:33:17 +02:00
|
|
|
TX_4X4, TX_4X4, TX_4X4,
|
|
|
|
TX_8X8, TX_8X8, TX_8X8,
|
2013-07-11 01:51:07 +02:00
|
|
|
TX_16X16, TX_16X16, TX_16X16,
|
|
|
|
TX_32X32, TX_32X32, TX_32X32, TX_32X32
|
|
|
|
};
|
2013-08-10 02:47:32 +02:00
|
|
|
const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = {
|
2013-08-08 00:33:17 +02:00
|
|
|
TX_4X4, TX_4X4, TX_4X4,
|
|
|
|
TX_4X4, TX_4X4, TX_4X4,
|
|
|
|
TX_8X8, TX_8X8, TX_8X8,
|
2013-07-11 01:51:07 +02:00
|
|
|
TX_16X16, TX_16X16, TX_16X16, TX_32X32
|
|
|
|
};
|
|
|
|
|
2013-08-26 20:33:16 +02:00
|
|
|
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
2013-08-08 00:33:17 +02:00
|
|
|
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
|
|
|
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
|
|
|
{{BLOCK_4X4, BLOCK_INVALID}, {BLOCK_INVALID, BLOCK_INVALID}},
|
|
|
|
{{BLOCK_4X8, BLOCK_4X4}, {BLOCK_INVALID, BLOCK_INVALID}},
|
|
|
|
{{BLOCK_8X4, BLOCK_INVALID}, {BLOCK_4X4, BLOCK_INVALID}},
|
|
|
|
{{BLOCK_8X8, BLOCK_8X4}, {BLOCK_4X8, BLOCK_4X4}},
|
|
|
|
{{BLOCK_8X16, BLOCK_8X8}, {BLOCK_INVALID, BLOCK_4X8}},
|
|
|
|
{{BLOCK_16X8, BLOCK_INVALID}, {BLOCK_8X8, BLOCK_8X4}},
|
|
|
|
{{BLOCK_16X16, BLOCK_16X8}, {BLOCK_8X16, BLOCK_8X8}},
|
|
|
|
{{BLOCK_16X32, BLOCK_16X16}, {BLOCK_INVALID, BLOCK_8X16}},
|
|
|
|
{{BLOCK_32X16, BLOCK_INVALID}, {BLOCK_16X16, BLOCK_16X8}},
|
|
|
|
{{BLOCK_32X32, BLOCK_32X16}, {BLOCK_16X32, BLOCK_16X16}},
|
|
|
|
{{BLOCK_32X64, BLOCK_32X32}, {BLOCK_INVALID, BLOCK_16X32}},
|
|
|
|
{{BLOCK_64X32, BLOCK_INVALID}, {BLOCK_32X32, BLOCK_32X16}},
|
|
|
|
{{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}},
|
2013-07-11 01:51:07 +02:00
|
|
|
};
|
2013-08-08 00:33:17 +02:00
|
|
|
|