vp9_common_data.c 5.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 *  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.
 */

11 12

#include "vp9/common/vp9_blockd.h"
13 14 15
#include "vp9/common/vp9_common_data.h"

// Log 2 conversion lookup tables for block width and height
16
const int b_width_log2_lookup[BLOCK_SIZES] =
17
  {0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4};
18
const int b_height_log2_lookup[BLOCK_SIZES] =
19
  {0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4};
20
const int num_4x4_blocks_wide_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
21
  {1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16};
22
const int num_4x4_blocks_high_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
23
  {1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16};
Jim Bankoski's avatar
Jim Bankoski committed
24
// Log 2 conversion lookup tables for modeinfo width and height
25
const int mi_width_log2_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
26
  {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3};
27
const int num_8x8_blocks_wide_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
28
  {1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8};
29
const int mi_height_log2_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
30
  {0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3};
31
const int num_8x8_blocks_high_lookup[BLOCK_SIZES] =
Jim Bankoski's avatar
Jim Bankoski committed
32 33
  {1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8};

34
// MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize)))
35
const int size_group_lookup[BLOCK_SIZES] =
36 37
  {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3};

38
const int num_pels_log2_lookup[BLOCK_SIZES] =
39 40
  {4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12};

41

42
const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = {
Jim Bankoski's avatar
Jim Bankoski committed
43 44 45 46 47 48 49 50
  {  // 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
Jim Bankoski's avatar
Jim Bankoski committed
51
    // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
Jim Bankoski's avatar
Jim Bankoski committed
52 53 54 55 56
    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
Jim Bankoski's avatar
Jim Bankoski committed
57
    // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
Jim Bankoski's avatar
Jim Bankoski committed
58 59 60 61 62
    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
Jim Bankoski's avatar
Jim Bankoski committed
63
    // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
Jim Bankoski's avatar
Jim Bankoski committed
64 65 66 67 68
    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
Jim Bankoski's avatar
Jim Bankoski committed
69
    // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
Jim Bankoski's avatar
Jim Bankoski committed
70 71 72 73 74 75
    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
  }
};
76

77
const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
78
  {     // PARTITION_NONE
Dmitry Kovalev's avatar
Dmitry Kovalev committed
79 80
    BLOCK_4X4,   BLOCK_4X8,   BLOCK_8X4,
    BLOCK_8X8,   BLOCK_8X16,  BLOCK_16X8,
81 82 83
    BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
    BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
    BLOCK_64X64,
84
  }, {  // PARTITION_HORZ
Dmitry Kovalev's avatar
Dmitry Kovalev committed
85 86 87 88
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_8X4,     BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_16X8,    BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_32X16,   BLOCK_INVALID, BLOCK_INVALID,
89
    BLOCK_64X32,
90
  }, {  // PARTITION_VERT
Dmitry Kovalev's avatar
Dmitry Kovalev committed
91 92 93 94
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_4X8,     BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_8X16,    BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_16X32,   BLOCK_INVALID, BLOCK_INVALID,
95
    BLOCK_32X64,
96
  }, {  // PARTITION_SPLIT
Dmitry Kovalev's avatar
Dmitry Kovalev committed
97 98 99 100
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_4X4,     BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_8X8,     BLOCK_INVALID, BLOCK_INVALID,
    BLOCK_16X16,   BLOCK_INVALID, BLOCK_INVALID,
101
    BLOCK_32X32,
102 103 104
  }
};

105
const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
106 107
  TX_4X4,   TX_4X4,   TX_4X4,
  TX_8X8,   TX_8X8,   TX_8X8,
108 109 110
  TX_16X16, TX_16X16, TX_16X16,
  TX_32X32, TX_32X32, TX_32X32, TX_32X32
};
111
const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
112 113 114
  TX_4X4,   TX_4X4,   TX_4X4,
  TX_4X4,   TX_4X4,   TX_4X4,
  TX_8X8,   TX_8X8,   TX_8X8,
115 116 117
  TX_16X16, TX_16X16, TX_16X16, TX_32X32
};

118
const BLOCK_SIZE_TYPE ss_size_lookup[BLOCK_SIZES][2][2] = {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
//  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}},
134
};
Dmitry Kovalev's avatar
Dmitry Kovalev committed
135