Set the luma/chroma strides depending on source buffer

If the data is read directly from the input buffer, set the stride
values to those of the input buffer. If the data is copied, set the
stride to the value of the local buffer instead.

This fixes handling of cases where the input buffer stride is
(significantly) larger than the maxwidth of the video.

This also effectively makes the parameter
ive_ctl_set_dimensions_ip_t.u4_strd useless - nothing needs to
know the stride until you actually encode a frame, and at that point,
we can either use the stride of the input buffer, or of the local
pu1_y_csc_buf_base where the copied content is stored.

Change-Id: Icde400b4a0867d25855e621e143454e608748aa3
diff --git a/encoder/ih264e_me.c b/encoder/ih264e_me.c
index 6fef9d9..68bdea6 100644
--- a/encoder/ih264e_me.c
+++ b/encoder/ih264e_me.c
@@ -841,6 +841,8 @@
 
     /* src ptr */
     ps_me_ctxt->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma;
+    /* src stride */
+    ps_me_ctxt->i4_src_strd = ps_proc->i4_src_strd;
 
     /* ref ptrs and corresponding lagrange params */
     ps_me_ctxt->apu1_ref_buf_luma[0] = ps_proc->apu1_ref_buf_luma[0];
diff --git a/encoder/ih264e_process.c b/encoder/ih264e_process.c
index ff48f7e..2c3a18e 100644
--- a/encoder/ih264e_process.c
+++ b/encoder/ih264e_process.c
@@ -1187,15 +1187,21 @@
 
     /* init buffer pointers */
     convert_uv_only = 1;
-    if (u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1))
+    if ((u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)) ||
+        ps_codec->s_cfg.e_inp_color_fmt == IV_YUV_422ILE)
     {
-        u2_num_rows = (UWORD16) MB_SIZE - u4_pad_bottom_sz;
+        if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
+            u2_num_rows = (UWORD16) MB_SIZE - u4_pad_bottom_sz;
         ps_proc->pu1_src_buf_luma_base = ps_codec->pu1_y_csc_buf_base;
+        i4_src_strd = ps_proc->i4_src_strd = ps_codec->s_cfg.u4_max_wd;
         ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * MB_SIZE);
         convert_uv_only = 0;
     }
     else
+    {
+        i4_src_strd = ps_proc->i4_src_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
         ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + i4_src_strd * (i4_mb_y * MB_SIZE);
+    }
 
 
     if (ps_codec->s_cfg.e_inp_color_fmt == IV_YUV_422ILE ||
@@ -1207,9 +1213,11 @@
             ps_proc->pu1_src_buf_chroma_base = ps_codec->pu1_uv_csc_buf_base;
 
         ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * BLK8x8SIZE);
+        i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_codec->s_cfg.u4_max_wd;
     }
     else
     {
+        i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
         ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + i4_src_chroma_strd * (i4_mb_y * BLK8x8SIZE);
     }