diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 55079421806a0b2180b0638bf7c029e75596e5f9..8c5827663dfa48703a856b9c7b7d7e19e6ffc7d7 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 0000000000000000000000000000000000000000..feb107e137fbbab533db51bf3ea3df43a75cab18 --- /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 0000000000000000000000000000000000000000..f080fddc7733d1c4c095414aa2b8556cc9123ac3 --- /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 diff --git a/vp9/vp9_common.mk b/vp9/vp9_common.mk index 55d139d057f0603aac4e55d76ab5cf7866f24e0f..9d0472d106951355ebec6e02a9e78592f40e2a99 100644 --- a/vp9/vp9_common.mk +++ b/vp9/vp9_common.mk @@ -66,6 +66,8 @@ VP9_COMMON_SRCS-yes += common/vp9_reconinter.c VP9_COMMON_SRCS-yes += common/vp9_reconintra.c VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/vp9_textblit.c VP9_COMMON_SRCS-yes += common/vp9_treecoder.c +VP9_COMMON_SRCS-yes += common/vp9_common_data.c +VP9_COMMON_SRCS-yes += common/vp9_common_data.h VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_loopfilter_x86.h VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_postproc_x86.h