summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-06-23 14:51:06 +0300
committerMarco Nelissen <marcone@google.com>2015-06-25 08:25:57 -0700
commitc22addc6ee9c96f2996001362dbe39dd5e14038d (patch)
treebf7a85e2985bb0c514e733538e96ffdc67f50437 /encoder
parent88966cf07d2095aec959c5ac14b30237eeaa5727 (diff)
downloadandroid_external_libavc-c22addc6ee9c96f2996001362dbe39dd5e14038d.tar.gz
android_external_libavc-c22addc6ee9c96f2996001362dbe39dd5e14038d.tar.bz2
android_external_libavc-c22addc6ee9c96f2996001362dbe39dd5e14038d.zip
Don't use static structs for rc init
Most of them was benign and didn't risk any data race; they were used for write-only memory during init. The array as_itt_memtab in ih264e_get_rate_control_mem_tab could however cause a real data race, if multiple threads try to initialize an encoder at the same time, since it used as temporary storage when mapping between different structs. Change-Id: I3ca29f0e3be2fad154becc3ee29867e591975a74
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_modify_frm_rate.c2
-rw-r--r--encoder/ih264e_rc_mem_interface.c2
-rw-r--r--encoder/ih264e_time_stamp.c4
-rw-r--r--encoder/irc_bit_allocation.c2
-rw-r--r--encoder/irc_cbr_buffer_control.c2
-rw-r--r--encoder/irc_est_sad.c2
-rw-r--r--encoder/irc_fixed_point_error_bits.c2
-rw-r--r--encoder/irc_mb_model_based.c2
-rw-r--r--encoder/irc_picture_type.c2
-rw-r--r--encoder/irc_rate_control_api.c2
-rw-r--r--encoder/irc_rd_model.c2
-rw-r--r--encoder/irc_vbr_storage_vbv.c2
12 files changed, 13 insertions, 13 deletions
diff --git a/encoder/ih264e_modify_frm_rate.c b/encoder/ih264e_modify_frm_rate.c
index 6afb727..f1e6e61 100644
--- a/encoder/ih264e_modify_frm_rate.c
+++ b/encoder/ih264e_modify_frm_rate.c
@@ -106,7 +106,7 @@ WORD32 ih264e_pd_frm_rate_get_init_free_memtab(pd_frm_rate_handle *pps_pd_frm_ra
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static pd_frm_rate_t s_temp_pd_frm_rate_t;
+ pd_frm_rate_t s_temp_pd_frm_rate_t;
/* Hack for al alloc, during which we dont have any state memory.
Dereferencing can cause issues */
diff --git a/encoder/ih264e_rc_mem_interface.c b/encoder/ih264e_rc_mem_interface.c
index 39a5311..a74513a 100644
--- a/encoder/ih264e_rc_mem_interface.c
+++ b/encoder/ih264e_rc_mem_interface.c
@@ -330,7 +330,7 @@ WORD32 ih264e_get_rate_control_mem_tab(void *pv_rate_control,
iv_mem_rec_t *ps_mem,
ITT_FUNC_TYPE_E e_func_type)
{
- static itt_memtab_t as_itt_memtab[NUM_RC_MEMTABS];
+ itt_memtab_t as_itt_memtab[NUM_RC_MEMTABS];
WORD32 i4_num_memtab = 0, j = 0;
void *refptr2[4];
void **refptr1[4];
diff --git a/encoder/ih264e_time_stamp.c b/encoder/ih264e_time_stamp.c
index 8afa24d..cd829b5 100644
--- a/encoder/ih264e_time_stamp.c
+++ b/encoder/ih264e_time_stamp.c
@@ -224,7 +224,7 @@ WORD32 ih264e_frame_time_get_init_free_memtab(frame_time_handle *pps_frame_time,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static frame_time_t s_temp_frame_time_t;
+ frame_time_t s_temp_frame_time_t;
/* Hack for al alloc, during which we dont have any state memory.
Dereferencing can cause issues */
@@ -407,7 +407,7 @@ WORD32 ih264e_time_stamp_get_init_free_memtab(time_stamp_handle *pps_time_stamp,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static time_stamp_t s_temp_time_stamp_t;
+ time_stamp_t s_temp_time_stamp_t;
/* Hack for al alloc, during which we dont have any state memory.
Dereferencing can cause issues */
diff --git a/encoder/irc_bit_allocation.c b/encoder/irc_bit_allocation.c
index 1dfd9de..6f52970 100644
--- a/encoder/irc_bit_allocation.c
+++ b/encoder/irc_bit_allocation.c
@@ -251,7 +251,7 @@ WORD32 irc_ba_num_fill_use_free_memtab(bit_allocation_t **pps_bit_allocation,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static bit_allocation_t s_bit_allocation_temp;
+ bit_allocation_t s_bit_allocation_temp;
/*
* Hack for all alloc, during which we don't have any state memory.
diff --git a/encoder/irc_cbr_buffer_control.c b/encoder/irc_cbr_buffer_control.c
index c179a28..9febbc8 100644
--- a/encoder/irc_cbr_buffer_control.c
+++ b/encoder/irc_cbr_buffer_control.c
@@ -79,7 +79,7 @@ WORD32 irc_cbr_buffer_num_fill_use_free_memtab(cbr_buffer_t **pps_cbr_buffer,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0, i;
- static cbr_buffer_t s_cbr_buffer_temp;
+ cbr_buffer_t s_cbr_buffer_temp;
/*
* Hack for all alloc, during which we don't have any state memory.
diff --git a/encoder/irc_est_sad.c b/encoder/irc_est_sad.c
index 0d8abc2..97a0b68 100644
--- a/encoder/irc_est_sad.c
+++ b/encoder/irc_est_sad.c
@@ -58,7 +58,7 @@ WORD32 irc_est_sad_num_fill_use_free_memtab(est_sad_t **pps_est_sad,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static est_sad_t s_est_sad;
+ est_sad_t s_est_sad;
/* Hack for al alloc, during which we don't have any state memory.
* Dereferencing can cause issues
diff --git a/encoder/irc_fixed_point_error_bits.c b/encoder/irc_fixed_point_error_bits.c
index 42dcfc5..1c35685 100644
--- a/encoder/irc_fixed_point_error_bits.c
+++ b/encoder/irc_fixed_point_error_bits.c
@@ -62,7 +62,7 @@ WORD32 irc_error_bits_num_fill_use_free_memtab(error_bits_t **pps_error_bits,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static error_bits_t s_error_bits_temp;
+ error_bits_t s_error_bits_temp;
/*
* Hack for all alloc, during which we don't have any state memory.
diff --git a/encoder/irc_mb_model_based.c b/encoder/irc_mb_model_based.c
index 880ee19..b8e3d1b 100644
--- a/encoder/irc_mb_model_based.c
+++ b/encoder/irc_mb_model_based.c
@@ -47,7 +47,7 @@ WORD32 irc_mbrc_num_fill_use_free_memtab(mb_rate_control_t **pps_mb_rate_control
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static mb_rate_control_t s_mb_rate_control_temp;
+ mb_rate_control_t s_mb_rate_control_temp;
/*
* Hack for al alloc, during which we don't have any state memory.
diff --git a/encoder/irc_picture_type.c b/encoder/irc_picture_type.c
index e9bf43e..2a91572 100644
--- a/encoder/irc_picture_type.c
+++ b/encoder/irc_picture_type.c
@@ -225,7 +225,7 @@ WORD32 irc_pic_handling_num_fill_use_free_memtab(pic_handling_t **pps_pic_handli
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static pic_handling_t s_pic_handling_temp;
+ pic_handling_t s_pic_handling_temp;
/*
* Hack for al alloc, during which we dont have any state memory.
diff --git a/encoder/irc_rate_control_api.c b/encoder/irc_rate_control_api.c
index 9693a7c..95befce 100644
--- a/encoder/irc_rate_control_api.c
+++ b/encoder/irc_rate_control_api.c
@@ -77,7 +77,7 @@ WORD32 irc_rate_control_num_fill_use_free_memtab(rate_control_handle *pps_rate_c
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0, i;
- static rate_control_api_t s_temp_rc_api;
+ rate_control_api_t s_temp_rc_api;
/*
* Hack for al alloc, during which we dont have any state memory.
diff --git a/encoder/irc_rd_model.c b/encoder/irc_rd_model.c
index f5c0737..a04412c 100644
--- a/encoder/irc_rd_model.c
+++ b/encoder/irc_rd_model.c
@@ -55,7 +55,7 @@ WORD32 irc_rd_model_num_fill_use_free_memtab(rc_rd_model_t **pps_rc_rd_model,
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static rc_rd_model_t s_rc_rd_model_temp;
+ rc_rd_model_t s_rc_rd_model_temp;
/*
* Hack for al alloc, during which we don't have any state memory.
diff --git a/encoder/irc_vbr_storage_vbv.c b/encoder/irc_vbr_storage_vbv.c
index 23e9959..aaf0d6e 100644
--- a/encoder/irc_vbr_storage_vbv.c
+++ b/encoder/irc_vbr_storage_vbv.c
@@ -73,7 +73,7 @@ WORD32 irc_vbr_vbv_num_fill_use_free_memtab(vbr_storage_vbv_t **pps_vbr_storage_
ITT_FUNC_TYPE_E e_func_type)
{
WORD32 i4_mem_tab_idx = 0;
- static vbr_storage_vbv_t s_vbr_storage_vbv_temp;
+ vbr_storage_vbv_t s_vbr_storage_vbv_temp;
/*
* Hack for al alloc, during which we don't have any state memory.