summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-05-25 15:31:26 +0300
committerLajos Molnar <lajos@google.com>2015-06-03 08:39:31 -0700
commit1ff75b8cc0e9c5bc56917c050c6d472fc67bc6f9 (patch)
treee0e2e7e4c548ba813a0d2246a867b453f34e0988 /encoder
parentac97f28bb6a23199fb524825976b9b0d06b7e2c7 (diff)
downloadandroid_external_libavc-1ff75b8cc0e9c5bc56917c050c6d472fc67bc6f9.tar.gz
android_external_libavc-1ff75b8cc0e9c5bc56917c050c6d472fc67bc6f9.tar.bz2
android_external_libavc-1ff75b8cc0e9c5bc56917c050c6d472fc67bc6f9.zip
Only initialize u4_deblk_prev_row if it will be used
This avoids reads out of bounds when encoding videos with a height of one single macroblock. Change-Id: Iec982cebb0995c8ecf160751eaa72df38604e8b0
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_process.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/encoder/ih264e_process.c b/encoder/ih264e_process.c
index fa67d84..7b39fe5 100644
--- a/encoder/ih264e_process.c
+++ b/encoder/ih264e_process.c
@@ -1435,23 +1435,23 @@ IH264E_ERROR_T ih264e_dblk_pad_hpel_processing_n_mbs(process_ctxt_t *ps_proc,
{
i4_n_mb_process_count = MIN(i4_mb_x - (ps_n_mb_ctxt->i4_mb_x - 1), i4_n_mbs);
- u4_deblk_prev_row = 1;
-
- /* checking whether the top rows are deblocked */
- for (col = 0; col < i4_n_mb_process_count; col++)
- {
- u4_deblk_prev_row &= pu1_deblk_map_prev_row[ps_deblk->i4_mb_x + col];
- }
-
- /* checking whether the top right MB is deblocked */
- if ((ps_deblk->i4_mb_x + i4_n_mb_process_count) != ps_proc->i4_wd_mbs)
- {
- u4_deblk_prev_row &= pu1_deblk_map_prev_row[ps_deblk->i4_mb_x + i4_n_mb_process_count];
- }
-
/* performing deblocking for required number of MBs */
if ((i4_mb_y > 0) && (ps_proc->u4_disable_deblock_level != 1))
{
+ u4_deblk_prev_row = 1;
+
+ /* checking whether the top rows are deblocked */
+ for (col = 0; col < i4_n_mb_process_count; col++)
+ {
+ u4_deblk_prev_row &= pu1_deblk_map_prev_row[ps_deblk->i4_mb_x + col];
+ }
+
+ /* checking whether the top right MB is deblocked */
+ if ((ps_deblk->i4_mb_x + i4_n_mb_process_count) != ps_proc->i4_wd_mbs)
+ {
+ u4_deblk_prev_row &= pu1_deblk_map_prev_row[ps_deblk->i4_mb_x + i4_n_mb_process_count];
+ }
+
/* Top or Top right MBs not deblocked */
if ((u4_deblk_prev_row != 1) && (i4_mb_y > 0))
{