Commit 48b27135 authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Merge branch 'master' into nextgenv2

parents 9604f690 693dcc86
......@@ -611,7 +611,11 @@ process_toolchain() {
;;
*) check_add_cflags -Wunused-but-set-variable ;;
esac
enabled extra_warnings || check_add_cflags -Wno-unused-function
if enabled mips || [ -z "${INLINE}" ]; then
enabled extra_warnings || check_add_cflags -Wno-unused-function
else
check_add_cflags -Wunused-function
fi
fi
if enabled icc; then
......
......@@ -21,14 +21,14 @@
namespace {
#if CONFIG_WEBM_IO
const int kLegacyByteAlignment = 0;
const int kLegacyYPlaneByteAlignment = 32;
const int kNumPlanesToCheck = 3;
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
const char kVP9Md5File[] = "vp90-2-02-size-lf-1920x1080.webm.md5";
#if CONFIG_WEBM_IO
struct ByteAlignmentTestParam {
int byte_alignment;
vpx_codec_err_t expected_value;
......
......@@ -293,6 +293,7 @@ void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
vp9_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
}
#if HAVE_SSE2
void idct16x16_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct16x16_10_add_c(in, out, stride, 10);
}
......@@ -301,7 +302,6 @@ void idct16x16_10_add_12_c(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct16x16_10_add_c(in, out, stride, 12);
}
#if HAVE_SSE2
void idct16x16_256_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct16x16_256_add_sse2(in, out, stride, 10);
}
......
......@@ -81,10 +81,6 @@ typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>
Trans32x32Param;
#if CONFIG_VP9_HIGHBITDEPTH
void idct32x32_8(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 8);
}
void idct32x32_10(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 10);
}
......
......@@ -24,7 +24,6 @@
namespace {
const int kVideoNameParam = 1;
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
struct ExternalFrameBuffer {
uint8_t *data;
......@@ -155,6 +154,8 @@ class ExternalFrameBufferList {
ExternalFrameBuffer *ext_fb_list_;
};
#if CONFIG_WEBM_IO
// Callback used by libvpx to request the application to return a frame
// buffer of at least |min_size| in bytes.
int get_vp9_frame_buffer(void *user_priv, size_t min_size,
......@@ -197,6 +198,8 @@ int do_not_release_vp9_frame_buffer(void *user_priv,
return 0;
}
#endif // CONFIG_WEBM_IO
// Class for testing passing in external frame buffers to libvpx.
class ExternalFrameBufferMD5Test
: public ::libvpx_test::DecoderTest,
......@@ -278,6 +281,8 @@ class ExternalFrameBufferMD5Test
};
#if CONFIG_WEBM_IO
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
// Class for testing passing in external frame buffers to libvpx.
class ExternalFrameBufferTest : public ::testing::Test {
protected:
......
......@@ -107,6 +107,8 @@ void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
}
#if HAVE_SSE2
void idct8x8_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct8x8_10_add_c(in, out, stride, 10);
}
......@@ -115,7 +117,6 @@ void idct8x8_10_add_12_c(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct8x8_10_add_c(in, out, stride, 12);
}
#if HAVE_SSE2
void idct8x8_10_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct8x8_10_add_sse2(in, out, stride, 10);
}
......
......@@ -2151,6 +2151,8 @@ static int test_candidate_kf(TWO_PASS *twopass,
return is_viable_kf;
}
#define FRAMES_TO_CHECK_DECAY 8
static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
int i, j;
RATE_CONTROL *const rc = &cpi->rc;
......@@ -2169,7 +2171,7 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
double boost_score = 0.0;
double kf_mod_err = 0.0;
double kf_group_err = 0.0;
double recent_loop_decay[8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
double recent_loop_decay[FRAMES_TO_CHECK_DECAY];
vp10_zero(next_frame);
......@@ -2196,6 +2198,10 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
// Initialize the decay rates for the recent frames to check
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
recent_loop_decay[j] = 1.0;
// Find the next keyframe.
i = 0;
while (twopass->stats_in < twopass->stats_in_end &&
......@@ -2222,9 +2228,9 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// We want to know something about the recent past... rather than
// as used elsewhere where we are concerned with decay in prediction
// quality since the last GF or KF.
recent_loop_decay[i % 8] = loop_decay_rate;
recent_loop_decay[i % FRAMES_TO_CHECK_DECAY] = loop_decay_rate;
decay_accumulator = 1.0;
for (j = 0; j < 8; ++j)
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
decay_accumulator *= recent_loop_decay[j];
// Special check for transition or high motion followed by a
......
......@@ -310,6 +310,15 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
}
# End vp9_high encoder functions
#
# frame based scale
#
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
} else {
add_proto qw/void vp9_scale_and_extend_frame/, "const struct yv12_buffer_config *src, struct yv12_buffer_config *dst";
specialize qw/vp9_scale_and_extend_frame ssse3/;
}
}
# end encoder functions
1;
......@@ -23,14 +23,6 @@
#define EOB_CONTEXT_NODE 0
#define ZERO_CONTEXT_NODE 1
#define ONE_CONTEXT_NODE 2
#define LOW_VAL_CONTEXT_NODE 0
#define TWO_CONTEXT_NODE 1
#define THREE_CONTEXT_NODE 2
#define HIGH_LOW_CONTEXT_NODE 3
#define CAT_ONE_CONTEXT_NODE 4
#define CAT_THREEFOUR_CONTEXT_NODE 5
#define CAT_THREE_CONTEXT_NODE 6
#define CAT_FIVE_CONTEXT_NODE 7
#define INCREMENT_COUNT(token) \
do { \
......
......@@ -21,12 +21,6 @@
#include "vp9/encoder/vp9_rd.h"
#include "vp9/encoder/vp9_segmentation.h"
#define ENERGY_MIN (-4)
#define ENERGY_MAX (1)
#define ENERGY_SPAN (ENERGY_MAX - ENERGY_MIN + 1)
#define ENERGY_IN_BOUNDS(energy)\
assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX)
static const double rate_ratio[MAX_SEGMENTS] =
{1.0, 0.75, 0.6, 0.5, 0.4, 0.3, 0.25};
......
......@@ -35,9 +35,6 @@ static const double aq_c_var_thresholds[AQ_C_STRENGTHS][AQ_C_SEGMENTS] =
{-3.5, -2.5, -1.5, 100.00, 100.0},
{-3.0, -2.0, -1.0, 100.00, 100.0} };
#define DEFAULT_COMPLEXITY 64
static int get_aq_c_strength(int q_index, vpx_bit_depth_t bit_depth) {
// Approximate base quatizer (truncated to int)
const int base_quant = vp9_ac_quant(q_index, 0, bit_depth) / 4;
......@@ -107,7 +104,6 @@ void vp9_setup_in_frame_q_adj(VP9_COMP *cpi) {
#define DEFAULT_LV_THRESH 10.0
#define MIN_DEFAULT_LV_THRESH 8.0
#define VAR_STRENGTH_STEP 0.25
// Select a segment for the current block.
// The choice of segment for a block depends on the ratio of the projected
// bits for the block vs a target average and its spatial complexity.
......
......@@ -62,8 +62,6 @@
#define AM_SEGMENT_ID_INACTIVE 7
#define AM_SEGMENT_ID_ACTIVE 0
#define SHARP_FILTER_QTHRESH 0 /* Q threshold for 8-tap sharp filter */
#define ALTREF_HIGH_PRECISION_MV 1 // Whether to use high precision mv
// for altref computation.
#define HIGH_PRECISION_MV_QTHRESH 200 // Q threshold for high precision
......@@ -1967,11 +1965,14 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf,
return cpi;
}
#if CONFIG_INTERNAL_STATS
#define SNPRINT(H, T) \
snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T))
#define SNPRINT2(H, T, V) \
snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
#endif // CONFIG_INTERNAL_STATS
void vp9_remove_compressor(VP9_COMP *cpi) {
VP9_COMMON *cm;
......@@ -2613,10 +2614,6 @@ static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src,
#if CONFIG_VP9_HIGHBITDEPTH
static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int bd) {
#else
static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst) {
#endif // CONFIG_VP9_HIGHBITDEPTH
const int src_w = src->y_crop_width;
const int src_h = src->y_crop_height;
const int dst_w = dst->y_crop_width;
......@@ -2628,19 +2625,18 @@ static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
const InterpKernel *const kernel = vp9_filter_kernels[EIGHTTAP];
int x, y, i;
for (y = 0; y < dst_h; y += 16) {
for (x = 0; x < dst_w; x += 16) {
for (i = 0; i < MAX_MB_PLANE; ++i) {
const int factor = (i == 0 || i == 3 ? 1 : 2);
for (i = 0; i < MAX_MB_PLANE; ++i) {
const int factor = (i == 0 || i == 3 ? 1 : 2);
const int src_stride = src_strides[i];
const int dst_stride = dst_strides[i];
for (y = 0; y < dst_h; y += 16) {
const int y_q4 = y * (16 / factor) * src_h / dst_h;
for (x = 0; x < dst_w; x += 16) {
const int x_q4 = x * (16 / factor) * src_w / dst_w;
const int y_q4 = y * (16 / factor) * src_h / dst_h;
const int src_stride = src_strides[i];
const int dst_stride = dst_strides[i];
const uint8_t *src_ptr = srcs[i] + (y / factor) * src_h / dst_h *
src_stride + (x / factor) * src_w / dst_w;
src_stride + (x / factor) * src_w / dst_w;
uint8_t *dst_ptr = dsts[i] + (y / factor) * dst_stride + (x / factor);
#if CONFIG_VP9_HIGHBITDEPTH
if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
vpx_highbd_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
kernel[x_q4 & 0xf], 16 * src_w / dst_w,
......@@ -2652,18 +2648,49 @@ static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
kernel[y_q4 & 0xf], 16 * src_h / dst_h,
16 / factor, 16 / factor);
}
}
}
}
vpx_extend_frame_borders(dst);
}
#else
void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst) {
const int src_w = src->y_crop_width;
const int src_h = src->y_crop_height;
const int dst_w = dst->y_crop_width;
const int dst_h = dst->y_crop_height;
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
const InterpKernel *const kernel = vp9_filter_kernels[EIGHTTAP];
int x, y, i;
for (i = 0; i < MAX_MB_PLANE; ++i) {
const int factor = (i == 0 || i == 3 ? 1 : 2);
const int src_stride = src_strides[i];
const int dst_stride = dst_strides[i];
for (y = 0; y < dst_h; y += 16) {
const int y_q4 = y * (16 / factor) * src_h / dst_h;
for (x = 0; x < dst_w; x += 16) {
const int x_q4 = x * (16 / factor) * src_w / dst_w;
const uint8_t *src_ptr = srcs[i] + (y / factor) * src_h / dst_h *
src_stride + (x / factor) * src_w / dst_w;
uint8_t *dst_ptr = dsts[i] + (y / factor) * dst_stride + (x / factor);
vpx_scaled_2d(src_ptr, src_stride, dst_ptr, dst_stride,
kernel[x_q4 & 0xf], 16 * src_w / dst_w,
kernel[y_q4 & 0xf], 16 * src_h / dst_h,
16 / factor, 16 / factor);
#endif // CONFIG_VP9_HIGHBITDEPTH
}
}
}
vpx_extend_frame_borders(dst);
}
#endif // CONFIG_VP9_HIGHBITDEPTH
static int scale_down(VP9_COMP *cpi, int q) {
RATE_CONTROL *const rc = &cpi->rc;
......@@ -2938,7 +2965,7 @@ void vp9_scale_references(VP9_COMP *cpi) {
cm->subsampling_x, cm->subsampling_y,
VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
NULL, NULL, NULL);
scale_and_extend_frame(ref, &new_fb_ptr->buf);
vp9_scale_and_extend_frame(ref, &new_fb_ptr->buf);
cpi->scaled_ref_idx[ref_frame - 1] = new_fb;
alloc_frame_mvs(cm, new_fb);
}
......@@ -3302,7 +3329,6 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
vpx_clear_system_state();
set_frame_size(cpi);
cpi->Source = vp9_scale_if_required(cm,
cpi->un_scaled_source,
&cpi->scaled_source,
......@@ -3320,7 +3346,6 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
cpi->unscaled_last_source,
&cpi->scaled_last_source,
(cpi->oxcf.pass == 0));
vp9_update_noise_estimate(cpi);
if (cpi->oxcf.pass == 0 &&
......@@ -3742,7 +3767,7 @@ YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
if (use_normative_scaler &&
unscaled->y_width <= (scaled->y_width << 1) &&
unscaled->y_height <= (scaled->y_height << 1))
scale_and_extend_frame(unscaled, scaled);
vp9_scale_and_extend_frame(unscaled, scaled);
else
scale_and_extend_frame_nonnormative(unscaled, scaled);
#endif // CONFIG_VP9_HIGHBITDEPTH
......
......@@ -2260,6 +2260,8 @@ static int test_candidate_kf(TWO_PASS *twopass,
return is_viable_kf;
}
#define FRAMES_TO_CHECK_DECAY 8
static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
int i, j;
RATE_CONTROL *const rc = &cpi->rc;
......@@ -2278,7 +2280,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
double boost_score = 0.0;
double kf_mod_err = 0.0;
double kf_group_err = 0.0;
double recent_loop_decay[8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
double recent_loop_decay[FRAMES_TO_CHECK_DECAY];
vp9_zero(next_frame);
......@@ -2305,6 +2307,10 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
// Initialize the decay rates for the recent frames to check
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
recent_loop_decay[j] = 1.0;
// Find the next keyframe.
i = 0;
while (twopass->stats_in < twopass->stats_in_end &&
......@@ -2331,9 +2337,9 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// We want to know something about the recent past... rather than
// as used elsewhere where we are concerned with decay in prediction
// quality since the last GF or KF.
recent_loop_decay[i % 8] = loop_decay_rate;
recent_loop_decay[i % FRAMES_TO_CHECK_DECAY] = loop_decay_rate;
decay_accumulator = 1.0;
for (j = 0; j < 8; ++j)
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
decay_accumulator *= recent_loop_decay[j];
// Special check for transition or high motion followed by a
......
......@@ -153,10 +153,10 @@ void vp9_init3smotion_compensation(search_site_config *cfg, int stride) {
*/
/* estimated cost of a motion vector (r,c) */
#define MVC(r, c) \
(mvcost ? \
((mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
mvcost[0][((r) - rr)] + mvcost[1][((c) - rc)]) * \
#define MVC(r, c) \
(mvcost ? \
((unsigned)(mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
mvcost[0][((r) - rr)] + mvcost[1][((c) - rc)]) * \
error_per_bit + 4096) >> 13 : 0)
......@@ -849,9 +849,9 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x,
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
// mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
x->errorperbit);
mv_err_cost(&this_mv, &fcenter_mv,
x->nmvjointcost, x->mvcost,
x->errorperbit);
}
} else {
for (i = 0; i < 4; i++) {
......@@ -863,9 +863,9 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x,
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
// mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
x->errorperbit);
mv_err_cost(&this_mv, &fcenter_mv,
x->nmvjointcost, x->mvcost,
x->errorperbit);
}
}
}
......
......@@ -3355,15 +3355,19 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi,
}
if (!disable_skip) {
vpx_prob skip_prob = vp9_get_skip_prob(cm, xd);
if (skippable) {
// Back out the coefficient coding costs
rate2 -= (rate_y + rate_uv);
// Cost the skip mb case
rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
rate2 += vp9_cost_bit(skip_prob, 1);
} else if (ref_frame != INTRA_FRAME && !xd->lossless) {
if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) <
RDCOST(x->rdmult, x->rddiv, 0, total_sse)) {
if (RDCOST(x->rdmult, x->rddiv,
rate_y + rate_uv + vp9_cost_bit(skip_prob, 0),
distortion2) <
RDCOST(x->rdmult, x->rddiv,
vp9_cost_bit(skip_prob, 1), total_sse)) {
// Add in the cost of the no skip flag.
rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
} else {
......
......@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include "./vpx_config.h"
#if CONFIG_VP9_HIGHBITDEPTH
#include "vpx_dsp/vpx_dsp_common.h"
#endif // CONFIG_VP9_HIGHBITDEPTH
......
......@@ -21,10 +21,11 @@
static const int skin_mean[5][2] = {
{7463, 9614}, {6400, 10240}, {7040, 10240}, {8320, 9280}, {6800, 9614}};
static const int skin_inv_cov[4] = {4107, 1663, 1663, 2157}; // q16
static const int skin_threshold[2] = {1570636, 800000}; // q18
static const int skin_threshold[6] = {1570636, 1400000, 800000, 800000, 800000,
800000}; // q18
// Thresholds on luminance.
static const int y_low = 20;
static const int y_low = 40;
static const int y_high = 220;
// Evaluates the Mahalanobis distance measure for the input CbCr values.
......@@ -55,10 +56,24 @@ int vp9_skin_pixel(const uint8_t y, const uint8_t cb, const uint8_t cr) {
return (evaluate_skin_color_difference(cb, cr, 0) < skin_threshold[0]);
} else {
int i = 0;
// Exit on grey.
if (cb == 128 && cr == 128)
return 0;
// Exit on very strong cb.
if (cb > 150 && cr < 110)
return 0;
// Exit on (another) low luminance threshold if either color is high.
if (y < 50 && (cb > 140 || cr > 140))
return 0;
for (; i < 5; i++) {
if (evaluate_skin_color_difference(cb, cr, i) < skin_threshold[1]) {
if (evaluate_skin_color_difference(cb, cr, i) < skin_threshold[i + 1]) {
return 1;
}
// Exit if difference is much large than the threshold.
if (evaluate_skin_color_difference(cb, cr, i) >
(skin_threshold[i + 1] << 3)) {
return 0;
}
}
return 0;
}
......
......@@ -16,7 +16,6 @@
#include "vp9/encoder/vp9_extend.h"
#include "vpx_dsp/vpx_dsp_common.h"
#define SMALL_FRAME_FB_IDX 7
#define SMALL_FRAME_WIDTH 32
#define SMALL_FRAME_HEIGHT 16
......@@ -644,6 +643,8 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
}
#if CONFIG_SPATIAL_SVC
#define SMALL_FRAME_FB_IDX 7
int vp9_svc_start_frame(VP9_COMP *const cpi) {
int width = 0, height = 0;
LAYER_CONTEXT *lc;
......@@ -754,7 +755,8 @@ int vp9_svc_start_frame(VP9_COMP *const cpi) {
return 0;
}
#endif
#undef SMALL_FRAME_FB_IDX
#endif // CONFIG_SPATIAL_SVC
struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi,
struct lookahead_ctx *ctx,
......
......@@ -19,11 +19,11 @@
#include "vpx_ports/mem.h"
#ifdef __GNUC__
# define __likely__(v) __builtin_expect(v, 1)
# define __unlikely__(v) __builtin_expect(v, 0)
# define LIKELY(v) __builtin_expect(v, 1)
# define UNLIKELY(v) __builtin_expect(v, 0)
#else
# define __likely__(v) (v)
# define __unlikely__(v) (v)
# define LIKELY(v) (v)
# define UNLIKELY(v) (v)
#endif
static INLINE int_mv pack_int_mv(int16_t row, int16_t col) {
......@@ -50,8 +50,9 @@ static int mvsad_err_cost(const MACROBLOCK *x, const int_mv mv, const MV *ref,
int error_per_bit) {
const int_mv diff = pack_int_mv(mv.as_mv.row - ref->row,
mv.as_mv.col - ref->col);
return ROUND_POWER_OF_TWO(mv_cost(diff, x->nmvjointsadcost,
x->nmvsadcost) * error_per_bit, 8);
return ROUND_POWER_OF_TWO((unsigned)mv_cost(diff, x->nmvjointsadcost,
x->nmvsadcost) *
error_per_bit, 8);
}
/*****************************************************************************
......@@ -162,7 +163,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x,
v_inside_d = _mm_cmpeq_epi32(v_these_mv_clamp_w, v_these_mv_w);
// If none of them are inside, then move on
if (__likely__(_mm_test_all_zeros(v_inside_d, v_inside_d))) {
if (LIKELY(_mm_test_all_zeros(v_inside_d, v_inside_d))) {
continue;
}
......@@ -268,7 +269,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x,
// If the local best value is not saturated, just use it, otherwise
// find the horizontal minimum again the hard way on 32 bits.
// This is executed rarely.
if (__unlikely__(local_best_sad == 0xffff)) {
if (UNLIKELY(local_best_sad == 0xffff)) {
__m128i v_loval_d, v_hival_d, v_loidx_d, v_hiidx_d, v_sel_d;
v_loval_d = v_sad_d;
......@@ -293,7 +294,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x,
}
// Update the global minimum if the local minimum is smaller
if (__likely__(local_best_sad < best_sad)) {
if (LIKELY(local_best_sad < best_sad)) {
new_bmv = ((const int_mv *)&v_these_mv_w)[local_best_idx];
new_best_address = ((const uint8_t **)v_blocka)[local_best_idx];
......@@ -312,7 +313,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x,
v_ba_d = _mm_set1_epi32((intptr_t)best_address);
#endif
if (__unlikely__(best_address == in_what)) {
if (UNLIKELY(best_address == in_what)) {