summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-06-08 15:07:59 +0300
committerMarco Nelissen <marcone@google.com>2015-06-25 08:25:57 -0700
commit4adb9f492336cd3f6204201eac52b29166179cb4 (patch)
tree796e93751c623f31f9fd5dedce535dfe9c85f5e3 /encoder
parent5ae9fc7e9dbabb80274df8928dd98060c2400066 (diff)
downloadandroid_external_libavc-4adb9f492336cd3f6204201eac52b29166179cb4.tar.gz
android_external_libavc-4adb9f492336cd3f6204201eac52b29166179cb4.tar.bz2
android_external_libavc-4adb9f492336cd3f6204201eac52b29166179cb4.zip
Reorder code to avoid reading uninitialized data
If the current slice isn't BSLICE, u1_weighted_bipred_idc is uninitialized, which valgrind can complain about (mostly in uninitialized builds). By reordering the conditions, we avoid doing conditional jumps based on uninitialized data. Change-Id: I4d601fd1a4e34d85fe5992ecb934ac3747953960
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_encode_header.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/encoder/ih264e_encode_header.c b/encoder/ih264e_encode_header.c
index 6c96e63..cc81e1b 100644
--- a/encoder/ih264e_encode_header.c
+++ b/encoder/ih264e_encode_header.c
@@ -560,7 +560,7 @@ WORD32 ih264e_generate_slice_header(bitstrm_t *ps_bitstrm,
if ((ps_pps->i1_weighted_pred_flag &&
(ps_slice_hdr->u1_slice_type == PSLICE || ps_slice_hdr->u1_slice_type == SPSLICE)) ||
- (ps_pps->i1_weighted_bipred_idc == 1 && ps_slice_hdr->u1_slice_type == BSLICE))
+ (ps_slice_hdr->u1_slice_type == BSLICE && ps_pps->i1_weighted_bipred_idc == 1))
{
/* TODO_LATER: Currently there is no support for weighted prediction.
This needs to be updated when the support is added */
@@ -1065,7 +1065,7 @@ WORD32 ih264e_populate_slice_header(process_ctxt_t *ps_proc,
if ((ps_pps->i1_weighted_pred_flag &&
(ps_proc->i4_slice_type == PSLICE || ps_proc->i4_slice_type == SPSLICE)) ||
- (ps_pps->i1_weighted_bipred_idc == 1 && ps_proc->i4_slice_type == BSLICE))
+ (ps_proc->i4_slice_type == BSLICE && ps_pps->i1_weighted_bipred_idc == 1))
{
/* TODO_LATER: Currently there is no support for weighted prediction.
This needs to be updated when the support is added */