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;
break;
case 10:
srcyuv_fourcc = string_to_fourcc(optarg);
- if (srcyuv_fourcc < 0) {
+ if (srcyuv_fourcc <= 0) {
print_help();
exit(1);
}
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);
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)
}
/* 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:
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");
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;
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;