diff options
-rwxr-xr-x | test/tools_common.sh | 43 | ||||
-rw-r--r-- | third_party/libyuv/include/libyuv/scale.h | 4 | ||||
-rw-r--r-- | third_party/libyuv/source/scale.c | 20 | ||||
-rw-r--r-- | vp9/common/vp9_blockd.c | 8 | ||||
-rw-r--r-- | vp9/common/vp9_blockd.h | 20 | ||||
-rw-r--r-- | vp9/common/vp9_entropy.h | 2 | ||||
-rw-r--r-- | vp9/common/vp9_entropymode.h | 4 | ||||
-rw-r--r-- | vp9/common/vp9_postproc.c | 8 | ||||
-rw-r--r-- | vp9/common/vp9_reconintra.c | 4 | ||||
-rw-r--r-- | vp9/common/vp9_reconintra.h | 2 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 4 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodemv.c | 23 | ||||
-rw-r--r-- | vp9/encoder/vp9_bitstream.c | 10 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 9 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_mbgraph.c | 5 | ||||
-rw-r--r-- | vp9/encoder/vp9_mbgraph.h | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_pickmode.c | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 48 | ||||
-rw-r--r-- | vp9/encoder/vp9_speed_features.c | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_speed_features.h | 3 | ||||
-rw-r--r-- | vp9/encoder/vp9_variance.c | 191 | ||||
-rw-r--r-- | vpxdec.c | 2 |
23 files changed, 139 insertions, 284 deletions
diff --git a/test/tools_common.sh b/test/tools_common.sh index cd7977156..aa446c9c2 100755 --- a/test/tools_common.sh +++ b/test/tools_common.sh @@ -130,11 +130,9 @@ is_windows_target() { # Echoes yes to stdout when the file named by positional parameter one exists # in LIBVPX_BIN_PATH, and is executable. vpx_tool_available() { - tool_name="${1}" - if [ "$(is_windows_target)" = "yes" ]; then - tool_name="${tool_name}.exe" - fi - [ -x "${LIBVPX_BIN_PATH}/${1}" ] && echo yes + local tool_name="$1" + local tool="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}" + [ -x "${tool}" ] && echo yes } # Echoes yes to stdout when vpx_config_option_enabled() reports yes for @@ -178,8 +176,8 @@ vpxdec_available() { # present, is interpreted as a boolean flag that means the input should be sent # to vpxdec via pipe from cat instead of directly. vpxdec() { - input="${1}" - pipe_input=${2} + local input="${1}" + local pipe_input=${2} if [ $# -gt 2 ]; then # shift away $1 and $2 so the remaining arguments can be passed to vpxdec @@ -187,11 +185,7 @@ vpxdec() { shift 2 fi - decoder="${LIBVPX_BIN_PATH}/vpxdec" - - if [ "$(is_windows_target)" = "yes" ]; then - decoder="${decoder}.exe" - fi + local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" if [ -z "${pipe_input}" ]; then "${decoder}" "$input" --summary --noblit "$@" > /dev/null 2>&1 @@ -218,18 +212,14 @@ vpxenc_available() { # Note: Extra flags currently supports a special case: when set to "-" # input is piped to vpxenc via cat. vpxenc() { - encoder="${LIBVPX_BIN_PATH}/vpxenc" - codec="${1}" - width=${2} - height=${3} - frames=${4} - input=${5} - output="${VPX_TEST_OUTPUT_DIR}/${6}" - extra_flags=${7} - - if [ "$(is_windows_target)" = "yes" ]; then - encoder="${encoder}.exe" - fi + local encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}" + local codec="${1}" + local width=${2} + local height=${3} + local frames=${4} + local input=${5} + local output="${VPX_TEST_OUTPUT_DIR}/${6}" + local extra_flags=${7} # Because --ivf must be within the command line to get IVF from vpxenc. if echo "${output}" | egrep -q 'ivf$'; then @@ -318,6 +308,7 @@ run_tests() { # Run tests. for test in ${tests_to_run}; do test_begin "${test}" + [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo " RUN ${test}" "${test}" [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo " PASS ${test}" test_end "${test}" @@ -421,6 +412,10 @@ if ! mkdir -p "${VPX_TEST_OUTPUT_DIR}" || \ exit 1 fi +if [ "$(is_windows_target)" = "yes" ]; then + VPX_TEST_EXE_SUFFIX=".exe" +fi + trap cleanup EXIT if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then diff --git a/third_party/libyuv/include/libyuv/scale.h b/third_party/libyuv/include/libyuv/scale.h index 21fe360ce..35d0ff55c 100644 --- a/third_party/libyuv/include/libyuv/scale.h +++ b/third_party/libyuv/include/libyuv/scale.h @@ -23,7 +23,7 @@ typedef enum { kFilterNone = 0, // Point sample; Fastest kFilterBilinear = 1, // Faster than box, but lower quality scaling down. kFilterBox = 2 // Highest quality -}FilterMode; +} FilterModeEnum; // Scales a YUV 4:2:0 image from the src width and height to the // dst width and height. @@ -43,7 +43,7 @@ int I420Scale(const uint8* src_y, int src_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, int dst_width, int dst_height, - FilterMode filtering); + FilterModeEnum filtering); // Legacy API. Deprecated int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, diff --git a/third_party/libyuv/source/scale.c b/third_party/libyuv/source/scale.c index 3c30b55c6..1809300c0 100644 --- a/third_party/libyuv/source/scale.c +++ b/third_party/libyuv/source/scale.c @@ -3053,7 +3053,7 @@ static void ScalePlaneDown2(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { void (*ScaleRowDown2)(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); assert(IS_ALIGNED(src_width, 2)); @@ -3097,7 +3097,7 @@ static void ScalePlaneDown4(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { void (*ScaleRowDown4)(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); assert(IS_ALIGNED(src_width, 4)); @@ -3142,7 +3142,7 @@ static void ScalePlaneDown8(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { void (*ScaleRowDown8)(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); assert(IS_ALIGNED(src_width, 8)); @@ -3181,7 +3181,7 @@ static void ScalePlaneDown34(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { void (*ScaleRowDown34_0)(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); void (*ScaleRowDown34_1)(const uint8* src_ptr, int src_stride, @@ -3274,7 +3274,7 @@ static void ScalePlaneDown38(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { void (*ScaleRowDown38_3)(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); void (*ScaleRowDown38_2)(const uint8* src_ptr, int src_stride, @@ -3634,7 +3634,7 @@ static void ScalePlaneAnySize(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { if (!filtering) { ScalePlaneSimple(src_width, src_height, dst_width, dst_height, src_stride, dst_stride, src_ptr, dst_ptr); @@ -3657,7 +3657,7 @@ static void ScalePlaneDown(int src_width, int src_height, int dst_width, int dst_height, int src_stride, int dst_stride, const uint8* src_ptr, uint8* dst_ptr, - FilterMode filtering) { + FilterModeEnum filtering) { if (!filtering) { ScalePlaneSimple(src_width, src_height, dst_width, dst_height, src_stride, dst_stride, src_ptr, dst_ptr); @@ -3703,7 +3703,7 @@ static void ScalePlane(const uint8* src, int src_stride, int src_width, int src_height, uint8* dst, int dst_stride, int dst_width, int dst_height, - FilterMode filtering, int use_ref) { + FilterModeEnum filtering, int use_ref) { // Use specialized scales to improve performance for common resolutions. // For example, all the 1/2 scalings will use ScalePlaneDown2() if (dst_width == src_width && dst_height == src_height) { @@ -3767,7 +3767,7 @@ int I420Scale(const uint8* src_y, int src_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, int dst_width, int dst_height, - FilterMode filtering) { + FilterModeEnum filtering) { if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 || !dst_y || !dst_u || !dst_v || dst_width <= 0 || dst_height <= 0) { return -1; @@ -3832,7 +3832,7 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, int src_halfheight = (src_height + 1) >> 1; int dst_halfwidth = (dst_width + 1) >> 1; int dst_halfheight = (dst_height + 1) >> 1; - FilterMode filtering = interpolate ? kFilterBox : kFilterNone; + FilterModeEnum filtering = interpolate ? kFilterBox : kFilterNone; ScalePlane(src_y, src_stride_y, src_width, src_height, dst_y, dst_stride_y, dst_width, dst_height, diff --git a/vp9/common/vp9_blockd.c b/vp9/common/vp9_blockd.c index fedfb18d9..43d6c6ef5 100644 --- a/vp9/common/vp9_blockd.c +++ b/vp9/common/vp9_blockd.c @@ -10,8 +10,8 @@ #include "vp9/common/vp9_blockd.h" -MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, - const MODE_INFO *left_mi, int b) { +PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, + const MODE_INFO *left_mi, int b) { if (b == 0 || b == 2) { if (!left_mi || is_inter_block(&left_mi->mbmi)) return DC_PRED; @@ -23,8 +23,8 @@ MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, } } -MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, - const MODE_INFO *above_mi, int b) { +PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, + const MODE_INFO *above_mi, int b) { if (b == 0 || b == 1) { if (!above_mi || is_inter_block(&above_mi->mbmi)) return DC_PRED; diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 55320a6a4..8ca356dd6 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -77,9 +77,9 @@ typedef enum { ZEROMV, NEWMV, MB_MODE_COUNT -} MB_PREDICTION_MODE; +} PREDICTION_MODE; -static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) { +static INLINE int is_inter_mode(PREDICTION_MODE mode) { return mode >= NEARESTMV && mode <= NEWMV; } @@ -94,7 +94,7 @@ static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) { is a single probability table. */ typedef struct { - MB_PREDICTION_MODE as_mode; + PREDICTION_MODE as_mode; int_mv as_mv[2]; // first, second inter predictor motion vectors } b_mode_info; @@ -122,14 +122,14 @@ static INLINE int mi_width_log2(BLOCK_SIZE sb_type) { typedef struct { // Common for both INTER and INTRA blocks BLOCK_SIZE sb_type; - MB_PREDICTION_MODE mode; + PREDICTION_MODE mode; TX_SIZE tx_size; uint8_t skip; uint8_t segment_id; uint8_t seg_id_predicted; // valid only when temporal_update is enabled // Only for INTRA blocks - MB_PREDICTION_MODE uv_mode; + PREDICTION_MODE uv_mode; // Only for INTER blocks MV_REFERENCE_FRAME ref_frame[2]; @@ -144,7 +144,7 @@ typedef struct { b_mode_info bmi[4]; } MODE_INFO; -static INLINE MB_PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { +static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode : mi->mbmi.mode; } @@ -157,11 +157,11 @@ static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { return mbmi->ref_frame[1] > INTRA_FRAME; } -MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, - const MODE_INFO *left_mi, int b); +PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, + const MODE_INFO *left_mi, int b); -MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, - const MODE_INFO *above_mi, int b); +PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, + const MODE_INFO *above_mi, int b); enum mv_precision { MV_PRECISION_Q3, diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h index 6788eb698..3dc98a835 100644 --- a/vp9/common/vp9_entropy.h +++ b/vp9/common/vp9_entropy.h @@ -180,7 +180,7 @@ static const INLINE scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size, if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless) { return &vp9_default_scan_orders[tx_size]; } else { - const MB_PREDICTION_MODE mode = get_y_mode(mi, block_idx); + const PREDICTION_MODE mode = get_y_mode(mi, block_idx); return &vp9_scan_orders[tx_size][intra_mode_to_tx_type_lookup[mode]]; } } diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h index c7b191177..533757bef 100644 --- a/vp9/common/vp9_entropymode.h +++ b/vp9/common/vp9_entropymode.h @@ -101,8 +101,8 @@ static INLINE const vp9_prob *get_y_mode_probs(const MODE_INFO *mi, const MODE_INFO *above_mi, const MODE_INFO *left_mi, int block) { - const MB_PREDICTION_MODE above = vp9_above_block_mode(mi, above_mi, block); - const MB_PREDICTION_MODE left = vp9_left_block_mode(mi, left_mi, block); + const PREDICTION_MODE above = vp9_above_block_mode(mi, above_mi, block); + const PREDICTION_MODE left = vp9_left_block_mode(mi, left_mi, block); return vp9_kf_y_mode_prob[above][left]; } diff --git a/vp9/common/vp9_postproc.c b/vp9/common/vp9_postproc.c index 7baa9ee33..5601a936d 100644 --- a/vp9/common/vp9_postproc.c +++ b/vp9/common/vp9_postproc.c @@ -34,7 +34,7 @@ /* global constants */ #if 0 && CONFIG_POSTPROC_VISUALIZER -static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = { +static const unsigned char PREDICTION_MODE_colors[MB_MODE_COUNT][3] = { { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */ { RGB_TO_YUV(0x00FF00) }, /* Green */ { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */ @@ -911,9 +911,9 @@ int vp9_post_proc_frame(struct VP9Common *cm, vl += y_stride * 1; } } else if (ppflags->display_mb_modes_flag & (1 << mi->mbmi.mode)) { - Y = MB_PREDICTION_MODE_colors[mi->mbmi.mode][0]; - U = MB_PREDICTION_MODE_colors[mi->mbmi.mode][1]; - V = MB_PREDICTION_MODE_colors[mi->mbmi.mode][2]; + Y = PREDICTION_MODE_colors[mi->mbmi.mode][0]; + U = PREDICTION_MODE_colors[mi->mbmi.mode][1]; + V = PREDICTION_MODE_colors[mi->mbmi.mode][2]; vp9_blend_mb_inner(y_ptr + x, u_ptr + (x >> 1), v_ptr + (x >> 1), Y, U, V, 0xc000, y_stride); diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index 44951b54d..32e45510c 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -311,7 +311,7 @@ static void init_intra_pred_fn_ptrs(void) { static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, int ref_stride, uint8_t *dst, int dst_stride, - MB_PREDICTION_MODE mode, TX_SIZE tx_size, + PREDICTION_MODE mode, TX_SIZE tx_size, int up_available, int left_available, int right_available, int x, int y, int plane) { @@ -434,7 +434,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, } void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in, - TX_SIZE tx_size, MB_PREDICTION_MODE mode, + TX_SIZE tx_size, PREDICTION_MODE mode, const uint8_t *ref, int ref_stride, uint8_t *dst, int dst_stride, int aoff, int loff, int plane) { diff --git a/vp9/common/vp9_reconintra.h b/vp9/common/vp9_reconintra.h index abc176787..d09d2a129 100644 --- a/vp9/common/vp9_reconintra.h +++ b/vp9/common/vp9_reconintra.h @@ -19,7 +19,7 @@ extern "C" { #endif void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in, - TX_SIZE tx_size, MB_PREDICTION_MODE mode, + TX_SIZE tx_size, PREDICTION_MODE mode, const uint8_t *ref, int ref_stride, uint8_t *dst, int dst_stride, int aoff, int loff, int plane); diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 022a4296f..b953452c5 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -246,8 +246,8 @@ static void predict_and_reconstruct_intra_block(int plane, int block, MACROBLOCKD *const xd = args->xd; struct macroblockd_plane *const pd = &xd->plane[plane]; MODE_INFO *const mi = xd->mi[0]; - const MB_PREDICTION_MODE mode = (plane == 0) ? get_y_mode(mi, block) - : mi->mbmi.uv_mode; + const PREDICTION_MODE mode = (plane == 0) ? get_y_mode(mi, block) + : mi->mbmi.uv_mode; int x, y; uint8_t *dst; txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y); diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 3618f12d0..1afaee1e3 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -23,30 +23,29 @@ #include "vp9/decoder/vp9_decodeframe.h" #include "vp9/decoder/vp9_reader.h" -static MB_PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) { - return (MB_PREDICTION_MODE)vp9_read_tree(r, vp9_intra_mode_tree, p); +static PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) { + return (PREDICTION_MODE)vp9_read_tree(r, vp9_intra_mode_tree, p); } -static MB_PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, vp9_reader *r, +static PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, vp9_reader *r, int size_group) { - const MB_PREDICTION_MODE y_mode = read_intra_mode(r, - cm->fc.y_mode_prob[size_group]); + const PREDICTION_MODE y_mode = + read_intra_mode(r, cm->fc.y_mode_prob[size_group]); if (!cm->frame_parallel_decoding_mode) ++cm->counts.y_mode[size_group][y_mode]; return y_mode; } -static MB_PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, vp9_reader *r, - MB_PREDICTION_MODE y_mode) { - const MB_PREDICTION_MODE uv_mode = read_intra_mode(r, +static PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, vp9_reader *r, + PREDICTION_MODE y_mode) { + const PREDICTION_MODE uv_mode = read_intra_mode(r, cm->fc.uv_mode_prob[y_mode]); if (!cm->frame_parallel_decoding_mode) ++cm->counts.uv_mode[y_mode][uv_mode]; return uv_mode; } -static MB_PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, vp9_reader *r, - int ctx) { +static PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, vp9_reader *r, int ctx) { const int mode = vp9_read_tree(r, vp9_inter_mode_tree, cm->fc.inter_mode_probs[ctx]); if (!cm->frame_parallel_decoding_mode) @@ -362,7 +361,7 @@ static INLINE int is_mv_valid(const MV *mv) { mv->col > MV_LOW && mv->col < MV_UPP; } -static INLINE int assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode, +static INLINE int assign_mv(VP9_COMMON *cm, PREDICTION_MODE mode, int_mv mv[2], int_mv ref_mv[2], int_mv nearest_mv[2], int_mv near_mv[2], int is_compound, int allow_hp, vp9_reader *r) { @@ -469,7 +468,7 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm, const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2 const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; // 1 or 2 int idx, idy; - MB_PREDICTION_MODE b_mode; + PREDICTION_MODE b_mode; int_mv nearest_sub8x8[2], near_sub8x8[2]; for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 6f4fafeb3..c5a85c9df 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -47,12 +47,12 @@ void vp9_entropy_mode_init() { vp9_tokens_from_tree(inter_mode_encodings, vp9_inter_mode_tree); } -static void write_intra_mode(vp9_writer *w, MB_PREDICTION_MODE mode, +static void write_intra_mode(vp9_writer *w, PREDICTION_MODE mode, const vp9_prob *probs) { vp9_write_token(w, vp9_intra_mode_tree, probs, &intra_mode_encodings[mode]); } -static void write_inter_mode(vp9_writer *w, MB_PREDICTION_MODE mode, +static void write_inter_mode(vp9_writer *w, PREDICTION_MODE mode, const vp9_prob *probs) { assert(is_inter_mode(mode)); vp9_write_token(w, vp9_inter_mode_tree, probs, @@ -233,7 +233,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, const MACROBLOCKD *const xd = &x->e_mbd; const struct segmentation *const seg = &cm->seg; const MB_MODE_INFO *const mbmi = &mi->mbmi; - const MB_PREDICTION_MODE mode = mbmi->mode; + const PREDICTION_MODE mode = mbmi->mode; const int segment_id = mbmi->segment_id; const BLOCK_SIZE bsize = mbmi->sb_type; const int allow_hp = cm->allow_high_precision_mv; @@ -273,7 +273,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { - const MB_PREDICTION_MODE b_mode = mi->bmi[idy * 2 + idx].as_mode; + const PREDICTION_MODE b_mode = mi->bmi[idy * 2 + idx].as_mode; write_intra_mode(w, b_mode, cm->fc.y_mode_prob[0]); } } @@ -308,7 +308,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { const int j = idy * 2 + idx; - const MB_PREDICTION_MODE b_mode = mi->bmi[j].as_mode; + const PREDICTION_MODE b_mode = mi->bmi[j].as_mode; write_inter_mode(w, b_mode, inter_probs); ++cm->counts.inter_mode[mode_ctx][INTER_OFFSET(b_mode)]; if (b_mode == NEWMV) { diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 9956acc0b..2e44f7df3 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2412,7 +2412,7 @@ typedef enum { } motion_vector_context; static void set_mode_info(MB_MODE_INFO *mbmi, BLOCK_SIZE bsize, - MB_PREDICTION_MODE mode) { + PREDICTION_MODE mode) { mbmi->mode = mode; mbmi->uv_mode = mode; mbmi->mv[0].as_int = 0; @@ -2444,8 +2444,7 @@ static void nonrd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile, vp9_pick_inter_mode(cpi, x, tile, mi_row, mi_col, rate, dist, bsize); } else { - MB_PREDICTION_MODE intramode = DC_PRED; - set_mode_info(&xd->mi[0]->mbmi, bsize, intramode); + set_mode_info(&xd->mi[0]->mbmi, bsize, DC_PRED); } duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); } @@ -3209,8 +3208,8 @@ void vp9_encode_frame(VP9_COMP *cpi) { } static void sum_intra_stats(FRAME_COUNTS *counts, const MODE_INFO *mi) { - const MB_PREDICTION_MODE y_mode = mi->mbmi.mode; - const MB_PREDICTION_MODE uv_mode = mi->mbmi.uv_mode; + const PREDICTION_MODE y_mode = mi->mbmi.mode; + const PREDICTION_MODE uv_mode = mi->mbmi.uv_mode; const BLOCK_SIZE bsize = mi->mbmi.sb_type; if (bsize < BLOCK_8X8) { diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index b0c014eef..baa466554 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -473,7 +473,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); const scan_order *scan_order; TX_TYPE tx_type; - MB_PREDICTION_MODE mode; + PREDICTION_MODE mode; const int bwl = b_width_log2(plane_bsize); const int diff_stride = 4 * (1 << bwl); uint8_t *src, *dst; diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 2f63a13a0..e7dcc7a18 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -131,11 +131,10 @@ static int do_16x16_zerozero_search(VP9_COMP *cpi, int_mv *dst_mv) { return err; } -static int find_best_16x16_intra(VP9_COMP *cpi, - MB_PREDICTION_MODE *pbest_mode) { +static int find_best_16x16_intra(VP9_COMP *cpi, PREDICTION_MODE *pbest_mode) { MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; - MB_PREDICTION_MODE best_mode = -1, mode; + PREDICTION_MODE best_mode = -1, mode; unsigned int best_err = INT_MAX; // calculate SATD for each intra prediction mode; diff --git a/vp9/encoder/vp9_mbgraph.h b/vp9/encoder/vp9_mbgraph.h index bc2a7048f..c3af972bc 100644 --- a/vp9/encoder/vp9_mbgraph.h +++ b/vp9/encoder/vp9_mbgraph.h @@ -20,7 +20,7 @@ typedef struct { int err; union { int_mv mv; - MB_PREDICTION_MODE mode; + PREDICTION_MODE mode; } m; } ref[MAX_REF_FRAMES]; } MBGRAPH_MB_STATS; diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 30e03af63..c1493e719 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -212,7 +212,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; struct macroblock_plane *const p = &x->plane[0]; struct macroblockd_plane *const pd = &xd->plane[0]; - MB_PREDICTION_MODE this_mode, best_mode = ZEROMV; + PREDICTION_MODE this_mode, best_mode = ZEROMV; MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; INTERP_FILTER best_pred_filter = EIGHTTAP; int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; @@ -235,9 +235,12 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, unsigned char segment_id = mbmi->segment_id; const int *const rd_threshes = cpi->rd.threshes[segment_id][bsize]; const int *const rd_thresh_freq_fact = cpi->rd.thresh_freq_fact[bsize]; - // Mode index conversion form THR_MODES to MB_PREDICTION_MODE for a ref frame. + // Mode index conversion form THR_MODES to PREDICTION_MODE for a ref frame. int mode_idx[MB_MODE_COUNT] = {0}; INTERP_FILTER filter_ref = SWITCHABLE; + int bsl = mi_width_log2_lookup[bsize]; + int pred_filter_search = (((mi_row + mi_col) >> bsl) + + cpi->sf.chessboard_index) & 0x01; x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; @@ -338,6 +341,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // motion vector is at sub-pixel accuracy level for luma component, i.e., // the last three bits are all zeros. if ((this_mode == NEWMV || filter_ref == SWITCHABLE) && + pred_filter_search && ((mbmi->mv[0].as_mv.row & 0x07) != 0 || (mbmi->mv[0].as_mv.col & 0x07) != 0)) { int64_t tmp_rdcost1 = INT64_MAX; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 3dd35ce79..f309aac96 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -56,7 +56,7 @@ #define MIN_EARLY_TERM_INDEX 3 typedef struct { - MB_PREDICTION_MODE mode; + PREDICTION_MODE mode; MV_REFERENCE_FRAME ref_frame[2]; } MODE_DEFINITION; @@ -1021,8 +1021,8 @@ static void intra_super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, } -static int conditional_skipintra(MB_PREDICTION_MODE mode, - MB_PREDICTION_MODE best_intra_mode) { +static int conditional_skipintra(PREDICTION_MODE mode, + PREDICTION_MODE best_intra_mode) { if (mode == D117_PRED && best_intra_mode != V_PRED && best_intra_mode != D135_PRED) @@ -1043,13 +1043,13 @@ static int conditional_skipintra(MB_PREDICTION_MODE mode, } static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, - MB_PREDICTION_MODE *best_mode, + PREDICTION_MODE *best_mode, const int *bmode_costs, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, int *bestrate, int *bestratey, int64_t *bestdistortion, BLOCK_SIZE bsize, int64_t rd_thresh) { - MB_PREDICTION_MODE mode; + PREDICTION_MODE mode; MACROBLOCKD *const xd = &x->e_mbd; int64_t best_rd = rd_thresh; @@ -1195,13 +1195,13 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP *cpi, MACROBLOCK *mb, // Pick modes for each sub-block (of size 4x4, 4x8, or 8x4) in an 8x8 block. for (idy = 0; idy < 2; idy += num_4x4_blocks_high) { for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) { - MB_PREDICTION_MODE best_mode = DC_PRED; + PREDICTION_MODE best_mode = DC_PRED; int r = INT_MAX, ry = INT_MAX; int64_t d = INT64_MAX, this_rd = INT64_MAX; i = idy * 2 + idx; if (cpi->common.frame_type == KEY_FRAME) { - const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, i); - const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, i); + const PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, i); + const PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, i); bmode_costs = mb->y_mode_costs[A][L]; } @@ -1242,8 +1242,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int64_t tx_cache[TX_MODES], int64_t best_rd) { - MB_PREDICTION_MODE mode; - MB_PREDICTION_MODE mode_selected = DC_PRED; + PREDICTION_MODE mode; + PREDICTION_MODE mode_selected = DC_PRED; MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *const mic = xd->mi[0]; int this_rate, this_rate_tokenonly, s; @@ -1266,8 +1266,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, continue; if (cpi->common.frame_type == KEY_FRAME) { - const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, 0); - const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, 0); + const PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, 0); + const PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, 0); bmode_costs = x->y_mode_costs[A][L]; } @@ -1361,8 +1361,8 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, int64_t *distortion, int *skippable, BLOCK_SIZE bsize, TX_SIZE max_tx_size) { MACROBLOCKD *xd = &x->e_mbd; - MB_PREDICTION_MODE mode; - MB_PREDICTION_MODE mode_selected = DC_PRED; + PREDICTION_MODE mode; + PREDICTION_MODE mode_selected = DC_PRED; int64_t best_rd = INT64_MAX, this_rd; int this_rate_tokenonly, this_rate, s; int64_t this_distortion, this_sse; @@ -1434,7 +1434,7 @@ static void choose_intra_uv_mode(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, BLOCK_SIZE bsize, TX_SIZE max_tx_size, int *rate_uv, int *rate_uv_tokenonly, int64_t *dist_uv, int *skip_uv, - MB_PREDICTION_MODE *mode_uv) { + PREDICTION_MODE *mode_uv) { MACROBLOCK *const x = &cpi->mb; // Use an estimated rd for uv_intra based on DC_PRED if the @@ -1452,7 +1452,7 @@ static void choose_intra_uv_mode(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, *mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode; } -static int cost_mv_ref(const VP9_COMP *cpi, MB_PREDICTION_MODE mode, +static int cost_mv_ref(const VP9_COMP *cpi, PREDICTION_MODE mode, int mode_context) { const MACROBLOCK *const x = &cpi->mb; const int segment_id = x->e_mbd.mi[0]->mbmi.segment_id; @@ -1474,7 +1474,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int *rate_mv); static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCKD *xd, int i, - MB_PREDICTION_MODE mode, int_mv this_mv[2], + PREDICTION_MODE mode, int_mv this_mv[2], int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES], int_mv seg_mvs[MAX_REF_FRAMES], int_mv *best_ref_mv[2], const int *mvjcost, @@ -1627,7 +1627,7 @@ typedef struct { int64_t d; int64_t sse; int segment_yrate; - MB_PREDICTION_MODE modes[4]; + PREDICTION_MODE modes[4]; SEG_RDSTAT rdstat[4][INTER_MODES]; int mvthresh; } BEST_SEG_INFO; @@ -1725,7 +1725,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, int mode_idx; int k, br = 0, idx, idy; int64_t bd = 0, block_sse = 0; - MB_PREDICTION_MODE this_mode; + PREDICTION_MODE this_mode; VP9_COMMON *cm = &cpi->common; struct macroblock_plane *const p = &x->plane[0]; struct macroblockd_plane *const pd = &xd->plane[0]; @@ -1769,7 +1769,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, // loop for 4x4/4x8/8x4 block coding. to be replaced with new rd loop int_mv mode_mv[MB_MODE_COUNT][2]; int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; - MB_PREDICTION_MODE mode_selected = ZEROMV; + PREDICTION_MODE mode_selected = ZEROMV; int64_t best_rd = INT64_MAX; const int i = idy * 2 + idx; int ref; @@ -3132,7 +3132,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; const struct segmentation *const seg = &cm->seg; - MB_PREDICTION_MODE this_mode; + PREDICTION_MODE this_mode; MV_REFERENCE_FRAME ref_frame, second_ref_frame; unsigned char segment_id = mbmi->segment_id; int comp_pred, i; @@ -3154,13 +3154,13 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, vp9_prob comp_mode_p; int64_t best_intra_rd = INT64_MAX; int64_t best_inter_rd = INT64_MAX; - MB_PREDICTION_MODE best_intra_mode = DC_PRED; + PREDICTION_MODE best_intra_mode = DC_PRED; MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME; INTERP_FILTER tmp_best_filter = SWITCHABLE; int rate_uv_intra[TX_SIZES], rate_uv_tokenonly[TX_SIZES]; int64_t dist_uv[TX_SIZES]; int skip_uv[TX_SIZES]; - MB_PREDICTION_MODE mode_uv[TX_SIZES]; + PREDICTION_MODE mode_uv[TX_SIZES]; int64_t mode_distortions[MB_MODE_COUNT] = {-1}; int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); const int bws = num_8x8_blocks_wide_lookup[bsize] / 2; @@ -3774,7 +3774,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int rate_uv_intra, rate_uv_tokenonly; int64_t dist_uv; int skip_uv; - MB_PREDICTION_MODE mode_uv = DC_PRED; + PREDICTION_MODE mode_uv = DC_PRED; int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); int_mv seg_mvs[4][MAX_REF_FRAMES]; b_mode_info best_bmodes[4]; diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index f0ee7c721..93e23eee2 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -268,6 +268,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf, sf->use_nonrd_pick_mode = 1; sf->search_method = FAST_DIAMOND; sf->allow_skip_recode = 0; + sf->chessboard_index = cm->current_video_frame & 0x01; } if (speed >= 6) { diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h index 55422979a..cff99a6dc 100644 --- a/vp9/encoder/vp9_speed_features.h +++ b/vp9/encoder/vp9_speed_features.h @@ -274,6 +274,9 @@ typedef struct { // encoding process for RTC. int partition_check; + // Chessboard pattern index + int chessboard_index; + // Use finer quantizer in every other few frames that run variable block // partition type search. int force_frame_boost; diff --git a/vp9/encoder/vp9_variance.c b/vp9/encoder/vp9_variance.c index 696faf114..1399bfb7e 100644 --- a/vp9/encoder/vp9_variance.c +++ b/vp9/encoder/vp9_variance.c @@ -109,17 +109,16 @@ unsigned int vp9_get_mb_ss_c(const int16_t *src_ptr) { return sum; } -unsigned int vp9_variance64x32_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 11)); +#define VAR(W, H) \ +unsigned int vp9_variance##W##x##H##_c(const uint8_t *a, int a_stride, \ + const uint8_t *b, int b_stride, \ + unsigned int *sse) { \ + unsigned int var; \ + int avg; \ +\ + variance(a, a_stride, b, b_stride, W, H, &var, &avg); \ + *sse = var; \ + return var - (((int64_t)avg * avg) / (W * H)); \ } #define SUBPIX_VAR(W, H) \ @@ -161,175 +160,18 @@ unsigned int vp9_sub_pixel_avg_variance##W##x##H##_c( \ } -unsigned int vp9_variance32x64_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 64, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 11)); -} - -unsigned int vp9_variance32x16_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 16, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 9)); -} - -unsigned int vp9_variance16x32_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 32, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 9)); -} - -unsigned int vp9_variance64x64_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 64, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 12)); -} - -unsigned int vp9_variance32x32_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32, &var, &avg); - *sse = var; - return (var - (((int64_t)avg * avg) >> 10)); -} - void vp9_get_sse_sum_16x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum) { variance(src_ptr, source_stride, ref_ptr, ref_stride, 16, 16, sse, sum); } -unsigned int vp9_variance16x16_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 8)); -} - -unsigned int vp9_variance8x16_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 7)); -} - -unsigned int vp9_variance16x8_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 7)); -} - void vp9_get_sse_sum_8x8_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum) { variance(src_ptr, source_stride, ref_ptr, ref_stride, 8, 8, sse, sum); } -unsigned int vp9_variance8x8_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 6)); -} - -unsigned int vp9_variance8x4_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 4, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 5)); -} - -unsigned int vp9_variance4x8_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 8, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 5)); -} - -unsigned int vp9_variance4x4_c(const uint8_t *src_ptr, - int source_stride, - const uint8_t *ref_ptr, - int recon_stride, - unsigned int *sse) { - unsigned int var; - int avg; - - variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg); - *sse = var; - return (var - (((unsigned int)avg * avg) >> 4)); -} - - unsigned int vp9_mse16x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, @@ -382,42 +224,55 @@ unsigned int vp9_mse8x8_c(const uint8_t *src_ptr, return var; } +VAR(4, 4) SUBPIX_VAR(4, 4) SUBPIX_AVG_VAR(4, 4) +VAR(4, 8) SUBPIX_VAR(4, 8) SUBPIX_AVG_VAR(4, 8) +VAR(8, 4) SUBPIX_VAR(8, 4) SUBPIX_AVG_VAR(8, 4) +VAR(8, 8) SUBPIX_VAR(8, 8) SUBPIX_AVG_VAR(8, 8) +VAR(8, 16) SUBPIX_VAR(8, 16) SUBPIX_AVG_VAR(8, 16) +VAR(16, 8) SUBPIX_VAR(16, 8) SUBPIX_AVG_VAR(16, 8) +VAR(16, 16) SUBPIX_VAR(16, 16) SUBPIX_AVG_VAR(16, 16) +VAR(16, 32) SUBPIX_VAR(16, 32) SUBPIX_AVG_VAR(16, 32) +VAR(32, 16) SUBPIX_VAR(32, 16) SUBPIX_AVG_VAR(32, 16) +VAR(32, 32) SUBPIX_VAR(32, 32) SUBPIX_AVG_VAR(32, 32) +VAR(32, 64) SUBPIX_VAR(32, 64) SUBPIX_AVG_VAR(32, 64) +VAR(64, 32) SUBPIX_VAR(64, 32) SUBPIX_AVG_VAR(64, 32) +VAR(64, 64) SUBPIX_VAR(64, 64) SUBPIX_AVG_VAR(64, 64) @@ -119,7 +119,7 @@ static const arg_def_t *vp8_pp_args[] = { #endif static int vpx_image_scale(vpx_image_t *src, vpx_image_t *dst, - FilterMode mode) { + FilterModeEnum mode) { assert(src->fmt == VPX_IMG_FMT_I420); assert(dst->fmt == VPX_IMG_FMT_I420); return I420Scale(src->planes[VPX_PLANE_Y], src->stride[VPX_PLANE_Y], |