diff options
author | Jim Bankoski <jimbankoski@google.com> | 2013-07-10 07:19:09 -0700 |
---|---|---|
committer | Jim Bankoski <jimbankoski@google.com> | 2013-07-10 07:19:09 -0700 |
commit | 6c8170af52b8d29f52e3e155300de1f4e8e27624 (patch) | |
tree | d543c59c8e4e8a7274a54921527aca81a27386ff /vp9/common | |
parent | fb027a765800b4f725181ef03442346bfaaf78ce (diff) | |
download | libvpx-6c8170af52b8d29f52e3e155300de1f4e8e27624.tar libvpx-6c8170af52b8d29f52e3e155300de1f4e8e27624.tar.gz libvpx-6c8170af52b8d29f52e3e155300de1f4e8e27624.tar.bz2 libvpx-6c8170af52b8d29f52e3e155300de1f4e8e27624.zip |
b_width_log2 and b_height_log2 lookups
Replace case statement with lookup.
Small speed gain at low speed settings but at speed 2+ where the
number of motion searches etc. falls the impact rises to ~3-4%.
Change-Id: Idff639b7b302ee65e042b7bf836943ac0a06fad8
Change-Id: I5940719a4a161f8c26ac9a6753f1678494cec644
Diffstat (limited to 'vp9/common')
-rw-r--r-- | vp9/common/vp9_blockd.h | 38 | ||||
-rw-r--r-- | vp9/common/vp9_common_data.c | 17 | ||||
-rw-r--r-- | vp9/common/vp9_common_data.h | 19 |
3 files changed, 39 insertions, 35 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 550794218..8c5827663 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -20,6 +20,7 @@ #include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_enums.h" +#include "vp9/common/vp9_common_data.h" #define BLOCK_SIZE_GROUPS 4 #define MAX_MB_SEGMENTS 8 @@ -141,43 +142,10 @@ typedef enum { } MV_REFERENCE_FRAME; static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) { - switch (sb_type) { - case BLOCK_SIZE_SB4X8: - case BLOCK_SIZE_AB4X4: return 0; - case BLOCK_SIZE_SB8X4: - case BLOCK_SIZE_SB8X8: - case BLOCK_SIZE_SB8X16: return 1; - case BLOCK_SIZE_SB16X8: - case BLOCK_SIZE_MB16X16: - case BLOCK_SIZE_SB16X32: return 2; - case BLOCK_SIZE_SB32X16: - case BLOCK_SIZE_SB32X32: - case BLOCK_SIZE_SB32X64: return 3; - case BLOCK_SIZE_SB64X32: - case BLOCK_SIZE_SB64X64: return 4; - default: assert(0); - return -1; - } + return b_width_log2_lookup[sb_type]; } - static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) { - switch (sb_type) { - case BLOCK_SIZE_SB8X4: - case BLOCK_SIZE_AB4X4: return 0; - case BLOCK_SIZE_SB4X8: - case BLOCK_SIZE_SB8X8: - case BLOCK_SIZE_SB16X8: return 1; - case BLOCK_SIZE_SB8X16: - case BLOCK_SIZE_MB16X16: - case BLOCK_SIZE_SB32X16: return 2; - case BLOCK_SIZE_SB16X32: - case BLOCK_SIZE_SB32X32: - case BLOCK_SIZE_SB64X32: return 3; - case BLOCK_SIZE_SB32X64: - case BLOCK_SIZE_SB64X64: return 4; - default: assert(0); - return -1; - } + return b_height_log2_lookup[sb_type]; } static INLINE int mi_width_log2(BLOCK_SIZE_TYPE sb_type) { diff --git a/vp9/common/vp9_common_data.c b/vp9/common/vp9_common_data.c new file mode 100644 index 000000000..feb107e13 --- /dev/null +++ b/vp9/common/vp9_common_data.c @@ -0,0 +1,17 @@ +/* + * 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. + */ + +#include "vp9/common/vp9_common_data.h" + +// Log 2 conversion lookup tables for block width and height +const int b_width_log2_lookup[BLOCK_SIZE_TYPES] = + {0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}; +const int b_height_log2_lookup[BLOCK_SIZE_TYPES] = + {0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4}; diff --git a/vp9/common/vp9_common_data.h b/vp9/common/vp9_common_data.h new file mode 100644 index 000000000..f080fddc7 --- /dev/null +++ b/vp9/common/vp9_common_data.h @@ -0,0 +1,19 @@ +/* + * 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. + */ + +#ifndef VP9_COMMON_VP9_COMMON_DATA_H_ +#define VP9_COMMON_VP9_COMMON_DATA_H_ + +#include "vp9/common/vp9_enums.h" + +extern const int b_width_log2_lookup[BLOCK_SIZE_TYPES]; +extern const int b_height_log2_lookup[BLOCK_SIZE_TYPES]; + +#endif // VP9_COMMON_VP9_COMMON_DATA_H |