MMFMWK-8154 Fix Hantro encoder align issue.

Set Hantro encoder default alignment H and V to 8.

Signed-off-by: xiahong.bao <xiahong.bao@nxp.com>
diff --git a/plugins/vpu/gstvpu.h b/plugins/vpu/gstvpu.h
index 4bf6809..f674e3a 100755
--- a/plugins/vpu/gstvpu.h
+++ b/plugins/vpu/gstvpu.h
@@ -29,6 +29,7 @@
 #define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO_TILE 8
 #define DEFAULT_FRAME_BUFFER_ALIGNMENT_V 16
 #define DEFAULT_FRAME_BUFFER_ALIGNMENT_V_HANTRO 8
+#define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO 8
 #define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_AMPHION 256
 #define DEFAULT_FRAME_BUFFER_ALIGNMENT_V_AMPHION 256
 #define ALIGN(ptr,align)	((align) ? ((((unsigned long)(ptr))+(align)-1)/(align)*(align)) : ((unsigned long)(ptr)))
diff --git a/plugins/vpu/gstvpuenc.c b/plugins/vpu/gstvpuenc.c
index 8f76df6..f2fc4ec 100755
--- a/plugins/vpu/gstvpuenc.c
+++ b/plugins/vpu/gstvpuenc.c
@@ -788,6 +788,7 @@
   GstCaps *caps;
   GstStructure *config;
   guint i;
+  guint alignH, alignV;
 
   enc->pool = gst_video_buffer_pool_new ();
   if (!enc->pool) {
@@ -803,15 +804,21 @@
 
   params.align = enc->init_info.nAddressAlignment;
   memset(&(enc->video_align), 0, sizeof(GstVideoAlignment));
-  if (enc->open_param.nPicWidth % DEFAULT_FRAME_BUFFER_ALIGNMENT_H)
-    enc->video_align.padding_right = DEFAULT_FRAME_BUFFER_ALIGNMENT_H \
-      - enc->open_param.nPicWidth % DEFAULT_FRAME_BUFFER_ALIGNMENT_H;
-  if (enc->open_param.nPicHeight % DEFAULT_FRAME_BUFFER_ALIGNMENT_V)
-    enc->video_align.padding_bottom = DEFAULT_FRAME_BUFFER_ALIGNMENT_V\
-      - enc->open_param.nPicHeight % DEFAULT_FRAME_BUFFER_ALIGNMENT_V;
+
+  if (IS_HANTRO()) {
+    alignH = DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO;
+    alignV = DEFAULT_FRAME_BUFFER_ALIGNMENT_V_HANTRO;
+  } else {
+    alignH = DEFAULT_FRAME_BUFFER_ALIGNMENT_H;
+    alignV = DEFAULT_FRAME_BUFFER_ALIGNMENT_V;
+  }
+  if (enc->open_param.nPicWidth % alignH)
+    enc->video_align.padding_right = alignH - enc->open_param.nPicWidth % alignH;
+  if (enc->open_param.nPicHeight % alignV)
+    enc->video_align.padding_bottom = alignV - enc->open_param.nPicHeight % alignV;
 
   for (i = 0; i < GST_VIDEO_MAX_PLANES; i++)
-    enc->video_align.stride_align[i] = DEFAULT_FRAME_BUFFER_ALIGNMENT_H - 1;
+    enc->video_align.stride_align[i] = alignH - 1;
 
   config = gst_buffer_pool_get_config(enc->pool);
   gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);