h264encode: fix build warning on Android
authorAustin Yuan <shengquan.yuan@gmail.com>
Thu, 7 Mar 2013 02:57:32 +0000 (10:57 +0800)
committerAustin Yuan <shengquan.yuan@gmail.com>
Thu, 7 Mar 2013 03:00:39 +0000 (11:00 +0800)
Change-Id: Iee2886bde2362e75d7e1837211553d9672bba650
Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>
test/encode/h264encode.c
test/loadsurface.h

index c5f3a6f..5a707e8 100644 (file)
@@ -93,7 +93,7 @@ static  int h264_maxref = 3;
 static  char *coded_fn = NULL, *srcyuv_fn = NULL, *recyuv_fn = NULL;
 static  FILE *coded_fp = NULL, *srcyuv_fp = NULL, *recyuv_fp = NULL;
 static  unsigned long long srcyuv_frames = 0;
-static  unsigned int srcyuv_fourcc = VA_FOURCC_NV12;
+static  int srcyuv_fourcc = VA_FOURCC_NV12;
 
 static  int frame_width = 176;
 static  int frame_height = 144;
@@ -767,7 +767,7 @@ static int process_cmdline(int argc, char *argv[])
             break;
         case 10:
             srcyuv_fourcc = string_to_fourcc(optarg);
-            if (srcyuv_fourcc < 0) {
+            if (srcyuv_fourcc <= 0) {
                 print_help();
                 exit(1);
             }
@@ -841,7 +841,7 @@ static int init_va(void)
     int support_encode = 0;    
     int major_ver, minor_ver;
     VAStatus va_status;
-    int i;
+    unsigned int i;
 
     va_dpy = va_open_display();
     va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
@@ -1463,8 +1463,8 @@ static int upload_source_YUV_once_for_all()
 static int load_surface(VASurfaceID surface_id, unsigned long long display_order)
 {
     VAImage surface_image;
-    unsigned char *surface_p, *Y_start, *U_start,*V_start;
-    int Y_pitch, U_pitch, row, V_pitch;
+    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL,*V_start=NULL;
+    int Y_pitch=0, U_pitch=0, row, V_pitch;
     VAStatus va_status;
 
     if (srcyuv_fp == NULL)
index de421e1..6f7bce2 100755 (executable)
@@ -102,7 +102,7 @@ static int YUV_blend_with_pic(int width, int height,
     }
 
     /* U/V plane */
-    int U_pixel_stride, V_pixel_stride;
+    int U_pixel_stride = 0, V_pixel_stride = 0;
     int v_factor_to_nv12 = 1;
     switch (fourcc) {
     case VA_FOURCC_YV12:
@@ -232,9 +232,9 @@ static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
                           int field)
 {
     VAImage surface_image;
-    void *surface_p=NULL, *U_start,*V_start;
+    void *surface_p=NULL, *U_start = NULL,*V_start = NULL;
     VAStatus va_status;
-    unsigned int pitches[3];
+    unsigned int pitches[3]={0,0,0};
     
     va_status = vaDeriveImage(va_dpy,surface_id,&surface_image);
     CHECK_VASTATUS(va_status,"vaDeriveImage");
@@ -246,7 +246,7 @@ static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
     switch (surface_image.format.fourcc) {
     case VA_FOURCC_NV12:
         U_start = (char *)surface_p + surface_image.offsets[1];
-        V_start = U_start + 1;
+        V_start = (char *)U_start + 1;
         pitches[1] = surface_image.pitches[1];
         pitches[2] = surface_image.pitches[1];
         break;
@@ -263,8 +263,8 @@ static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
         pitches[2] = surface_image.pitches[1];
         break;
     case VA_FOURCC_YUY2:
-        U_start = surface_p + 1;
-        V_start = surface_p + 3;
+        U_start = (char *)surface_p + 1;
+        V_start = (char *)surface_p + 3;
         pitches[1] = surface_image.pitches[0];
         pitches[2] = surface_image.pitches[0];
         break;