Fixed few issues seen in CTS tests

Added support for encoding non-multiple of 16 dimensions
Added support for encoding dimensions smaller than 64x64
Aligned coeff data to 4 byte boundary

Change-Id: I111093950f94698296d8499a2845cfe2db6c557b
diff --git a/encoder/ih264e_core_coding.c b/encoder/ih264e_core_coding.c
index 5ba18de..89243a5 100755
--- a/encoder/ih264e_core_coding.c
+++ b/encoder/ih264e_core_coding.c
@@ -58,6 +58,7 @@
 #include "ih264_platform_macros.h"
 #include "iv2.h"
 #include "ive2.h"
+#include "ih264_macros.h"
 #include "ih264_defs.h"
 #include "ih264e_defs.h"
 #include "ih264_trans_data.h"
@@ -843,7 +844,7 @@
         }
         /* write significant coeff map */
         ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
-        (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+        (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
 
         u4_cntrl = 0x00008000;// Set DC bit in ctrl code
     }
@@ -896,7 +897,7 @@
             }
             /* write significant coeff map */
             ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
-            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
             *u1_cbp_l = 15;
 
             u4_cntrl |= (1 << (31 - u1_scan_order[b4]));
@@ -1059,7 +1060,7 @@
 
             /* write significant coeff map */
             ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
-            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
 
             /* cbp */
             *u1_cbp_l |= (1 << b8);
@@ -1283,7 +1284,7 @@
             }
             /* write significant coeff map U/V */
             ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
-            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+            (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
             *u1_cbp_c = 1;
 
             (*pu4_cntrl) |= (1 << cntrl_pos);
@@ -1388,7 +1389,7 @@
 
                 /* write significant coeff map U/V */
                 ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
-                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
                 u1_cbp_ac = 2;
 
                 (*pu4_cntrl) |= 1 << cntrl_pos;
@@ -1804,7 +1805,7 @@
                 ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
 
                 /* update ptr to coeff data */
-                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
 
                 /* cbp */
                 u1_cbp_l |= (1 << b8);
@@ -1950,7 +1951,7 @@
                 ps_mb_coeff_data->i4_sig_map_nnz |= (u4_s_map << 16);
 
                 /* update ptr to coeff data */
-                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + u4_nnz_cnt;
+                (*pv_mb_coeff_data) = ps_mb_coeff_data->ai2_residue + ALIGN2(u4_nnz_cnt);
 
                 /* cbp */
                 u1_cbp_l |= (1 << b8);