shithub: libvpx

Download patch

ref: 55639c383bdbdf8ce270ea6783f3a360b8efbfd3
parent: 1790d45252efb29903baae3d1776bb24cee76558
author: Yunqing Wang <yunqingwang@google.com>
date: Mon Mar 2 11:19:23 EST 2015

fix a race condition caused by intra function pointer initialization

This patch fixed webm issue 962.
(https://code.google.com/p/webm/issues/detail?id=962)
The data races occurred when an encoder and a decoder were created
at the same time, and the function pointers were initialized twice.

Change-Id: I8851b753c4b4ad4767d6eea781b61f0ac9abb44b

--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -12,6 +12,7 @@
 #include "./vp9_rtcd.h"
 
 #include "vpx_mem/vpx_mem.h"
+#include "vpx_ports/vpx_once.h"
 
 #include "vp9/common/vp9_reconintra.h"
 #include "vp9/common/vp9_onyxc_int.h"
@@ -579,7 +580,7 @@
 static intra_high_pred_fn dc_pred_high[2][2][4];
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 
-void vp9_init_intra_predictors() {
+static void vp9_init_intra_predictors_internal() {
 #define INIT_ALL_SIZES(p, type) \
   p[TX_4X4] = vp9_##type##_predictor_4x4; \
   p[TX_8X8] = vp9_##type##_predictor_8x8; \
@@ -893,4 +894,8 @@
 #endif
   build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size,
                          have_top, have_left, have_right, x, y, plane);
+}
+
+void vp9_init_intra_predictors() {
+  once(vp9_init_intra_predictors_internal);
 }