Move build_intra_predictors_mby to RTCD framework
The vp8_build_intra_predictors_mby and vp8_build_intra_predictors_mby_s functions had global function pointers rather than using the RTCD framework. This can show up as a potential data race with tools such as helgrind. See https://bugzilla.mozilla.org/show_bug.cgi?id=640935 for an example. Change-Id: I29c407f828ac2bddfc039f852f138de5de888534
This commit is contained in:
parent
5db0eeea21
commit
27972d2c1d
@ -19,14 +19,6 @@
|
|||||||
#include "vp8/common/idct.h"
|
#include "vp8/common/idct.h"
|
||||||
#include "vp8/common/onyxc_int.h"
|
#include "vp8/common/onyxc_int.h"
|
||||||
|
|
||||||
extern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
|
|
||||||
|
|
||||||
extern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
|
|
||||||
|
|
||||||
void vp8_arch_arm_common_init(VP8_COMMON *ctx)
|
void vp8_arch_arm_common_init(VP8_COMMON *ctx)
|
||||||
{
|
{
|
||||||
#if CONFIG_RUNTIME_CPU_DETECT
|
#if CONFIG_RUNTIME_CPU_DETECT
|
||||||
@ -106,31 +98,12 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
|
|||||||
rtcd->recon.recon2 = vp8_recon2b_neon;
|
rtcd->recon.recon2 = vp8_recon2b_neon;
|
||||||
rtcd->recon.recon4 = vp8_recon4b_neon;
|
rtcd->recon.recon4 = vp8_recon4b_neon;
|
||||||
rtcd->recon.recon_mb = vp8_recon_mb_neon;
|
rtcd->recon.recon_mb = vp8_recon_mb_neon;
|
||||||
|
rtcd->recon.build_intra_predictors_mby =
|
||||||
|
vp8_build_intra_predictors_mby_neon;
|
||||||
|
rtcd->recon.build_intra_predictors_mby_s =
|
||||||
|
vp8_build_intra_predictors_mby_s_neon;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_ARMV6
|
|
||||||
#if CONFIG_RUNTIME_CPU_DETECT
|
|
||||||
if (has_media)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
|
|
||||||
vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_ARMV7
|
|
||||||
#if CONFIG_RUNTIME_CPU_DETECT
|
|
||||||
if (has_neon)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
vp8_build_intra_predictors_mby_ptr =
|
|
||||||
vp8_build_intra_predictors_mby_neon;
|
|
||||||
vp8_build_intra_predictors_mby_s_ptr =
|
|
||||||
vp8_build_intra_predictors_mby_s_neon;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,9 @@ extern prototype_copy_block(vp8_copy_mem16x16_neon);
|
|||||||
|
|
||||||
extern prototype_recon_macroblock(vp8_recon_mb_neon);
|
extern prototype_recon_macroblock(vp8_recon_mb_neon);
|
||||||
|
|
||||||
|
extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_neon);
|
||||||
|
extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_s_neon);
|
||||||
|
|
||||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||||
#undef vp8_recon_recon
|
#undef vp8_recon_recon
|
||||||
#define vp8_recon_recon vp8_recon_b_neon
|
#define vp8_recon_recon vp8_recon_b_neon
|
||||||
@ -74,6 +77,13 @@ extern prototype_recon_macroblock(vp8_recon_mb_neon);
|
|||||||
|
|
||||||
#undef vp8_recon_recon_mb
|
#undef vp8_recon_recon_mb
|
||||||
#define vp8_recon_recon_mb vp8_recon_mb_neon
|
#define vp8_recon_recon_mb vp8_recon_mb_neon
|
||||||
|
|
||||||
|
#undef vp8_recon_build_intra_predictors_mby
|
||||||
|
#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby_neon
|
||||||
|
|
||||||
|
#undef vp8_recon_build_intra_predictors_mby_s
|
||||||
|
#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_neon
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,12 +20,6 @@
|
|||||||
extern void vp8_arch_x86_common_init(VP8_COMMON *ctx);
|
extern void vp8_arch_x86_common_init(VP8_COMMON *ctx);
|
||||||
extern void vp8_arch_arm_common_init(VP8_COMMON *ctx);
|
extern void vp8_arch_arm_common_init(VP8_COMMON *ctx);
|
||||||
|
|
||||||
void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
|
|
||||||
|
|
||||||
void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
|
|
||||||
|
|
||||||
void vp8_machine_specific_config(VP8_COMMON *ctx)
|
void vp8_machine_specific_config(VP8_COMMON *ctx)
|
||||||
{
|
{
|
||||||
#if CONFIG_RUNTIME_CPU_DETECT
|
#if CONFIG_RUNTIME_CPU_DETECT
|
||||||
@ -45,6 +39,10 @@ void vp8_machine_specific_config(VP8_COMMON *ctx)
|
|||||||
rtcd->recon.recon4 = vp8_recon4b_c;
|
rtcd->recon.recon4 = vp8_recon4b_c;
|
||||||
rtcd->recon.recon_mb = vp8_recon_mb_c;
|
rtcd->recon.recon_mb = vp8_recon_mb_c;
|
||||||
rtcd->recon.recon_mby = vp8_recon_mby_c;
|
rtcd->recon.recon_mby = vp8_recon_mby_c;
|
||||||
|
rtcd->recon.build_intra_predictors_mby =
|
||||||
|
vp8_build_intra_predictors_mby;
|
||||||
|
rtcd->recon.build_intra_predictors_mby_s =
|
||||||
|
vp8_build_intra_predictors_mby_s;
|
||||||
|
|
||||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c;
|
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c;
|
||||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c;
|
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c;
|
||||||
@ -75,9 +73,6 @@ void vp8_machine_specific_config(VP8_COMMON *ctx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* Pure C: */
|
|
||||||
vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
|
|
||||||
vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
|
|
||||||
|
|
||||||
#if ARCH_X86 || ARCH_X86_64
|
#if ARCH_X86 || ARCH_X86_64
|
||||||
vp8_arch_x86_common_init(ctx);
|
vp8_arch_x86_common_init(ctx);
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
#define prototype_recon_macroblock(sym) \
|
#define prototype_recon_macroblock(sym) \
|
||||||
void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
|
void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
|
||||||
|
|
||||||
|
#define prototype_build_intra_predictors(sym) \
|
||||||
|
void sym(MACROBLOCKD *x)
|
||||||
|
|
||||||
struct vp8_recon_rtcd_vtable;
|
struct vp8_recon_rtcd_vtable;
|
||||||
|
|
||||||
#if ARCH_X86 || ARCH_X86_64
|
#if ARCH_X86 || ARCH_X86_64
|
||||||
@ -73,9 +76,23 @@ extern prototype_recon_macroblock(vp8_recon_recon_mb);
|
|||||||
#endif
|
#endif
|
||||||
extern prototype_recon_macroblock(vp8_recon_recon_mby);
|
extern prototype_recon_macroblock(vp8_recon_recon_mby);
|
||||||
|
|
||||||
|
#ifndef vp8_recon_build_intra_predictors_mby
|
||||||
|
#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby
|
||||||
|
#endif
|
||||||
|
extern prototype_build_intra_predictors\
|
||||||
|
(vp8_recon_build_intra_predictors_mby);
|
||||||
|
|
||||||
|
#ifndef vp8_recon_build_intra_predictors_mby_s
|
||||||
|
#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s
|
||||||
|
#endif
|
||||||
|
extern prototype_build_intra_predictors\
|
||||||
|
(vp8_recon_build_intra_predictors_mby_s);
|
||||||
|
|
||||||
|
|
||||||
typedef prototype_copy_block((*vp8_copy_block_fn_t));
|
typedef prototype_copy_block((*vp8_copy_block_fn_t));
|
||||||
typedef prototype_recon_block((*vp8_recon_fn_t));
|
typedef prototype_recon_block((*vp8_recon_fn_t));
|
||||||
typedef prototype_recon_macroblock((*vp8_recon_mb_fn_t));
|
typedef prototype_recon_macroblock((*vp8_recon_mb_fn_t));
|
||||||
|
typedef prototype_build_intra_predictors((*vp8_build_intra_pred_fn_t));
|
||||||
typedef struct vp8_recon_rtcd_vtable
|
typedef struct vp8_recon_rtcd_vtable
|
||||||
{
|
{
|
||||||
vp8_copy_block_fn_t copy16x16;
|
vp8_copy_block_fn_t copy16x16;
|
||||||
@ -86,6 +103,8 @@ typedef struct vp8_recon_rtcd_vtable
|
|||||||
vp8_recon_fn_t recon4;
|
vp8_recon_fn_t recon4;
|
||||||
vp8_recon_mb_fn_t recon_mb;
|
vp8_recon_mb_fn_t recon_mb;
|
||||||
vp8_recon_mb_fn_t recon_mby;
|
vp8_recon_mb_fn_t recon_mby;
|
||||||
|
vp8_build_intra_pred_fn_t build_intra_predictors_mby_s;
|
||||||
|
vp8_build_intra_pred_fn_t build_intra_predictors_mby;
|
||||||
} vp8_recon_rtcd_vtable_t;
|
} vp8_recon_rtcd_vtable_t;
|
||||||
|
|
||||||
#if CONFIG_RUNTIME_CPU_DETECT
|
#if CONFIG_RUNTIME_CPU_DETECT
|
||||||
|
@ -14,13 +14,6 @@
|
|||||||
|
|
||||||
extern void init_intra_left_above_pixels(MACROBLOCKD *x);
|
extern void init_intra_left_above_pixels(MACROBLOCKD *x);
|
||||||
|
|
||||||
extern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
|
|
||||||
extern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
|
|
||||||
extern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
|
|
||||||
|
|
||||||
extern void vp8_build_intra_predictors_mbuv(MACROBLOCKD *x);
|
extern void vp8_build_intra_predictors_mbuv(MACROBLOCKD *x);
|
||||||
extern void vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *x);
|
extern void vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *x);
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
|
|||||||
{
|
{
|
||||||
|
|
||||||
vp8_build_intra_predictors_mbuv_s(xd);
|
vp8_build_intra_predictors_mbuv_s(xd);
|
||||||
vp8_build_intra_predictors_mby_s_ptr(xd);
|
RECON_INVOKE(&pbi->common.rtcd.recon,
|
||||||
|
build_intra_predictors_mby_s)(xd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -214,7 +214,8 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
|
|||||||
|
|
||||||
if (xd->mode_info_context->mbmi.mode != B_PRED)
|
if (xd->mode_info_context->mbmi.mode != B_PRED)
|
||||||
{
|
{
|
||||||
vp8_build_intra_predictors_mby_ptr(xd);
|
RECON_INVOKE(&pbi->common.rtcd.recon,
|
||||||
|
build_intra_predictors_mby)(xd);
|
||||||
} else {
|
} else {
|
||||||
vp8_intra_prediction_down_copy(xd);
|
vp8_intra_prediction_down_copy(xd);
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1184,8 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
|
|||||||
int distortion2;
|
int distortion2;
|
||||||
|
|
||||||
x->e_mbd.mode_info_context->mbmi.mode = mode;
|
x->e_mbd.mode_info_context->mbmi.mode = mode;
|
||||||
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
|
RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
|
||||||
|
(&x->e_mbd);
|
||||||
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
|
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
|
||||||
rate2 = x->mbmode_cost[x->e_mbd.frame_type][mode];
|
rate2 = x->mbmode_cost[x->e_mbd.frame_type][mode];
|
||||||
this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
|
this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
|
||||||
|
@ -80,7 +80,7 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
|
|||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
|
RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mby)(&x->e_mbd);
|
||||||
|
|
||||||
ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_mbd.predictor, x->src.y_stride);
|
ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_mbd.predictor, x->src.y_stride);
|
||||||
|
|
||||||
|
@ -664,7 +664,8 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec
|
|||||||
case V_PRED:
|
case V_PRED:
|
||||||
case H_PRED:
|
case H_PRED:
|
||||||
case TM_PRED:
|
case TM_PRED:
|
||||||
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
|
RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
|
||||||
|
(&x->e_mbd);
|
||||||
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
|
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
|
||||||
rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
|
rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
|
||||||
this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
|
this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
|
||||||
|
@ -745,7 +745,8 @@ int vp8_rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
|
|||||||
{
|
{
|
||||||
x->e_mbd.mode_info_context->mbmi.mode = mode;
|
x->e_mbd.mode_info_context->mbmi.mode = mode;
|
||||||
|
|
||||||
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
|
RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
|
||||||
|
(&x->e_mbd);
|
||||||
|
|
||||||
macro_block_yrd(x, &ratey, &distortion, IF_RTCD(&cpi->rtcd.encodemb));
|
macro_block_yrd(x, &ratey, &distortion, IF_RTCD(&cpi->rtcd.encodemb));
|
||||||
rate = ratey + x->mbmode_cost[x->e_mbd.frame_type]
|
rate = ratey + x->mbmode_cost[x->e_mbd.frame_type]
|
||||||
@ -2038,7 +2039,8 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
|||||||
case H_PRED:
|
case H_PRED:
|
||||||
case TM_PRED:
|
case TM_PRED:
|
||||||
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
||||||
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
|
RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
|
||||||
|
(&x->e_mbd);
|
||||||
macro_block_yrd(x, &rate_y, &distortion, IF_RTCD(&cpi->rtcd.encodemb)) ;
|
macro_block_yrd(x, &rate_y, &distortion, IF_RTCD(&cpi->rtcd.encodemb)) ;
|
||||||
rate2 += rate_y;
|
rate2 += rate_y;
|
||||||
distortion2 += distortion;
|
distortion2 += distortion;
|
||||||
|
Loading…
Reference in New Issue
Block a user