Commit 6c8170af authored by Jim Bankoski's avatar Jim Bankoski

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
parent fb027a76
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
#include "vp9/common/vp9_common.h" #include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_enums.h" #include "vp9/common/vp9_enums.h"
#include "vp9/common/vp9_common_data.h"
#define BLOCK_SIZE_GROUPS 4 #define BLOCK_SIZE_GROUPS 4
#define MAX_MB_SEGMENTS 8 #define MAX_MB_SEGMENTS 8
...@@ -141,43 +142,10 @@ typedef enum { ...@@ -141,43 +142,10 @@ typedef enum {
} MV_REFERENCE_FRAME; } MV_REFERENCE_FRAME;
static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) {
switch (sb_type) { return b_width_log2_lookup[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;
}
} }
static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) {
switch (sb_type) { return b_height_log2_lookup[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;
}
} }
static INLINE int mi_width_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int mi_width_log2(BLOCK_SIZE_TYPE sb_type) {
......
/*
* 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};
/*
* 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
...@@ -66,6 +66,8 @@ VP9_COMMON_SRCS-yes += common/vp9_reconinter.c ...@@ -66,6 +66,8 @@ VP9_COMMON_SRCS-yes += common/vp9_reconinter.c
VP9_COMMON_SRCS-yes += common/vp9_reconintra.c VP9_COMMON_SRCS-yes += common/vp9_reconintra.c
VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/vp9_textblit.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_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_loopfilter_x86.h
VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_postproc_x86.h VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_postproc_x86.h
......
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