diff options
author | Hamsalekha S <hamsalekha.s@ittiam.com> | 2017-09-08 13:52:05 +0530 |
---|---|---|
committer | Nikoli Cartagena <dargeren@google.com> | 2017-09-19 15:42:13 -0700 |
commit | 693c9a773a66bafd4a82a2d18f9c0eb1b773faf4 (patch) | |
tree | deeb86a5e4afbaf27bc96bd9feba12421edf936f | |
parent | 1dbb6dd25a3dae17706bd242b6be64604a06b3f2 (diff) | |
download | libavc-693c9a773a66bafd4a82a2d18f9c0eb1b773faf4.tar.gz |
Decoder: Corrected variable datatypes in ih264d_get_implicit_weights.
The difference between two 32 signed numbers was getting assigned
to 16 bits, leading to a divide by zero arithmetic execption.
Modified variable names to match their datatypes.
Bug: 65122447
Change-Id: I45ade1945f10b4d7660bd09fb564e60fd29d40dc
(cherry picked from commit 3eb692de916c3576a18990e3e4193fce93c016dc)
-rw-r--r-- | decoder/ih264d_parse_bslice.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/decoder/ih264d_parse_bslice.c b/decoder/ih264d_parse_bslice.c index db64ce9..4418429 100644 --- a/decoder/ih264d_parse_bslice.c +++ b/decoder/ih264d_parse_bslice.c @@ -1197,7 +1197,8 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) struct pic_buffer_t *ps_pic_buff0, *ps_pic_buff1; WORD16 i2_dist_scale_factor; WORD16 i16_tb, i16_td, i16_tx; - UWORD32 u4_poc0, u4_poc1; + WORD32 i4_tb, i4_td; + WORD32 i4_poc0, i4_poc1; UWORD32 ui_temp0, ui_temp1; UWORD8 uc_num_ref_idx_l0_active, uc_num_ref_idx_l1_active; @@ -1210,18 +1211,18 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) for(i = 0; i < uc_num_ref_idx_l0_active; i++) { ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][i]; - u4_poc0 = ps_pic_buff0->i4_avg_poc; + i4_poc0 = ps_pic_buff0->i4_avg_poc; for(j = 0; j < uc_num_ref_idx_l1_active; j++) { ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][j]; - u4_poc1 = ps_pic_buff1->i4_avg_poc; + i4_poc1 = ps_pic_buff1->i4_avg_poc; - if(u4_poc1 != u4_poc0) + if(i4_poc1 != i4_poc0) { - i16_tb = ps_dec->ps_cur_pic->i4_poc - u4_poc0; - i16_tb = CLIP3(-128, 127, i16_tb); - i16_td = u4_poc1 - u4_poc0; - i16_td = CLIP3(-128, 127, i16_td); + i4_tb = ps_dec->ps_cur_pic->i4_poc - i4_poc0; + i16_tb = CLIP3(-128, 127, i4_tb); + i4_td = i4_poc1 - i4_poc0; + i16_td = CLIP3(-128, 127, i4_td); i16_tx = (16384 + ABS(SIGN_POW2_DIV(i16_td, 1))) / i16_td; i2_dist_scale_factor = CLIP3(-1024, 1023, (((i16_tb * i16_tx) + 32) >> 6)); @@ -1272,7 +1273,7 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) u2_l0_idx += MAX_REF_BUFS; } ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u2_l0_idx]; - u4_poc0 = ps_pic_buff0->i4_poc; + i4_poc0 = ps_pic_buff0->i4_poc; for(j = 0; j < (uc_num_ref_idx_l1_active << 1); j++) { UWORD16 u2_l1_idx; @@ -1285,13 +1286,13 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) u2_l1_idx += MAX_REF_BUFS; } ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][u2_l1_idx]; - u4_poc1 = ps_pic_buff1->i4_poc; - if(u4_poc1 != u4_poc0) + i4_poc1 = ps_pic_buff1->i4_poc; + if(i4_poc1 != i4_poc0) { - i16_tb = i4_cur_poc - u4_poc0; - i16_tb = CLIP3(-128, 127, i16_tb); - i16_td = u4_poc1 - u4_poc0; - i16_td = CLIP3(-128, 127, i16_td); + i4_tb = i4_cur_poc - i4_poc0; + i16_tb = CLIP3(-128, 127, i4_tb); + i4_td = i4_poc1 - i4_poc0; + i16_td = CLIP3(-128, 127, i4_td); i16_tx = (16384 + ABS(SIGN_POW2_DIV(i16_td, 1))) / i16_td; i2_dist_scale_factor = CLIP3( |