unify the code styles using the style_unify script

use astyle to unify the code style
refer https://github.com/intel/libva/blob/master/style_unify

Signed-off-by: Carl Zhang <carl.zhang@intel.com>
diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp
index 370adb9..8b4ef78 100644
--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -44,45 +44,42 @@
 #define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); return VA_STATUS_ERROR_UNKNOWN; }
 #define DEVICE_NAME "/dev/dri/renderD128"
 
-static int open_device (char *dev_name)
+static int open_device(char *dev_name)
 {
     struct stat st;
     int fd;
 
-    if (-1 == stat (dev_name, &st))
-    {
-        printf ("Cannot identify '%s': %d, %s\n",
-                dev_name, errno, strerror (errno));
+    if (-1 == stat(dev_name, &st)) {
+        printf("Cannot identify '%s': %d, %s\n",
+               dev_name, errno, strerror(errno));
         return -1;
     }
 
-    if (!S_ISCHR (st.st_mode))
-    {
-        printf ("%s is no device\n", dev_name);
+    if (!S_ISCHR(st.st_mode)) {
+        printf("%s is no device\n", dev_name);
         return -1;
     }
 
-    fd = open (dev_name, O_RDWR);
+    fd = open(dev_name, O_RDWR);
 
-    if (-1 == fd)
-    {
-        fprintf (stderr, "Cannot open '%s': %d, %s\n",
-                 dev_name, errno, strerror (errno));
+    if (-1 == fd) {
+        fprintf(stderr, "Cannot open '%s': %d, %s\n",
+                dev_name, errno, strerror(errno));
         return -1;
     }
 
     return fd;
 }
 
-static int va_DisplayContextIsValid (
+static int va_DisplayContextIsValid(
     VADisplayContextP pDisplayContext
-                                  )
+)
 {
     return (pDisplayContext != NULL &&
             pDisplayContext->pDriverContext != NULL);
 }
 
-static void va_DisplayContextDestroy (
+static void va_DisplayContextDestroy(
     VADisplayContextP pDisplayContext
 )
 {
@@ -112,14 +109,14 @@
     drm_state->fd = open_device((char *)DEVICE_NAME);
 
     if (drm_state->fd < 0) {
-        fprintf(stderr,"can't open DRM devices\n");
+        fprintf(stderr, "can't open DRM devices\n");
         return VA_STATUS_ERROR_UNKNOWN;
     }
     drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
     return VA_DRM_GetNumCandidates(ctx, num_candidates);
 }
 
-static VAStatus va_DisplayContextGetDriverNameByIndex (
+static VAStatus va_DisplayContextGetDriverNameByIndex(
     VADisplayContextP pDisplayContext,
     char **driver_name,
     int candidate_index
@@ -131,7 +128,7 @@
 }
 
 
-VADisplay vaGetDisplay (
+VADisplay vaGetDisplay(
     void *native_dpy /* implementation specific */
 )
 {
diff --git a/va/drm/va_drm.c b/va/drm/va_drm.c
index c135a0f..2e9a2b9 100644
--- a/va/drm/va_drm.c
+++ b/va/drm/va_drm.c
@@ -124,7 +124,7 @@
 
     pDriverContext->native_dpy   = NULL;
     pDriverContext->display_type = is_render_nodes ?
-        VA_DISPLAY_DRM_RENDERNODES : VA_DISPLAY_DRM;
+                                   VA_DISPLAY_DRM_RENDERNODES : VA_DISPLAY_DRM;
     pDriverContext->drm_state    = drm_state;
 
     return pDisplayContext;
diff --git a/va/drm/va_drm.h b/va/drm/va_drm.h
index 9af3cc8..a39c5a2 100644
--- a/va/drm/va_drm.h
+++ b/va/drm/va_drm.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/drm/va_drm_auth_x11.c b/va/drm/va_drm_auth_x11.c
index bbb40e0..344dc4d 100644
--- a/va/drm/va_drm_auth_x11.c
+++ b/va/drm/va_drm_auth_x11.c
@@ -34,11 +34,11 @@
 typedef void (*VAGenericFunc)(void);
 typedef Display *(*X11OpenDisplayFunc)(const char *display_name);
 typedef int (*X11CloseDisplayFunc)(Display *display);
-typedef Bool (*VADRI2QueryExtensionFunc)(
+typedef Bool(*VADRI2QueryExtensionFunc)(
     Display *display, int *event_base, int *error_base);
-typedef Bool (*VADRI2QueryVersionFunc)(
+typedef Bool(*VADRI2QueryVersionFunc)(
     Display *display, int *major, int *minor);
-typedef Bool (*VADRI2AuthenticateFunc)(
+typedef Bool(*VADRI2AuthenticateFunc)(
     Display *display, XID window, uint32_t magic);
 
 struct drm_auth_x11_vtable {
@@ -84,9 +84,9 @@
     int ret;
 
     ret = snprintf(
-        libva_x11_name, sizeof(libva_x11_name),
-        "libva-x11.so.%d", LIBVA_MAJOR_VERSION
-    );
+              libva_x11_name, sizeof(libva_x11_name),
+              "libva-x11.so.%d", LIBVA_MAJOR_VERSION
+          );
     if (ret < 0 || ret >= sizeof(libva_x11_name))
         return false;
 
diff --git a/va/drm/va_drm_utils.c b/va/drm/va_drm_utils.c
index 1bd68ef..467d9ac 100644
--- a/va/drm/va_drm_utils.c
+++ b/va/drm/va_drm_utils.c
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/drm/va_drm_utils.h b/va/drm/va_drm_utils.h
index 1e9d90c..f3010d5 100644
--- a/va/drm/va_drm_utils.h
+++ b/va/drm/va_drm_utils.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/glx/va_backend_glx.h b/va/glx/va_backend_glx.h
index d110485..d0f7cf6 100644
--- a/va/glx/va_backend_glx.h
+++ b/va/glx/va_backend_glx.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -29,7 +29,7 @@
 
 struct VADriverVTableGLX {
     /* Optional: create a surface used for display to OpenGL */
-    VAStatus (*vaCreateSurfaceGLX)(
+    VAStatus(*vaCreateSurfaceGLX)(
         struct VADriverContext *ctx,
         unsigned int            gl_target,
         unsigned int            gl_texture,
@@ -37,13 +37,13 @@
     );
 
     /* Optional: destroy a VA/GLX surface */
-    VAStatus (*vaDestroySurfaceGLX)(
+    VAStatus(*vaDestroySurfaceGLX)(
         struct VADriverContext *ctx,
         void                   *gl_surface
     );
 
     /* Optional: copy a VA surface to a VA/GLX surface */
-    VAStatus (*vaCopySurfaceGLX)(
+    VAStatus(*vaCopySurfaceGLX)(
         struct VADriverContext *ctx,
         void                   *gl_surface,
         VASurfaceID             surface,
diff --git a/va/glx/va_glx.c b/va/glx/va_glx.c
index 25ef005..fdebb80 100644
--- a/va/glx/va_glx.c
+++ b/va/glx/va_glx.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/glx/va_glx.h b/va/glx/va_glx.h
index 1a0624d..109eaf6 100644
--- a/va/glx/va_glx.h
+++ b/va/glx/va_glx.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
index a3c7697..3ad01a6 100644
--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -138,7 +138,7 @@
 
 // Lookup for a GLX function
 typedef void (*GLFuncPtr)(void);
-typedef GLFuncPtr (*GLXGetProcAddressProc)(const char *);
+typedef GLFuncPtr(*GLXGetProcAddressProc)(const char *);
 
 static GLFuncPtr get_proc_address_default(const char *name)
 {
@@ -151,12 +151,12 @@
 
     dlerror();
     get_proc_func = (GLXGetProcAddressProc)
-        dlsym(RTLD_DEFAULT, "glXGetProcAddress");
+                    dlsym(RTLD_DEFAULT, "glXGetProcAddress");
     if (!dlerror())
         return get_proc_func;
 
     get_proc_func = (GLXGetProcAddressProc)
-        dlsym(RTLD_DEFAULT, "glXGetProcAddressARB");
+                    dlsym(RTLD_DEFAULT, "glXGetProcAddressARB");
     if (!dlerror())
         return get_proc_func;
 
@@ -197,15 +197,14 @@
     PFNGLGETSTRINGIPROC glGetStringi = 0;
 
     glGetStringi = (PFNGLGETSTRINGIPROC) get_proc_address("glGetStringi");
-    if(!glGetStringi)
+    if (!glGetStringi)
         return 0;
 
 
     glGetIntegerv(GL_NUM_EXTENSIONS, &nbExtensions);
-    for(i = 0; i < nbExtensions; i++)
-    {
+    for (i = 0; i < nbExtensions; i++) {
         const GLubyte *strExtension = glGetStringi(GL_EXTENSIONS, i);
-        if(strcmp((const char *) strExtension, name) == 0)
+        if (strcmp((const char *) strExtension, name) == 0)
             return 1;
     }
 
@@ -247,19 +246,19 @@
     VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
     pOpenGLVTable->glx_create_pixmap = (PFNGLXCREATEPIXMAPPROC)
-        get_proc_address("glXCreatePixmap");
+                                       get_proc_address("glXCreatePixmap");
     if (!pOpenGLVTable->glx_create_pixmap)
         return 0;
     pOpenGLVTable->glx_destroy_pixmap = (PFNGLXDESTROYPIXMAPPROC)
-        get_proc_address("glXDestroyPixmap");
+                                        get_proc_address("glXDestroyPixmap");
     if (!pOpenGLVTable->glx_destroy_pixmap)
         return 0;
     pOpenGLVTable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC)
-        get_proc_address("glXBindTexImageEXT");
+                                        get_proc_address("glXBindTexImageEXT");
     if (!pOpenGLVTable->glx_bind_tex_image)
         return 0;
     pOpenGLVTable->glx_release_tex_image = (PFNGLXRELEASETEXIMAGEEXTPROC)
-        get_proc_address("glXReleaseTexImageEXT");
+                                           get_proc_address("glXReleaseTexImageEXT");
     if (!pOpenGLVTable->glx_release_tex_image)
         return 0;
     return 1;
@@ -270,43 +269,43 @@
     VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
     pOpenGLVTable->gl_gen_framebuffers = (PFNGLGENFRAMEBUFFERSEXTPROC)
-        get_proc_address("glGenFramebuffersEXT");
+                                         get_proc_address("glGenFramebuffersEXT");
     if (!pOpenGLVTable->gl_gen_framebuffers)
         return 0;
     pOpenGLVTable->gl_delete_framebuffers = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
-        get_proc_address("glDeleteFramebuffersEXT");
+                                            get_proc_address("glDeleteFramebuffersEXT");
     if (!pOpenGLVTable->gl_delete_framebuffers)
         return 0;
     pOpenGLVTable->gl_bind_framebuffer = (PFNGLBINDFRAMEBUFFEREXTPROC)
-        get_proc_address("glBindFramebufferEXT");
+                                         get_proc_address("glBindFramebufferEXT");
     if (!pOpenGLVTable->gl_bind_framebuffer)
         return 0;
     pOpenGLVTable->gl_gen_renderbuffers = (PFNGLGENRENDERBUFFERSEXTPROC)
-        get_proc_address("glGenRenderbuffersEXT");
+                                          get_proc_address("glGenRenderbuffersEXT");
     if (!pOpenGLVTable->gl_gen_renderbuffers)
         return 0;
     pOpenGLVTable->gl_delete_renderbuffers = (PFNGLDELETERENDERBUFFERSEXTPROC)
-        get_proc_address("glDeleteRenderbuffersEXT");
+            get_proc_address("glDeleteRenderbuffersEXT");
     if (!pOpenGLVTable->gl_delete_renderbuffers)
         return 0;
     pOpenGLVTable->gl_bind_renderbuffer = (PFNGLBINDRENDERBUFFEREXTPROC)
-        get_proc_address("glBindRenderbufferEXT");
+                                          get_proc_address("glBindRenderbufferEXT");
     if (!pOpenGLVTable->gl_bind_renderbuffer)
         return 0;
     pOpenGLVTable->gl_renderbuffer_storage = (PFNGLRENDERBUFFERSTORAGEEXTPROC)
-        get_proc_address("glRenderbufferStorageEXT");
+            get_proc_address("glRenderbufferStorageEXT");
     if (!pOpenGLVTable->gl_renderbuffer_storage)
         return 0;
     pOpenGLVTable->gl_framebuffer_renderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
-        get_proc_address("glFramebufferRenderbufferEXT");
+            get_proc_address("glFramebufferRenderbufferEXT");
     if (!pOpenGLVTable->gl_framebuffer_renderbuffer)
         return 0;
     pOpenGLVTable->gl_framebuffer_texture_2d = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
-        get_proc_address("glFramebufferTexture2DEXT");
+            get_proc_address("glFramebufferTexture2DEXT");
     if (!pOpenGLVTable->gl_framebuffer_texture_2d)
         return 0;
     pOpenGLVTable->gl_check_framebuffer_status = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
-        get_proc_address("glCheckFramebufferStatusEXT");
+            get_proc_address("glCheckFramebufferStatusEXT");
     if (!pOpenGLVTable->gl_check_framebuffer_status)
         return 0;
     return 1;
@@ -355,7 +354,7 @@
         GLX_RENDER_TYPE,   GLX_RGBA_BIT,
         GLX_DOUBLEBUFFER,  True,
         GLX_RED_SIZE,      8,
-        GLX_GREEN_SIZE,    8, 
+        GLX_GREEN_SIZE,    8,
         GLX_BLUE_SIZE,     8,
         None
     };
@@ -367,8 +366,7 @@
     if (parent) {
         cs->display = parent->display;
         cs->window  = parent->window;
-    }
-    else {
+    } else {
         cs->display = ctx->native_dpy;
         cs->window  = None;
     }
@@ -376,10 +374,10 @@
 
     if (parent && parent->context) {
         status = glXQueryContext(
-            parent->display,
-            parent->context,
-            GLX_FBCONFIG_ID, &fbconfig_id
-        );
+                     parent->display,
+                     parent->context,
+                     GLX_FBCONFIG_ID, &fbconfig_id
+                 );
         if (status != Success)
             goto error;
 
@@ -387,33 +385,32 @@
             goto choose_fbconfig;
 
         fbconfigs = glXGetFBConfigs(
-            parent->display,
-            DefaultScreen(parent->display),
-            &n_fbconfigs
-        );
+                        parent->display,
+                        DefaultScreen(parent->display),
+                        &n_fbconfigs
+                    );
         if (!fbconfigs)
             goto error;
 
         /* Find out a GLXFBConfig compatible with the parent context */
         for (n = 0; n < n_fbconfigs; n++) {
             status = glXGetFBConfigAttrib(
-                cs->display,
-                fbconfigs[n],
-                GLX_FBCONFIG_ID, &val
-            );
+                         cs->display,
+                         fbconfigs[n],
+                         GLX_FBCONFIG_ID, &val
+                     );
             if (status == Success && val == fbconfig_id)
                 break;
         }
         if (n == n_fbconfigs)
             goto error;
-    }
-    else {
-    choose_fbconfig:
+    } else {
+choose_fbconfig:
         fbconfigs = glXChooseFBConfig(
-            ctx->native_dpy,
-            ctx->x11_screen,
-            fbconfig_attrs, &n_fbconfigs
-        );
+                        ctx->native_dpy,
+                        ctx->x11_screen,
+                        fbconfig_attrs, &n_fbconfigs
+                    );
         if (!fbconfigs)
             goto error;
 
@@ -422,12 +419,12 @@
     }
 
     cs->context = glXCreateNewContext(
-        cs->display,
-        fbconfigs[n],
-        GLX_RGBA_TYPE,
-        parent ? parent->context : NULL,
-        True
-    );
+                      cs->display,
+                      fbconfigs[n],
+                      GLX_RGBA_TYPE,
+                      parent ? parent->context : NULL,
+                      True
+                  );
     if (cs->context)
         goto end;
 
@@ -505,12 +502,12 @@
     if (wattr.depth != 24 && wattr.depth != 32)
         return 0;
     pixmap = XCreatePixmap(
-        ctx->native_dpy,
-        root_window,
-        width,
-        height,
-        wattr.depth
-    );
+                 ctx->native_dpy,
+                 root_window,
+                 width,
+                 height,
+                 wattr.depth
+             );
     if (!pixmap)
         return 0;
     pSurfaceGLX->pixmap = pixmap;
@@ -538,20 +535,22 @@
     for (attrib = fbconfig_attrs; *attrib != GL_NONE; attrib += 2)
         ;
     if (wattr.depth == 32) {
-    *attrib++ = GLX_ALPHA_SIZE;                 *attrib++ = 8;
-    *attrib++ = GLX_BIND_TO_TEXTURE_RGBA_EXT;   *attrib++ = GL_TRUE;
-    }
-    else {
-    *attrib++ = GLX_BIND_TO_TEXTURE_RGB_EXT;    *attrib++ = GL_TRUE;
+        *attrib++ = GLX_ALPHA_SIZE;
+        *attrib++ = 8;
+        *attrib++ = GLX_BIND_TO_TEXTURE_RGBA_EXT;
+        *attrib++ = GL_TRUE;
+    } else {
+        *attrib++ = GLX_BIND_TO_TEXTURE_RGB_EXT;
+        *attrib++ = GL_TRUE;
     }
     *attrib++ = GL_NONE;
 
     fbconfig = glXChooseFBConfig(
-        ctx->native_dpy,
-        ctx->x11_screen,
-        fbconfig_attrs,
-        &n_fbconfig_attrs
-    );
+                   ctx->native_dpy,
+                   ctx->x11_screen,
+                   fbconfig_attrs,
+                   &n_fbconfig_attrs
+               );
     if (!fbconfig)
         return 0;
 
@@ -564,18 +563,18 @@
         ;
     *attrib++ = GLX_TEXTURE_FORMAT_EXT;
     if (wattr.depth == 32)
-    *attrib++ = GLX_TEXTURE_FORMAT_RGBA_EXT;
+        *attrib++ = GLX_TEXTURE_FORMAT_RGBA_EXT;
     else
-    *attrib++ = GLX_TEXTURE_FORMAT_RGB_EXT;
+        *attrib++ = GLX_TEXTURE_FORMAT_RGB_EXT;
     *attrib++ = GL_NONE;
 
     x11_trap_errors();
     glx_pixmap = pOpenGLVTable->glx_create_pixmap(
-        ctx->native_dpy,
-        fbconfig[0],
-        pixmap,
-        pixmap_attrs
-    );
+                     ctx->native_dpy,
+                     fbconfig[0],
+                     pixmap,
+                     pixmap_attrs
+                 );
     free(fbconfig);
     if (x11_untrap_errors() != 0)
         return 0;
@@ -671,10 +670,14 @@
     glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
     glBegin(GL_QUADS);
     {
-        glTexCoord2f(0.0f, 0.0f); glVertex2i(0, 0);
-        glTexCoord2f(0.0f, 1.0f); glVertex2i(0, h);
-        glTexCoord2f(1.0f, 1.0f); glVertex2i(w, h);
-        glTexCoord2f(1.0f, 0.0f); glVertex2i(w, 0);
+        glTexCoord2f(0.0f, 0.0f);
+        glVertex2i(0, 0);
+        glTexCoord2f(0.0f, 1.0f);
+        glVertex2i(0, h);
+        glTexCoord2f(1.0f, 1.0f);
+        glVertex2i(w, h);
+        glTexCoord2f(1.0f, 0.0f);
+        glVertex2i(w, 0);
     }
     glEnd();
 }
@@ -932,7 +935,7 @@
     if (new_cs)
         gl_destroy_context(new_cs);
 
-    return VA_STATUS_ERROR_ALLOCATION_FAILED;    
+    return VA_STATUS_ERROR_ALLOCATION_FAILED;
 }
 
 static VAStatus
@@ -982,14 +985,14 @@
 
     x11_trap_errors();
     status = ctx->vtable->vaPutSurface(
-        ctx,
-        surface,
-        (void *)pSurfaceGLX->pixmap,
-        0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
-        0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
-        NULL, 0,
-        flags
-    );
+                 ctx,
+                 surface,
+                 (void *)pSurfaceGLX->pixmap,
+                 0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
+                 0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
+                 NULL, 0,
+                 flags
+             );
     XSync(ctx->native_dpy, False);
     if (x11_untrap_errors() != 0)
         return VA_STATUS_ERROR_OPERATION_FAILED;
@@ -1106,8 +1109,7 @@
         vtable->vaCreateSurfaceGLX      = vaCreateSurfaceGLX_impl_driver;
         vtable->vaDestroySurfaceGLX     = vaDestroySurfaceGLX_impl_driver;
         vtable->vaCopySurfaceGLX        = vaCopySurfaceGLX_impl_driver;
-    }
-    else {
+    } else {
         vtable->vaCreateSurfaceGLX      = vaCreateSurfaceGLX_impl_libva;
         vtable->vaDestroySurfaceGLX     = vaDestroySurfaceGLX_impl_libva;
         vtable->vaCopySurfaceGLX        = vaCopySurfaceGLX_impl_libva;
diff --git a/va/glx/va_glx_impl.h b/va/glx/va_glx_impl.h
index c47f54a..e05c190 100644
--- a/va/glx/va_glx_impl.h
+++ b/va/glx/va_glx_impl.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/glx/va_glx_private.h b/va/glx/va_glx_private.h
index e86efb6..814374e 100644
--- a/va/glx/va_glx_private.h
+++ b/va/glx/va_glx_private.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -41,7 +41,7 @@
 #if GLX_GLXEXT_VERSION < 27
 /* XXX: this is not exactly that version but this is the only means to
    make sure we have the correct <GL/glx.h> with those signatures */
-typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
+typedef GLXPixmap(*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
 typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
 #endif
 
diff --git a/va/sysdeps.h b/va/sysdeps.h
index d7ee850..21d17f0 100644
--- a/va/sysdeps.h
+++ b/va/sysdeps.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/va.c b/va/va.c
index f207827..71a5981 100644
--- a/va/va.c
+++ b/va/va.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -50,9 +50,9 @@
 #endif
 #endif
 
-#define DRIVER_EXTENSION	"_drv_video.so"
+#define DRIVER_EXTENSION    "_drv_video.so"
 
-#define ASSERT		assert
+#define ASSERT      assert
 #define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(dpy, ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNIMPLEMENTED;
 #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(dpy, ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
 #define CHECK_STRING(s, ctx, var) if (!va_checkString(dpy, ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
@@ -67,11 +67,11 @@
 {
     char *token, *value, *saveptr;
     char oneline[1024];
-    FILE *fp=NULL;
+    FILE *fp = NULL;
 
     if (env == NULL)
         return 1;
-    
+
     fp = fopen(SYSCONFDIR "/libva.conf", "r");
     while (fp && (fgets(oneline, 1024, fp) != NULL)) {
         if (strlen(oneline) == 1)
@@ -84,7 +84,7 @@
 
         if (strcmp(token, env) == 0) {
             if (env_value) {
-                strncpy(env_value,value, 1024);
+                strncpy(env_value, value, 1024);
                 env_value[1023] = '\0';
             }
 
@@ -105,7 +105,7 @@
         }
         return 0;
     }
-    
+
     return 1;
 }
 
@@ -225,8 +225,7 @@
         if (n == len)
             dctx->error_callback(dctx->error_callback_user_context, dynbuf);
         free(dynbuf);
-    }
-    else if (len > 0)
+    } else if (len > 0)
         dctx->error_callback(dctx->error_callback_user_context, buf);
 #endif
 }
@@ -256,8 +255,7 @@
         if (n == len)
             dctx->info_callback(dctx->info_callback_user_context, dynbuf);
         free(dynbuf);
-    }
-    else if (len > 0)
+    } else if (len > 0)
         dctx->info_callback(dctx->info_callback_user_context, buf);
 #endif
 }
@@ -382,18 +380,18 @@
     }
     driver_name_env = getenv("LIBVA_DRIVER_NAME");
     /*if user set driver name by vaSetDriverName */
-    if (ctx->override_driver_name){
-        if(*driver_name)
+    if (ctx->override_driver_name) {
+        if (*driver_name)
             free(*driver_name);
         *driver_name = strdup(ctx->override_driver_name);
         if (!(*driver_name)) {
-              va_errorMessage(dpy, "va_getDriverNameByIndex  failed with %s, out of memory\n",vaErrorStr(VA_STATUS_ERROR_ALLOCATION_FAILED));
+            va_errorMessage(dpy, "va_getDriverNameByIndex  failed with %s, out of memory\n", vaErrorStr(VA_STATUS_ERROR_ALLOCATION_FAILED));
             return VA_STATUS_ERROR_ALLOCATION_FAILED;
         }
         va_infoMessage(dpy, "User requested driver '%s'\n", *driver_name);
         return VA_STATUS_SUCCESS;
     } else if (driver_name_env && (geteuid() == getuid())) {
-        if(*driver_name)
+        if (*driver_name)
             free(*driver_name);
         /*if user set driver name by environment variable*/
         *driver_name = strdup(driver_name_env);
@@ -405,19 +403,19 @@
 
 static char *va_getDriverPath(const char *driver_dir, const char *driver_name)
 {
-  int n = snprintf(0, 0, "%s/%s%s", driver_dir, driver_name, DRIVER_EXTENSION);
-  if (n < 0)
-      return NULL;
-  char *driver_path = (char *) malloc(n + 1);
-  if (!driver_path)
-      return NULL;
-  n = snprintf(driver_path, n + 1, "%s/%s%s",
-               driver_dir, driver_name, DRIVER_EXTENSION);
-  if (n < 0) {
-    free(driver_path);
-    return NULL;
-  }
-  return driver_path;
+    int n = snprintf(0, 0, "%s/%s%s", driver_dir, driver_name, DRIVER_EXTENSION);
+    if (n < 0)
+        return NULL;
+    char *driver_path = (char *) malloc(n + 1);
+    if (!driver_path)
+        return NULL;
+    n = snprintf(driver_path, n + 1, "%s/%s%s",
+                 driver_dir, driver_name, DRIVER_EXTENSION);
+    if (n < 0) {
+        free(driver_path);
+        return NULL;
+    }
+    return driver_path;
 }
 
 static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
@@ -427,7 +425,7 @@
     char *search_path = NULL;
     char *saveptr;
     char *driver_dir;
-    
+
     if (geteuid() == getuid())
         /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
         search_path = getenv("LIBVA_DRIVERS_PATH");
@@ -436,9 +434,9 @@
 
     search_path = strdup((const char *)search_path);
     if (!search_path) {
-         va_errorMessage(dpy, "%s L%d Out of memory\n",
-                            __FUNCTION__, __LINE__);
-         return VA_STATUS_ERROR_ALLOCATION_FAILED;
+        va_errorMessage(dpy, "%s L%d Out of memory\n",
+                        __FUNCTION__, __LINE__);
+        return VA_STATUS_ERROR_ALLOCATION_FAILED;
     }
     driver_dir = strtok_r(search_path, ":", &saveptr);
     while (driver_dir) {
@@ -453,13 +451,13 @@
 
         va_infoMessage(dpy, "Trying to open %s\n", driver_path);
 #if defined(RTLD_NODELETE) && !defined(ANDROID)
-        handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
+        handle = dlopen(driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
 #else
-        handle = dlopen( driver_path, RTLD_NOW| RTLD_GLOBAL);
+        handle = dlopen(driver_path, RTLD_NOW | RTLD_GLOBAL);
 #endif
         if (!handle) {
             /* Don't give errors for non-existing files */
-            if (0 == access( driver_path, F_OK))
+            if (0 == access(driver_path, F_OK))
                 va_errorMessage(dpy, "dlopen of %s failed: %s\n", driver_path, dlerror());
         } else {
             VADriverInit init_func = NULL;
@@ -585,12 +583,12 @@
             }
         }
         free(driver_path);
-        
+
         driver_dir = strtok_r(NULL, ":", &saveptr);
     }
-    
-    free(search_path);    
-    
+
+    free(search_path);
+
     return vaStatus;
 }
 
@@ -603,7 +601,7 @@
 
     if (NULL == ctx->handle)
         return NULL;
-        
+
     return (VAPrivFunc) dlsym(ctx->handle, func);
 }
 
@@ -613,71 +611,71 @@
  */
 const char *vaErrorStr(VAStatus error_status)
 {
-    switch(error_status) {
-        case VA_STATUS_SUCCESS:
-            return "success (no error)";
-        case VA_STATUS_ERROR_OPERATION_FAILED:
-            return "operation failed";
-        case VA_STATUS_ERROR_ALLOCATION_FAILED:
-            return "resource allocation failed";
-        case VA_STATUS_ERROR_INVALID_DISPLAY:
-            return "invalid VADisplay";
-        case VA_STATUS_ERROR_INVALID_CONFIG:
-            return "invalid VAConfigID";
-        case VA_STATUS_ERROR_INVALID_CONTEXT:
-            return "invalid VAContextID";
-        case VA_STATUS_ERROR_INVALID_SURFACE:
-            return "invalid VASurfaceID";
-        case VA_STATUS_ERROR_INVALID_BUFFER:
-            return "invalid VABufferID";
-        case VA_STATUS_ERROR_INVALID_IMAGE:
-            return "invalid VAImageID";
-        case VA_STATUS_ERROR_INVALID_SUBPICTURE:
-            return "invalid VASubpictureID";
-        case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
-            return "attribute not supported";
-        case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
-            return "list argument exceeds maximum number";
-        case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
-            return "the requested VAProfile is not supported";
-        case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
-            return "the requested VAEntryPoint is not supported";
-        case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
-            return "the requested RT Format is not supported";
-        case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
-            return "the requested VABufferType is not supported";
-        case VA_STATUS_ERROR_SURFACE_BUSY:
-            return "surface is in use";
-        case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
-            return "flag not supported";
-        case VA_STATUS_ERROR_INVALID_PARAMETER:
-            return "invalid parameter";
-        case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
-            return "resolution not supported";
-        case VA_STATUS_ERROR_UNIMPLEMENTED:
-            return "the requested function is not implemented";
-        case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
-            return "surface is in displaying (may by overlay)" ;
-        case VA_STATUS_ERROR_INVALID_IMAGE_FORMAT:
-            return "invalid VAImageFormat";
-        case VA_STATUS_ERROR_DECODING_ERROR:
-            return "internal decoding error";
-        case VA_STATUS_ERROR_ENCODING_ERROR:
-            return "internal encoding error";
-        case VA_STATUS_ERROR_INVALID_VALUE:
-            return "an invalid/unsupported value was supplied";
-        case VA_STATUS_ERROR_UNSUPPORTED_FILTER:
-            return "the requested filter is not supported";
-        case VA_STATUS_ERROR_INVALID_FILTER_CHAIN:
-            return "an invalid filter chain was supplied";
-        case VA_STATUS_ERROR_HW_BUSY:
-            return "HW busy now";
-        case VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE:
-            return "an unsupported memory type was supplied";
-        case VA_STATUS_ERROR_NOT_ENOUGH_BUFFER:
-            return "allocated memory size is not enough for input or output";
-        case VA_STATUS_ERROR_UNKNOWN:
-            return "unknown libva error";
+    switch (error_status) {
+    case VA_STATUS_SUCCESS:
+        return "success (no error)";
+    case VA_STATUS_ERROR_OPERATION_FAILED:
+        return "operation failed";
+    case VA_STATUS_ERROR_ALLOCATION_FAILED:
+        return "resource allocation failed";
+    case VA_STATUS_ERROR_INVALID_DISPLAY:
+        return "invalid VADisplay";
+    case VA_STATUS_ERROR_INVALID_CONFIG:
+        return "invalid VAConfigID";
+    case VA_STATUS_ERROR_INVALID_CONTEXT:
+        return "invalid VAContextID";
+    case VA_STATUS_ERROR_INVALID_SURFACE:
+        return "invalid VASurfaceID";
+    case VA_STATUS_ERROR_INVALID_BUFFER:
+        return "invalid VABufferID";
+    case VA_STATUS_ERROR_INVALID_IMAGE:
+        return "invalid VAImageID";
+    case VA_STATUS_ERROR_INVALID_SUBPICTURE:
+        return "invalid VASubpictureID";
+    case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
+        return "attribute not supported";
+    case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
+        return "list argument exceeds maximum number";
+    case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
+        return "the requested VAProfile is not supported";
+    case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
+        return "the requested VAEntryPoint is not supported";
+    case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
+        return "the requested RT Format is not supported";
+    case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
+        return "the requested VABufferType is not supported";
+    case VA_STATUS_ERROR_SURFACE_BUSY:
+        return "surface is in use";
+    case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
+        return "flag not supported";
+    case VA_STATUS_ERROR_INVALID_PARAMETER:
+        return "invalid parameter";
+    case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
+        return "resolution not supported";
+    case VA_STATUS_ERROR_UNIMPLEMENTED:
+        return "the requested function is not implemented";
+    case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
+        return "surface is in displaying (may by overlay)" ;
+    case VA_STATUS_ERROR_INVALID_IMAGE_FORMAT:
+        return "invalid VAImageFormat";
+    case VA_STATUS_ERROR_DECODING_ERROR:
+        return "internal decoding error";
+    case VA_STATUS_ERROR_ENCODING_ERROR:
+        return "internal encoding error";
+    case VA_STATUS_ERROR_INVALID_VALUE:
+        return "an invalid/unsupported value was supplied";
+    case VA_STATUS_ERROR_UNSUPPORTED_FILTER:
+        return "the requested filter is not supported";
+    case VA_STATUS_ERROR_INVALID_FILTER_CHAIN:
+        return "an invalid filter chain was supplied";
+    case VA_STATUS_ERROR_HW_BUSY:
+        return "HW busy now";
+    case VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE:
+        return "an unsupported memory type was supplied";
+    case VA_STATUS_ERROR_NOT_ENOUGH_BUFFER:
+        return "allocated memory size is not enough for input or output";
+    case VA_STATUS_ERROR_UNKNOWN:
+        return "unknown libva error";
     }
     return "unknown libva error / description missing";
 }
@@ -692,10 +690,10 @@
     char *override_driver_name = NULL;
     ctx = CTX(dpy);
 
-    if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
+    if (strlen(driver_name) == 0 || strlen(driver_name) >= 256) {
         vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
         va_errorMessage(dpy, "vaSetDriverName returns %s\n",
-                         vaErrorStr(vaStatus));
+                        vaErrorStr(vaStatus));
         return vaStatus;
     }
 
@@ -703,7 +701,7 @@
     if (!override_driver_name) {
         vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
         va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n",
-                         vaErrorStr(vaStatus));
+                        vaErrorStr(vaStatus));
         return vaStatus;
     }
 
@@ -711,10 +709,10 @@
     return VA_STATUS_SUCCESS;
 }
 
-VAStatus vaInitialize (
+VAStatus vaInitialize(
     VADisplay dpy,
-    int *major_version,	 /* out */
-    int *minor_version 	 /* out */
+    int *major_version,  /* out */
+    int *minor_version   /* out */
 )
 {
     char *driver_name = NULL;
@@ -738,10 +736,10 @@
     }
     /*load driver one by one, until load success */
     for (candidate_index = 0; candidate_index < num_candidates; candidate_index ++) {
-        if(driver_name)
+        if (driver_name)
             free(driver_name);
         vaStatus = va_getDriverNameByIndex(dpy, &driver_name, candidate_index);
-        if(vaStatus != VA_STATUS_SUCCESS) {
+        if (vaStatus != VA_STATUS_SUCCESS) {
             va_errorMessage(dpy, "vaGetDriverNameByIndex() failed with %s, driver_name = %s\n", vaErrorStr(vaStatus), driver_name);
             break;
         }
@@ -750,7 +748,7 @@
 
         if (vaStatus == VA_STATUS_SUCCESS) {
             break;
-       }
+        }
 
     }
 
@@ -759,7 +757,7 @@
 
     if (driver_name)
         free(driver_name);
-    
+
     VA_TRACE_LOG(va_TraceInitialize, dpy, major_version, minor_version);
     VA_TRACE_RET(dpy, vaStatus);
     return vaStatus;
@@ -768,46 +766,46 @@
 
 /*
  * After this call, all library internal resources will be cleaned up
- */ 
-VAStatus vaTerminate (
+ */
+VAStatus vaTerminate(
     VADisplay dpy
 )
 {
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
-  VADriverContextP old_ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
+    VADriverContextP old_ctx;
 
-  CHECK_DISPLAY(dpy);
-  old_ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    old_ctx = CTX(dpy);
 
-  if (old_ctx->handle) {
-      vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
-      dlclose(old_ctx->handle);
-      old_ctx->handle = NULL;
-  }
-  free(old_ctx->vtable);
-  old_ctx->vtable = NULL;
-  free(old_ctx->vtable_vpp);
-  old_ctx->vtable_vpp = NULL;
-  free(old_ctx->vtable_prot);
-  old_ctx->vtable_prot = NULL;
+    if (old_ctx->handle) {
+        vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
+        dlclose(old_ctx->handle);
+        old_ctx->handle = NULL;
+    }
+    free(old_ctx->vtable);
+    old_ctx->vtable = NULL;
+    free(old_ctx->vtable_vpp);
+    old_ctx->vtable_vpp = NULL;
+    free(old_ctx->vtable_prot);
+    old_ctx->vtable_prot = NULL;
 
-  if (old_ctx->override_driver_name) {
-      free(old_ctx->override_driver_name);
-      old_ctx->override_driver_name = NULL;
-  }
+    if (old_ctx->override_driver_name) {
+        free(old_ctx->override_driver_name);
+        old_ctx->override_driver_name = NULL;
+    }
 
-  VA_TRACE_LOG(va_TraceTerminate, dpy);
-  VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_LOG(va_TraceTerminate, dpy);
+    VA_TRACE_RET(dpy, vaStatus);
 
-  va_TraceEnd(dpy);
+    va_TraceEnd(dpy);
 
-  va_FoolEnd(dpy);
+    va_FoolEnd(dpy);
 
-  if (VA_STATUS_SUCCESS == vaStatus)
-      pDisplayContext->vaDestroy(pDisplayContext);
+    if (VA_STATUS_SUCCESS == vaStatus)
+        pDisplayContext->vaDestroy(pDisplayContext);
 
-  return vaStatus;
+    return vaStatus;
 }
 
 /*
@@ -818,69 +816,69 @@
  * e.g. for the Intel GMA500 implementation, an example would be:
  * "IntelGMA500-1.0-0.2-patch3
  */
-const char *vaQueryVendorString (
+const char *vaQueryVendorString(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return NULL;
-  
-  return CTX(dpy)->str_vendor;
+    if (!vaDisplayIsValid(dpy))
+        return NULL;
+
+    return CTX(dpy)->str_vendor;
 }
 
 
 /* Get maximum number of profiles supported by the implementation */
-int vaMaxNumProfiles (
+int vaMaxNumProfiles(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  return CTX(dpy)->max_profiles;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    return CTX(dpy)->max_profiles;
 }
 
 /* Get maximum number of entrypoints supported by the implementation */
-int vaMaxNumEntrypoints (
+int vaMaxNumEntrypoints(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  return CTX(dpy)->max_entrypoints;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    return CTX(dpy)->max_entrypoints;
 }
 
 
 /* Get maximum number of attributs supported by the implementation */
-int vaMaxNumConfigAttributes (
+int vaMaxNumConfigAttributes(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  return CTX(dpy)->max_attributes;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    return CTX(dpy)->max_attributes;
 }
 
-VAStatus vaQueryConfigEntrypoints (
+VAStatus vaQueryConfigEntrypoints(
     VADisplay dpy,
     VAProfile profile,
-    VAEntrypoint *entrypoints,	/* out */
-    int *num_entrypoints	/* out */
+    VAEntrypoint *entrypoints,  /* out */
+    int *num_entrypoints    /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    vaStatus = ctx->vtable->vaQueryConfigEntrypoints(ctx, profile, entrypoints, num_entrypoints);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaGetConfigAttributes (
+VAStatus vaGetConfigAttributes(
     VADisplay dpy,
     VAProfile profile,
     VAEntrypoint entrypoint,
@@ -888,111 +886,111 @@
     int num_attribs
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    vaStatus = ctx->vtable->vaGetConfigAttributes(ctx, profile, entrypoint, attrib_list, num_attribs);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaQueryConfigProfiles (
+VAStatus vaQueryConfigProfiles(
     VADisplay dpy,
-    VAProfile *profile_list,	/* out */
-    int *num_profiles		/* out */
+    VAProfile *profile_list,    /* out */
+    int *num_profiles       /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus =  ctx->vtable->vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    vaStatus =  ctx->vtable->vaQueryConfigProfiles(ctx, profile_list, num_profiles);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaCreateConfig (
+VAStatus vaCreateConfig(
     VADisplay dpy,
-    VAProfile profile, 
-    VAEntrypoint entrypoint, 
+    VAProfile profile,
+    VAEntrypoint entrypoint,
     VAConfigAttrib *attrib_list,
     int num_attribs,
     VAConfigID *config_id /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
 
-  vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  /* record the current entrypoint for further trace/fool determination */
-  VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
-  VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
-  VA_TRACE_RET(dpy, vaStatus); 
-  return vaStatus;
+    vaStatus = ctx->vtable->vaCreateConfig(ctx, profile, entrypoint, attrib_list, num_attribs, config_id);
+
+    /* record the current entrypoint for further trace/fool determination */
+    VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
+    VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaDestroyConfig (
+VAStatus vaDestroyConfig(
     VADisplay dpy,
     VAConfigID config_id
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaDestroyConfig ( ctx, config_id );
+    vaStatus = ctx->vtable->vaDestroyConfig(ctx, config_id);
 
-  VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
-  VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
+    VA_TRACE_RET(dpy, vaStatus);
 
-  return vaStatus;
+    return vaStatus;
 }
 
-VAStatus vaQueryConfigAttributes (
+VAStatus vaQueryConfigAttributes(
     VADisplay dpy,
-    VAConfigID config_id, 
-    VAProfile *profile, 	/* out */
-    VAEntrypoint *entrypoint, 	/* out */
+    VAConfigID config_id,
+    VAProfile *profile,     /* out */
+    VAEntrypoint *entrypoint,   /* out */
     VAConfigAttrib *attrib_list,/* out */
-    int *num_attribs		/* out */
+    int *num_attribs        /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    vaStatus = ctx->vtable->vaQueryConfigAttributes(ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaQueryProcessingRate (
+VAStatus vaQueryProcessingRate(
     VADisplay dpy,
     VAConfigID config_id,
     VAProcessingRateParameter *proc_buf,
-    unsigned int *processing_rate	/* out */
+    unsigned int *processing_rate   /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  if(!ctx->vtable->vaQueryProcessingRate)
-      vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
-  else
-      vaStatus = ctx->vtable->vaQueryProcessingRate( ctx, config_id, proc_buf, processing_rate);
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+    if (!ctx->vtable->vaQueryProcessingRate)
+        vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
+    else
+        vaStatus = ctx->vtable->vaQueryProcessingRate(ctx, config_id, proc_buf, processing_rate);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
 /* XXX: this is a slow implementation that will be removed */
@@ -1039,7 +1037,7 @@
     }
 
     va_status = ctx->vtable->vaQueryImageFormats(
-        ctx, image_formats, &num_image_formats);
+                    ctx, image_formats, &num_image_formats);
     if (va_status != VA_STATUS_SUCCESS)
         goto end;
 
@@ -1062,7 +1060,7 @@
     for (i = 0; i < num_image_formats; i++) {
         VASurfaceAttrib * const attrib = &attribs[n];
         attrib->type = VASurfaceAttribPixelFormat;
-        attrib->flags = VA_SURFACE_ATTRIB_GETTABLE|VA_SURFACE_ATTRIB_SETTABLE;
+        attrib->flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
         attrib->value.type = VAGenericValueTypeInteger;
         attrib->value.value.i = image_formats[i].fourcc;
         if (++n == num_attribs) {
@@ -1073,7 +1071,7 @@
     num_attribs = n;
 
     va_status = ctx->vtable->vaGetSurfaceAttributes(
-        ctx, config, attribs, num_attribs);
+                    ctx, config, attribs, num_attribs);
     if (va_status != VA_STATUS_SUCCESS)
         goto end;
 
@@ -1149,13 +1147,13 @@
 
     if (!ctx->vtable->vaQuerySurfaceAttributes)
         vaStatus = va_impl_query_surface_attributes(ctx, config,
-                                                    attrib_list, num_attribs);
+                   attrib_list, num_attribs);
     else
         vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
-                                                         attrib_list, num_attribs);
+                   attrib_list, num_attribs);
 
     VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, num_attribs);
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
 
     return vaStatus;
 }
@@ -1182,44 +1180,44 @@
 
     if (ctx->vtable->vaCreateSurfaces2)
         vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
-                                              surfaces, num_surfaces,
-                                              attrib_list, num_attribs);
+                   surfaces, num_surfaces,
+                   attrib_list, num_attribs);
     else if (attrib_list && num_attribs > 0)
         vaStatus = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
     else
         vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
-                                                 num_surfaces, surfaces);
+                   num_surfaces, surfaces);
     VA_TRACE_LOG(va_TraceCreateSurfaces,
                  dpy, width, height, format, num_surfaces, surfaces,
                  attrib_list, num_attribs);
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
 
     return vaStatus;
 }
 
 
-VAStatus vaDestroySurfaces (
+VAStatus vaDestroySurfaces(
     VADisplay dpy,
     VASurfaceID *surface_list,
     int num_surfaces
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus;
 
-  VA_TRACE_LOG(va_TraceDestroySurfaces,
-               dpy, surface_list, num_surfaces);
-  
-  vaStatus = ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
-  VA_TRACE_RET(dpy, vaStatus); 
-  
-  return vaStatus;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+
+    VA_TRACE_LOG(va_TraceDestroySurfaces,
+                 dpy, surface_list, num_surfaces);
+
+    vaStatus = ctx->vtable->vaDestroySurfaces(ctx, surface_list, num_surfaces);
+    VA_TRACE_RET(dpy, vaStatus);
+
+    return vaStatus;
 }
 
-VAStatus vaCreateContext (
+VAStatus vaCreateContext(
     VADisplay dpy,
     VAConfigID config_id,
     int picture_width,
@@ -1227,67 +1225,66 @@
     int flag,
     VASurfaceID *render_targets,
     int num_render_targets,
-    VAContextID *context		/* out */
+    VAContextID *context        /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus;
 
-  vaStatus = ctx->vtable->vaCreateContext( ctx, config_id, picture_width, picture_height,
-                                      flag, render_targets, num_render_targets, context );
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  /* keep current encode/decode resoluton */
-  VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
-  VA_TRACE_RET(dpy, vaStatus); 
+    vaStatus = ctx->vtable->vaCreateContext(ctx, config_id, picture_width, picture_height,
+                                            flag, render_targets, num_render_targets, context);
 
-  return vaStatus;
+    /* keep current encode/decode resoluton */
+    VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
+    VA_TRACE_RET(dpy, vaStatus);
+
+    return vaStatus;
 }
 
-VAStatus vaDestroyContext (
+VAStatus vaDestroyContext(
     VADisplay dpy,
     VAContextID context
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus;
+    VADriverContextP ctx;
+    VAStatus vaStatus;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaDestroyContext( ctx, context );
+    vaStatus = ctx->vtable->vaDestroyContext(ctx, context);
 
-  VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
-  VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
+    VA_TRACE_RET(dpy, vaStatus);
 
-  return vaStatus;
+    return vaStatus;
 }
 
-VAStatus vaCreateMFContext (
+VAStatus vaCreateMFContext(
     VADisplay dpy,
     VAMFContextID *mf_context    /* out */
 )
 {
     VADriverContextP ctx;
     VAStatus vaStatus;
-    
+
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
-    if(ctx->vtable->vaCreateMFContext == NULL)
+    if (ctx->vtable->vaCreateMFContext == NULL)
         vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
-    else
-    {
-        vaStatus = ctx->vtable->vaCreateMFContext( ctx, mf_context);
+    else {
+        vaStatus = ctx->vtable->vaCreateMFContext(ctx, mf_context);
         VA_TRACE_ALL(va_TraceCreateMFContext, dpy, mf_context);
     }
 
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
     return vaStatus;
 }
 
-VAStatus vaMFAddContext (
+VAStatus vaMFAddContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
@@ -1298,20 +1295,19 @@
 
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
-    
-    if(ctx->vtable->vaMFAddContext == NULL)
+
+    if (ctx->vtable->vaMFAddContext == NULL)
         vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
-    else
-    {
-        vaStatus = ctx->vtable->vaMFAddContext( ctx, context, mf_context);
+    else {
+        vaStatus = ctx->vtable->vaMFAddContext(ctx, context, mf_context);
         VA_TRACE_ALL(va_TraceMFAddContext, dpy, context, mf_context);
     }
 
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
     return vaStatus;
 }
 
-VAStatus vaMFReleaseContext (
+VAStatus vaMFReleaseContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
@@ -1322,19 +1318,18 @@
 
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
-    if(ctx->vtable->vaMFReleaseContext == NULL)
+    if (ctx->vtable->vaMFReleaseContext == NULL)
         vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
-    else
-    {
-        vaStatus = ctx->vtable->vaMFReleaseContext( ctx, context, mf_context);
+    else {
+        vaStatus = ctx->vtable->vaMFReleaseContext(ctx, context, mf_context);
         VA_TRACE_ALL(va_TraceMFReleaseContext, dpy, context, mf_context);
     }
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
 
     return vaStatus;
 }
 
-VAStatus vaMFSubmit (
+VAStatus vaMFSubmit(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID *contexts,
@@ -1347,46 +1342,45 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
     CHECK_VTABLE(vaStatus, ctx, MFSubmit);
-    if(ctx->vtable->vaMFSubmit == NULL)
+    if (ctx->vtable->vaMFSubmit == NULL)
         vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
-    else
-    {
-        vaStatus = ctx->vtable->vaMFSubmit( ctx, mf_context, contexts, num_contexts);
+    else {
+        vaStatus = ctx->vtable->vaMFSubmit(ctx, mf_context, contexts, num_contexts);
         VA_TRACE_ALL(va_TraceMFSubmit, dpy, mf_context, contexts, num_contexts);
     }
-    VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_RET(dpy, vaStatus);
 
     return vaStatus;
 }
 
-VAStatus vaCreateBuffer (
+VAStatus vaCreateBuffer(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferType type,		/* in */
-    unsigned int size,		/* in */
-    unsigned int num_elements,	/* in */
-    void *data,			/* in */
-    VABufferID *buf_id		/* out */
+    VAContextID context,    /* in */
+    VABufferType type,      /* in */
+    unsigned int size,      /* in */
+    unsigned int num_elements,  /* in */
+    void *data,         /* in */
+    VABufferID *buf_id      /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus;
 
-  VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable->vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
+    VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
 
-  VA_TRACE_LOG(va_TraceCreateBuffer,
-               dpy, context, type, size, num_elements, data, buf_id);
-  
-  VA_TRACE_RET(dpy, vaStatus); 
-  return vaStatus;
+    vaStatus = ctx->vtable->vaCreateBuffer(ctx, context, type, size, num_elements, data, buf_id);
+
+    VA_TRACE_LOG(va_TraceCreateBuffer,
+                 dpy, context, type, size, num_elements, data, buf_id);
+
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaCreateBuffer2 (
+VAStatus vaCreateBuffer2(
     VADisplay dpy,
     VAContextID context,
     VABufferType type,
@@ -1397,121 +1391,121 @@
     VABufferID *buf_id
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus;
+    VADriverContextP ctx;
+    VAStatus vaStatus;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  if(!ctx->vtable->vaCreateBuffer2)
-     return VA_STATUS_ERROR_UNIMPLEMENTED;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+    if (!ctx->vtable->vaCreateBuffer2)
+        return VA_STATUS_ERROR_UNIMPLEMENTED;
 
-  vaStatus = ctx->vtable->vaCreateBuffer2( ctx, context, type, width, height ,unit_size, pitch, buf_id);
+    vaStatus = ctx->vtable->vaCreateBuffer2(ctx, context, type, width, height, unit_size, pitch, buf_id);
 
-  VA_TRACE_LOG(va_TraceCreateBuffer,
-               dpy, context, type, *pitch, height, NULL, buf_id);
-  VA_TRACE_RET(dpy, vaStatus); 
+    VA_TRACE_LOG(va_TraceCreateBuffer,
+                 dpy, context, type, *pitch, height, NULL, buf_id);
+    VA_TRACE_RET(dpy, vaStatus);
 
-  return vaStatus;
+    return vaStatus;
 }
 
-VAStatus vaBufferSetNumElements (
+VAStatus vaBufferSetNumElements(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
+    VABufferID buf_id,  /* in */
     unsigned int num_elements /* in */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
-  
-  vaStatus = ctx->vtable->vaBufferSetNumElements( ctx, buf_id, num_elements );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+
+    vaStatus = ctx->vtable->vaBufferSetNumElements(ctx, buf_id, num_elements);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
 
-VAStatus vaMapBuffer (
+VAStatus vaMapBuffer(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
-    void **pbuf 	/* out */
+    VABufferID buf_id,  /* in */
+    void **pbuf     /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  
-  VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf);
-  
-  va_status = ctx->vtable->vaMapBuffer( ctx, buf_id, pbuf );
+    VADriverContextP ctx;
+    VAStatus va_status;
 
-  VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf);
-  VA_TRACE_RET(dpy, va_status); 
-  
-  return va_status;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+
+    VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf);
+
+    va_status = ctx->vtable->vaMapBuffer(ctx, buf_id, pbuf);
+
+    VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf);
+    VA_TRACE_RET(dpy, va_status);
+
+    return va_status;
 }
 
-VAStatus vaUnmapBuffer (
+VAStatus vaUnmapBuffer(
     VADisplay dpy,
-    VABufferID buf_id	/* in */
+    VABufferID buf_id   /* in */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
 
-  vaStatus = ctx->vtable->vaUnmapBuffer( ctx, buf_id );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    vaStatus = ctx->vtable->vaUnmapBuffer(ctx, buf_id);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaDestroyBuffer (
+VAStatus vaDestroyBuffer(
     VADisplay dpy,
     VABufferID buffer_id
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
 
-  VA_TRACE_LOG(va_TraceDestroyBuffer,
-               dpy, buffer_id);
-  
-  vaStatus = ctx->vtable->vaDestroyBuffer( ctx, buffer_id );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    VA_TRACE_LOG(va_TraceDestroyBuffer,
+                 dpy, buffer_id);
+
+    vaStatus = ctx->vtable->vaDestroyBuffer(ctx, buffer_id);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaBufferInfo (
+VAStatus vaBufferInfo(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferID buf_id,		/* in */
-    VABufferType *type,		/* out */
-    unsigned int *size,		/* out */
-    unsigned int *num_elements	/* out */
+    VAContextID context,    /* in */
+    VABufferID buf_id,      /* in */
+    VABufferType *type,     /* out */
+    unsigned int *size,     /* out */
+    unsigned int *num_elements  /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
 
-  VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements);
-  
-  vaStatus = ctx->vtable->vaBufferInfo( ctx, buf_id, type, size, num_elements );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+
+    VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements);
+
+    vaStatus = ctx->vtable->vaBufferInfo(ctx, buf_id, type, size, num_elements);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
 /* Locks buffer for external API usage */
@@ -1565,290 +1559,290 @@
         vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED;
     else
         vaStatus = ctx->vtable->vaExportSurfaceHandle(ctx, surface_id,
-                                              mem_type, flags,
-                                              descriptor);
+                   mem_type, flags,
+                   descriptor);
     VA_TRACE_RET(dpy, vaStatus);
     return vaStatus;
 }
 
-VAStatus vaBeginPicture (
+VAStatus vaBeginPicture(
     VADisplay dpy,
     VAContextID context,
     VASurfaceID render_target
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status;
+    VADriverContextP ctx;
+    VAStatus va_status;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
-  
-  va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
-  VA_TRACE_RET(dpy, va_status);
-  
-  return va_status;
+    VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+
+    va_status = ctx->vtable->vaBeginPicture(ctx, context, render_target);
+    VA_TRACE_RET(dpy, va_status);
+
+    return va_status;
 }
 
-VAStatus vaRenderPicture (
+VAStatus vaRenderPicture(
     VADisplay dpy,
     VAContextID context,
     VABufferID *buffers,
     int num_buffers
 )
 {
-  VADriverContextP ctx;
-  VAStatus vaStatus = VA_STATUS_SUCCESS;
+    VADriverContextP ctx;
+    VAStatus vaStatus = VA_STATUS_SUCCESS;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+    VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
 
-  vaStatus = ctx->vtable->vaRenderPicture( ctx, context, buffers, num_buffers );
-  VA_TRACE_RET(dpy, vaStatus);
-  return vaStatus; 
+    vaStatus = ctx->vtable->vaRenderPicture(ctx, context, buffers, num_buffers);
+    VA_TRACE_RET(dpy, vaStatus);
+    return vaStatus;
 }
 
-VAStatus vaEndPicture (
+VAStatus vaEndPicture(
     VADisplay dpy,
     VAContextID context
 )
 {
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    VADriverContextP ctx;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
-  VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 0);
-  va_status = ctx->vtable->vaEndPicture( ctx, context );
-  VA_TRACE_RET(dpy, va_status);
-  /* dump surface content */
-  VA_TRACE_ALL(va_TraceEndPictureExt, dpy, context, 1);
+    VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
+    VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 0);
+    va_status = ctx->vtable->vaEndPicture(ctx, context);
+    VA_TRACE_RET(dpy, va_status);
+    /* dump surface content */
+    VA_TRACE_ALL(va_TraceEndPictureExt, dpy, context, 1);
 
-  return va_status;
+    return va_status;
 }
 
-VAStatus vaSyncSurface (
+VAStatus vaSyncSurface(
     VADisplay dpy,
     VASurfaceID render_target
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
+    VAStatus va_status;
+    VADriverContextP ctx;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaSyncSurface( ctx, render_target );
-  VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
-  VA_TRACE_RET(dpy, va_status);
+    va_status = ctx->vtable->vaSyncSurface(ctx, render_target);
+    VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
-VAStatus vaSyncSurface2 (
+VAStatus vaSyncSurface2(
     VADisplay dpy,
     VASurfaceID surface,
     uint64_t timeout_ns
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
+    VAStatus va_status;
+    VADriverContextP ctx;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  if (ctx->vtable->vaSyncSurface2)
-      va_status = ctx->vtable->vaSyncSurface2( ctx, surface, timeout_ns );
-  else
-      va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
-  VA_TRACE_LOG(va_TraceSyncSurface2, dpy, surface, timeout_ns);
-  VA_TRACE_RET(dpy, va_status);
+    if (ctx->vtable->vaSyncSurface2)
+        va_status = ctx->vtable->vaSyncSurface2(ctx, surface, timeout_ns);
+    else
+        va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
+    VA_TRACE_LOG(va_TraceSyncSurface2, dpy, surface, timeout_ns);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
-VAStatus vaQuerySurfaceStatus (
+VAStatus vaQuerySurfaceStatus(
     VADisplay dpy,
     VASurfaceID render_target,
-    VASurfaceStatus *status	/* out */
+    VASurfaceStatus *status /* out */
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VAStatus va_status;
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaQuerySurfaceStatus( ctx, render_target, status );
+    va_status = ctx->vtable->vaQuerySurfaceStatus(ctx, render_target, status);
 
-  VA_TRACE_LOG(va_TraceQuerySurfaceStatus, dpy, render_target, status);
-  VA_TRACE_RET(dpy, va_status);
+    VA_TRACE_LOG(va_TraceQuerySurfaceStatus, dpy, render_target, status);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
-VAStatus vaQuerySurfaceError (
-	VADisplay dpy,
-	VASurfaceID surface,
-	VAStatus error_status,
-	void **error_info /*out*/
+VAStatus vaQuerySurfaceError(
+    VADisplay dpy,
+    VASurfaceID surface,
+    VAStatus error_status,
+    void **error_info /*out*/
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VAStatus va_status;
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaQuerySurfaceError( ctx, surface, error_status, error_info );
+    va_status = ctx->vtable->vaQuerySurfaceError(ctx, surface, error_status, error_info);
 
-  VA_TRACE_LOG(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
-  VA_TRACE_RET(dpy, va_status); 
+    VA_TRACE_LOG(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
-VAStatus vaSyncBuffer (
+VAStatus vaSyncBuffer(
     VADisplay dpy,
     VABufferID buf_id,
     uint64_t timeout_ns
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
+    VAStatus va_status;
+    VADriverContextP ctx;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  VA_TRACE_LOG(va_TraceSyncBuffer, dpy, buf_id, timeout_ns);
+    VA_TRACE_LOG(va_TraceSyncBuffer, dpy, buf_id, timeout_ns);
 
-  if (ctx->vtable->vaSyncBuffer)
-      va_status = ctx->vtable->vaSyncBuffer( ctx, buf_id, timeout_ns );
-  else
-      va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
-  VA_TRACE_RET(dpy, va_status);
+    if (ctx->vtable->vaSyncBuffer)
+        va_status = ctx->vtable->vaSyncBuffer(ctx, buf_id, timeout_ns);
+    else
+        va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
 /* Get maximum number of image formats supported by the implementation */
-int vaMaxNumImageFormats (
+int vaMaxNumImageFormats(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  return CTX(dpy)->max_image_formats;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    return CTX(dpy)->max_image_formats;
 }
 
-VAStatus vaQueryImageFormats (
+VAStatus vaQueryImageFormats(
     VADisplay dpy,
-    VAImageFormat *format_list,	/* out */
-    int *num_formats		/* out */
+    VAImageFormat *format_list, /* out */
+    int *num_formats        /* out */
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaQueryImageFormats ( ctx, format_list, num_formats);
+    return ctx->vtable->vaQueryImageFormats(ctx, format_list, num_formats);
 }
 
-/* 
- * The width and height fields returned in the VAImage structure may get 
+/*
+ * The width and height fields returned in the VAImage structure may get
  * enlarged for some YUV formats. The size of the data buffer that needs
  * to be allocated will be given in the "data_size" field in VAImage.
  * Image data is not allocated by this function.  The client should
  * allocate the memory and fill in the VAImage structure's data field
  * after looking at "data_size" returned from the library.
  */
-VAStatus vaCreateImage (
+VAStatus vaCreateImage(
     VADisplay dpy,
     VAImageFormat *format,
     int width,
     int height,
-    VAImage *image	/* out */
+    VAImage *image  /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaCreateImage ( ctx, format, width, height, image);
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaCreateImage(ctx, format, width, height, image);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
 /*
  * Should call DestroyImage before destroying the surface it is bound to
  */
-VAStatus vaDestroyImage (
+VAStatus vaDestroyImage(
     VADisplay dpy,
     VAImageID image
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaDestroyImage ( ctx, image);
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaDestroyImage(ctx, image);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
-VAStatus vaSetImagePalette (
+VAStatus vaSetImagePalette(
     VADisplay dpy,
     VAImageID image,
     unsigned char *palette
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaSetImagePalette ( ctx, image, palette);
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaSetImagePalette(ctx, image, palette);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
 /*
  * Retrieve surface data into a VAImage
  * Image must be in a format supported by the implementation
  */
-VAStatus vaGetImage (
+VAStatus vaGetImage(
     VADisplay dpy,
     VASurfaceID surface,
-    int x,	/* coordinates of the upper left source pixel */
+    int x,  /* coordinates of the upper left source pixel */
     int y,
     unsigned int width, /* width and height of the region */
     unsigned int height,
     VAImageID image
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaGetImage ( ctx, surface, x, y, width, height, image);
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaGetImage(ctx, surface, x, y, width, height, image);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
 /*
  * Copy data from a VAImage to a surface
  * Image must be in a format supported by the implementation
  */
-VAStatus vaPutImage (
+VAStatus vaPutImage(
     VADisplay dpy,
     VASurfaceID surface,
     VAImageID image,
@@ -1862,14 +1856,14 @@
     unsigned int dest_height
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaPutImage(ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
 /*
@@ -1903,98 +1897,98 @@
  * image and image buffer structures will be destroyed; however, the underlying
  * surface will remain unchanged until freed with vaDestroySurfaces.
  */
-VAStatus vaDeriveImage (
+VAStatus vaDeriveImage(
     VADisplay dpy,
     VASurfaceID surface,
-    VAImage *image	/* out */
+    VAImage *image  /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaDeriveImage ( ctx, surface, image );
-  VA_TRACE_RET(dpy, va_status);
-  return va_status;
+    va_status = ctx->vtable->vaDeriveImage(ctx, surface, image);
+    VA_TRACE_RET(dpy, va_status);
+    return va_status;
 }
 
 
 /* Get maximum number of subpicture formats supported by the implementation */
-int vaMaxNumSubpictureFormats (
+int vaMaxNumSubpictureFormats(
     VADisplay dpy
 )
 {
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  return CTX(dpy)->max_subpic_formats;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    return CTX(dpy)->max_subpic_formats;
 }
 
-/* 
- * Query supported subpicture formats 
+/*
+ * Query supported subpicture formats
  * The caller must provide a "format_list" array that can hold at
- * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag 
- * for each format to indicate additional capabilities for that format. The actual 
+ * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
+ * for each format to indicate additional capabilities for that format. The actual
  * number of formats returned in "format_list" is returned in "num_formats".
  */
-VAStatus vaQuerySubpictureFormats (
+VAStatus vaQuerySubpictureFormats(
     VADisplay dpy,
-    VAImageFormat *format_list,	/* out */
-    unsigned int *flags,	/* out */
-    unsigned int *num_formats	/* out */
+    VAImageFormat *format_list, /* out */
+    unsigned int *flags,    /* out */
+    unsigned int *num_formats   /* out */
 )
 {
-  VADriverContextP ctx;
+    VADriverContextP ctx;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
+    return ctx->vtable->vaQuerySubpictureFormats(ctx, format_list, flags, num_formats);
 }
 
-/* 
- * Subpictures are created with an image associated. 
+/*
+ * Subpictures are created with an image associated.
  */
-VAStatus vaCreateSubpicture (
+VAStatus vaCreateSubpicture(
     VADisplay dpy,
     VAImageID image,
-    VASubpictureID *subpicture	/* out */
+    VASubpictureID *subpicture  /* out */
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaCreateSubpicture ( ctx, image, subpicture );
+    return ctx->vtable->vaCreateSubpicture(ctx, image, subpicture);
 }
 
 /*
  * Destroy the subpicture before destroying the image it is assocated to
  */
-VAStatus vaDestroySubpicture (
+VAStatus vaDestroySubpicture(
     VADisplay dpy,
     VASubpictureID subpicture
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaDestroySubpicture ( ctx, subpicture);
+    return ctx->vtable->vaDestroySubpicture(ctx, subpicture);
 }
 
-VAStatus vaSetSubpictureImage (
+VAStatus vaSetSubpictureImage(
     VADisplay dpy,
     VASubpictureID subpicture,
     VAImageID image
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaSetSubpictureImage ( ctx, subpicture, image);
+    return ctx->vtable->vaSetSubpictureImage(ctx, subpicture, image);
 }
 
 
@@ -2002,7 +1996,7 @@
  * If chromakey is enabled, then the area where the source value falls within
  * the chromakey [min, max] range is transparent
  */
-VAStatus vaSetSubpictureChromakey (
+VAStatus vaSetSubpictureChromakey(
     VADisplay dpy,
     VASubpictureID subpicture,
     unsigned int chromakey_min,
@@ -2010,40 +2004,40 @@
     unsigned int chromakey_mask
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
+    return ctx->vtable->vaSetSubpictureChromakey(ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask);
 }
 
 
 /*
- * Global alpha value is between 0 and 1. A value of 1 means fully opaque and 
+ * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
  * a value of 0 means fully transparent. If per-pixel alpha is also specified then
  * the overall alpha is per-pixel alpha multiplied by the global alpha
  */
-VAStatus vaSetSubpictureGlobalAlpha (
+VAStatus vaSetSubpictureGlobalAlpha(
     VADisplay dpy,
     VASubpictureID subpicture,
-    float global_alpha 
+    float global_alpha
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
+    return ctx->vtable->vaSetSubpictureGlobalAlpha(ctx, subpicture, global_alpha);
 }
 
 /*
   vaAssociateSubpicture associates the subpicture with the target_surface.
-  It defines the region mapping between the subpicture and the target 
+  It defines the region mapping between the subpicture and the target
   surface through source and destination rectangles (with the same width and height).
   Both will be displayed at the next call to vaPutSurface.  Additional
   associations before the call to vaPutSurface simply overrides the association.
 */
-VAStatus vaAssociateSubpicture (
+VAStatus vaAssociateSubpicture(
     VADisplay dpy,
     VASubpictureID subpicture,
     VASurfaceID *target_surfaces,
@@ -2063,161 +2057,161 @@
     unsigned int flags
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaAssociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags );
+    return ctx->vtable->vaAssociateSubpicture(ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags);
 }
 
 /*
  * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
  */
-VAStatus vaDeassociateSubpicture (
+VAStatus vaDeassociateSubpicture(
     VADisplay dpy,
     VASubpictureID subpicture,
     VASurfaceID *target_surfaces,
     int num_surfaces
 )
 {
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  return ctx->vtable->vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
+    return ctx->vtable->vaDeassociateSubpicture(ctx, subpicture, target_surfaces, num_surfaces);
 }
 
 
 /* Get maximum number of display attributes supported by the implementation */
-int vaMaxNumDisplayAttributes (
+int vaMaxNumDisplayAttributes(
     VADisplay dpy
 )
 {
-  int tmp;
-    
-  if (!vaDisplayIsValid(dpy))
-      return 0;
-  
-  tmp = CTX(dpy)->max_display_attributes;
+    int tmp;
 
-  VA_TRACE_LOG(va_TraceMaxNumDisplayAttributes, dpy, tmp);
-  
-  return tmp;
+    if (!vaDisplayIsValid(dpy))
+        return 0;
+
+    tmp = CTX(dpy)->max_display_attributes;
+
+    VA_TRACE_LOG(va_TraceMaxNumDisplayAttributes, dpy, tmp);
+
+    return tmp;
 }
 
-/* 
- * Query display attributes 
+/*
+ * Query display attributes
  * The caller must provide a "attr_list" array that can hold at
  * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
  * returned in "attr_list" is returned in "num_attributes".
  */
-VAStatus vaQueryDisplayAttributes (
+VAStatus vaQueryDisplayAttributes(
     VADisplay dpy,
-    VADisplayAttribute *attr_list,	/* out */
-    int *num_attributes			/* out */
+    VADisplayAttribute *attr_list,  /* out */
+    int *num_attributes         /* out */
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status;
-  
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  va_status = ctx->vtable->vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
+    VADriverContextP ctx;
+    VAStatus va_status;
 
-  VA_TRACE_LOG(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
-  VA_TRACE_RET(dpy, va_status); 
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+    va_status = ctx->vtable->vaQueryDisplayAttributes(ctx, attr_list, num_attributes);
 
-  return va_status;
-  
+    VA_TRACE_LOG(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
+    VA_TRACE_RET(dpy, va_status);
+
+    return va_status;
+
 }
 
-/* 
- * Get display attributes 
+/*
+ * Get display attributes
  * This function returns the current attribute values in "attr_list".
  * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
- * from vaQueryDisplayAttributes() can have their values retrieved.  
+ * from vaQueryDisplayAttributes() can have their values retrieved.
  */
-VAStatus vaGetDisplayAttributes (
+VAStatus vaGetDisplayAttributes(
     VADisplay dpy,
-    VADisplayAttribute *attr_list,	/* in/out */
+    VADisplayAttribute *attr_list,  /* in/out */
     int num_attributes
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status;
+    VADriverContextP ctx;
+    VAStatus va_status;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  va_status = ctx->vtable->vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+    va_status = ctx->vtable->vaGetDisplayAttributes(ctx, attr_list, num_attributes);
 
-  VA_TRACE_LOG(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
-  VA_TRACE_RET(dpy, va_status); 
-  
-  return va_status;
+    VA_TRACE_LOG(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
+    VA_TRACE_RET(dpy, va_status);
+
+    return va_status;
 }
 
-/* 
- * Set display attributes 
+/*
+ * Set display attributes
  * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
- * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or 
+ * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or
  * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
  */
-VAStatus vaSetDisplayAttributes (
+VAStatus vaSetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
 )
 {
-  VADriverContextP ctx;
-  VAStatus va_status;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
-  VA_TRACE_LOG(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
-  VA_TRACE_RET(dpy, va_status); 
-  
-  return va_status;
+    va_status = ctx->vtable->vaSetDisplayAttributes(ctx, attr_list, num_attributes);
+    VA_TRACE_LOG(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
+    VA_TRACE_RET(dpy, va_status);
+
+    return va_status;
 }
 
 VAStatus vaLockSurface(VADisplay dpy,
-    VASurfaceID surface,
-    unsigned int *fourcc, /* following are output argument */
-    unsigned int *luma_stride,
-    unsigned int *chroma_u_stride,
-    unsigned int *chroma_v_stride,
-    unsigned int *luma_offset,
-    unsigned int *chroma_u_offset,
-    unsigned int *chroma_v_offset,
-    unsigned int *buffer_name,
-    void **buffer 
-)
+                       VASurfaceID surface,
+                       unsigned int *fourcc, /* following are output argument */
+                       unsigned int *luma_stride,
+                       unsigned int *chroma_u_stride,
+                       unsigned int *chroma_v_stride,
+                       unsigned int *luma_offset,
+                       unsigned int *chroma_u_offset,
+                       unsigned int *chroma_v_offset,
+                       unsigned int *buffer_name,
+                       void **buffer
+                      )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaLockSurface( ctx, surface, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, buffer_name, buffer);
-  VA_TRACE_RET(dpy, va_status);
+    va_status = ctx->vtable->vaLockSurface(ctx, surface, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, buffer_name, buffer);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
 
 VAStatus vaUnlockSurface(VADisplay dpy,
-    VASurfaceID surface
-)
+                         VASurfaceID surface
+                        )
 {
-  VADriverContextP ctx;
-  VAStatus va_status = VA_STATUS_SUCCESS;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VADriverContextP ctx;
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  va_status = ctx->vtable->vaUnlockSurface( ctx, surface );
-  VA_TRACE_RET(dpy, va_status);
+    va_status = ctx->vtable->vaUnlockSurface(ctx, surface);
+    VA_TRACE_RET(dpy, va_status);
 
-  return va_status;
+    return va_status;
 }
 
 /* Video Processing */
@@ -2308,16 +2302,16 @@
     VACopyOption      option
 )
 {
-  VAStatus va_status;
-  VADriverContextP ctx;
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
+    VAStatus va_status;
+    VADriverContextP ctx;
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
 
-  if(ctx->vtable->vaCopy  == NULL)
-      va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
-  else
-      va_status = ctx->vtable->vaCopy( ctx, dst, src, option);
-  return va_status;
+    if (ctx->vtable->vaCopy  == NULL)
+        va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
+    else
+        va_status = ctx->vtable->vaCopy(ctx, dst, src, option);
+    return va_status;
 }
 
 /* Protected content */
diff --git a/va/va.h b/va/va.h
index 6c89173..1f4787b 100644
--- a/va/va.h
+++ b/va/va.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -36,7 +36,7 @@
  * rev 0.15 (04/20/2007 Jonathan Bian) - Overhauled buffer management
  * rev 0.16 (05/02/2007 Jonathan Bian) - Added error codes and fixed some issues with configuration
  * rev 0.17 (05/07/2007 Jonathan Bian) - Added H.264/AVC data structures for slice level decode.
- * rev 0.18 (05/14/2007 Jonathan Bian) - Added data structures for MPEG-4 slice level decode 
+ * rev 0.18 (05/14/2007 Jonathan Bian) - Added data structures for MPEG-4 slice level decode
  *                                       and MPEG-2 motion compensation.
  * rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data.
  * rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure.
@@ -47,7 +47,7 @@
  * rev 0.25 (10/18/2007 Jonathan Bian) - Changed to use IDs only for some types.
  * rev 0.26 (11/07/2007 Waldo Bastian) - Change vaCreateBuffer semantics
  * rev 0.27 (11/19/2007 Matt Sottek)   - Added DeriveImage
- * rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture 
+ * rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture
  *                                       to enable scaling
  * rev 0.29 (02/07/2008 Jonathan Bian) - VC1 parameter fixes,
  *                                       added VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED
@@ -113,12 +113,12 @@
  * VA-API is split into several modules:
  * - \ref api_core
  * - Encoder (H264, HEVC, JPEG, MPEG2, VP8, VP9)
- * 	- \ref api_enc_h264
- * 	- \ref api_enc_hevc
- * 	- \ref api_enc_jpeg
- * 	- \ref api_enc_mpeg2
- * 	- \ref api_enc_vp8
- * 	- \ref api_enc_vp9
+ *  - \ref api_enc_h264
+ *  - \ref api_enc_hevc
+ *  - \ref api_enc_jpeg
+ *  - \ref api_enc_mpeg2
+ *  - \ref api_enc_vp8
+ *  - \ref api_enc_vp9
  * - Decoder (HEVC, JPEG, VP8, VP9, AV1)
  *      - \ref api_dec_hevc
  *      - \ref api_dec_jpeg
@@ -128,18 +128,18 @@
  * - \ref api_vpp
  * - \ref api_prot
  * - FEI (H264, HEVC)
- * 	- \ref api_fei
- * 	- \ref api_fei_h264
- * 	- \ref api_fei_hevc
- * 
+ *  - \ref api_fei
+ *  - \ref api_fei_h264
+ *  - \ref api_fei_hevc
+ *
  * \section threading Multithreading Guide
  * All VAAPI functions implemented in libva are thread-safe. For any VAAPI
  * function that requires the implementation of a backend (e.g. hardware driver),
  * the backend must ensure that its implementation is also thread-safe. If the
  * backend implementation of a VAAPI function is not thread-safe then this should
- * be considered as a bug against the backend implementation. 
+ * be considered as a bug against the backend implementation.
  *
- * It is assumed that none of the VAAPI functions will be called from signal 
+ * It is assumed that none of the VAAPI functions will be called from signal
  * handlers.
  *
  * Thread-safety in this context means that when VAAPI is being called by multiple
@@ -150,14 +150,14 @@
  * a single VAContext from multiple threads may generate unexpected results.
  *
  * Following pseudo code illustrates a multithreaded transcoding scenario, where
- * one thread is handling the decoding operation and another thread is handling 
+ * one thread is handling the decoding operation and another thread is handling
  * the encoding operation, while synchronizing the use of a common pool of
  * surfaces.
  *
  * \code
  * // Initialization
  * dpy = vaGetDisplayDRM(fd);
- * vaInitialize(dpy, ...); 
+ * vaInitialize(dpy, ...);
  *
  * // Create surfaces required for decoding and subsequence encoding
  * vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, width, height, &surfaces[0], ...);
@@ -173,23 +173,23 @@
  *
  * // Decode thread function
  * decode() {
- *   // Find the decode entrypoint for H.264 
+ *   // Find the decode entrypoint for H.264
  *   vaQueryConfigEntrypoints(dpy, h264_profile, entrypoints, ...);
  *
  *   // Create a config for H.264 decode
  *   vaCreateConfig(dpy, h264_profile, VAEntrypointVLD, ...);
  *
  *   // Create a context for decode
- *   vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces, 
- *     num_surfaces, &decode_context); 
+ *   vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
+ *     num_surfaces, &decode_context);
  *
  *   // Decode frames in the bitstream
  *   for (;;) {
- *     // Parse one frame and decode 
- *     vaBeginPicture(dpy, decode_context, surfaces[surface_index]); 
+ *     // Parse one frame and decode
+ *     vaBeginPicture(dpy, decode_context, surfaces[surface_index]);
  *     vaRenderPicture(dpy, decode_context, buf, ...);
  *     vaEndPicture(dpy, decode_context);
- *     // Poll the decoding status and enqueue the surface in display order after 
+ *     // Poll the decoding status and enqueue the surface in display order after
  *     // decoding is complete
  *     vaQuerySurfaceStatus();
  *     enqueue(surface_queue, surface_index);
@@ -206,11 +206,11 @@
  *
  *   // Create a context for encode
  *   vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
- *     num_surfaces, &encode_context); 
+ *     num_surfaces, &encode_context);
  *
  *   // Encode frames produced by the decoder
  *   for (;;) {
- *     // Dequeue the surface enqueued by the decoder    
+ *     // Dequeue the surface enqueued by the decoder
  *     surface_index = dequeue(surface_queue);
  *     // Encode using this surface as the source
  *     vaBeginPicture(dpy, encode_context, surfaces[surface_index]);
@@ -228,17 +228,17 @@
  */
 
 /**
-Overview 
+Overview
 
 The VA API is intended to provide an interface between a video decode/encode/processing
-application (client) and a hardware accelerator (server), to off-load 
+application (client) and a hardware accelerator (server), to off-load
 video decode/encode/processing operations from the host to the hardware accelerator at various
 entry-points.
 
 The basic operation steps are:
 
 - Negotiate a mutually acceptable configuration with the server to lock
-  down profile, entrypoints, and other attributes that will not change on 
+  down profile, entrypoints, and other attributes that will not change on
   a frame-by-frame basis.
 - Create a video decode, encode or processing context which represents a
   "virtualized" hardware device
@@ -246,7 +246,7 @@
   profiles and entrypoints)
 - Pass the render buffers to the server to handle the current frame
 
-Initialization & Configuration Management 
+Initialization & Configuration Management
 
 - Find out supported profiles
 - Find out entrypoints for a given profile
@@ -255,29 +255,29 @@
 
 */
 
-typedef void* VADisplay;	/* window system dependent */
+typedef void* VADisplay;    /* window system dependent */
 
-typedef int VAStatus;	/** Return status type from functions */
+typedef int VAStatus;   /** Return status type from functions */
 /** Values for the return status */
-#define VA_STATUS_SUCCESS			0x00000000
-#define VA_STATUS_ERROR_OPERATION_FAILED	0x00000001
-#define VA_STATUS_ERROR_ALLOCATION_FAILED	0x00000002
-#define VA_STATUS_ERROR_INVALID_DISPLAY		0x00000003
-#define VA_STATUS_ERROR_INVALID_CONFIG		0x00000004
-#define VA_STATUS_ERROR_INVALID_CONTEXT		0x00000005
-#define VA_STATUS_ERROR_INVALID_SURFACE		0x00000006
-#define VA_STATUS_ERROR_INVALID_BUFFER		0x00000007
-#define VA_STATUS_ERROR_INVALID_IMAGE		0x00000008
-#define VA_STATUS_ERROR_INVALID_SUBPICTURE	0x00000009
-#define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED	0x0000000a
-#define VA_STATUS_ERROR_MAX_NUM_EXCEEDED	0x0000000b
-#define VA_STATUS_ERROR_UNSUPPORTED_PROFILE	0x0000000c
-#define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT	0x0000000d
-#define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT	0x0000000e
-#define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE	0x0000000f
-#define VA_STATUS_ERROR_SURFACE_BUSY		0x00000010
+#define VA_STATUS_SUCCESS           0x00000000
+#define VA_STATUS_ERROR_OPERATION_FAILED    0x00000001
+#define VA_STATUS_ERROR_ALLOCATION_FAILED   0x00000002
+#define VA_STATUS_ERROR_INVALID_DISPLAY     0x00000003
+#define VA_STATUS_ERROR_INVALID_CONFIG      0x00000004
+#define VA_STATUS_ERROR_INVALID_CONTEXT     0x00000005
+#define VA_STATUS_ERROR_INVALID_SURFACE     0x00000006
+#define VA_STATUS_ERROR_INVALID_BUFFER      0x00000007
+#define VA_STATUS_ERROR_INVALID_IMAGE       0x00000008
+#define VA_STATUS_ERROR_INVALID_SUBPICTURE  0x00000009
+#define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED  0x0000000a
+#define VA_STATUS_ERROR_MAX_NUM_EXCEEDED    0x0000000b
+#define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x0000000c
+#define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT  0x0000000d
+#define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT   0x0000000e
+#define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE  0x0000000f
+#define VA_STATUS_ERROR_SURFACE_BUSY        0x00000010
 #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED      0x00000011
-#define VA_STATUS_ERROR_INVALID_PARAMETER	0x00000012
+#define VA_STATUS_ERROR_INVALID_PARAMETER   0x00000012
 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
 #define VA_STATUS_ERROR_UNIMPLEMENTED           0x00000014
 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING   0x00000015
@@ -297,23 +297,23 @@
 /** \brief An invalid filter chain was supplied. */
 #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN    0x00000021
 /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */
-#define VA_STATUS_ERROR_HW_BUSY	                0x00000022
+#define VA_STATUS_ERROR_HW_BUSY                 0x00000022
 /** \brief An unsupported memory type was supplied. */
 #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
 /** \brief Indicate allocated buffer size is not enough for input or output. */
 #define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER       0x00000025
 /** \brief Indicate an operation isn't completed because time-out interval elapsed. */
 #define VA_STATUS_ERROR_TIMEDOUT                0x00000026
-#define VA_STATUS_ERROR_UNKNOWN			0xFFFFFFFF
+#define VA_STATUS_ERROR_UNKNOWN         0xFFFFFFFF
 
-/** 
- * 1. De-interlacing flags for vaPutSurface() 
+/**
+ * 1. De-interlacing flags for vaPutSurface()
  * 2. Surface sample type for input/output surface flag
  *    - Progressive: VA_FRAME_PICTURE
  *    - Interleaved: VA_TOP_FIELD_FIRST, VA_BOTTOM_FIELD_FIRST
  *    - Field: VA_TOP_FIELD, VA_BOTTOM_FIELD
 */
-#define VA_FRAME_PICTURE        0x00000000 
+#define VA_FRAME_PICTURE        0x00000000
 #define VA_TOP_FIELD            0x00000001
 #define VA_BOTTOM_FIELD         0x00000002
 #define VA_TOP_FIELD_FIRST      0x00000004
@@ -325,8 +325,8 @@
  * 2, specify the cropping info for video playback
  * 3, encoded video will blend with background color
  */
-#define VA_ENABLE_BLEND         0x00000004 /* video area blend with the constant color */ 
-    
+#define VA_ENABLE_BLEND         0x00000004 /* video area blend with the constant color */
+
 /**
  * Clears the drawable with background color.
  * for hardware overlay based implementation this flag
@@ -361,7 +361,7 @@
 #define VA_PADDING_LARGE        32
 
 /** operation options */
-/** synchronization, block call, output should be ready after execution function return*/ 
+/** synchronization, block call, output should be ready after execution function return*/
 #define VA_EXEC_SYNC              0x0
 /** asynchronization,application should call additonal sync operation to access output */
 #define VA_EXEC_ASYNC             0x1
@@ -400,8 +400,7 @@
  */
 const char *vaErrorStr(VAStatus error_status);
 
-typedef struct _VARectangle
-{
+typedef struct _VARectangle {
     int16_t x;
     int16_t y;
     uint16_t width;
@@ -436,11 +435,11 @@
 /**
  * Initialization:
  * A display must be obtained by calling vaGetDisplay() before calling
- * vaInitialize() and other functions. This connects the API to the 
+ * vaInitialize() and other functions. This connects the API to the
  * native window system.
  * For X Windows, native_dpy would be from XOpenDisplay()
  */
-typedef void* VANativeDisplay;	/* window system dependent */
+typedef void* VANativeDisplay;  /* window system dependent */
 
 int vaDisplayIsValid(VADisplay dpy);
 
@@ -449,33 +448,33 @@
  */
 VAStatus vaSetDriverName(VADisplay dpy,
                          char *driver_name
-);
+                        );
 
 /**
- * Initialize the library 
+ * Initialize the library
  */
-VAStatus vaInitialize (
+VAStatus vaInitialize(
     VADisplay dpy,
-    int *major_version,	 /* out */
-    int *minor_version 	 /* out */
+    int *major_version,  /* out */
+    int *minor_version   /* out */
 );
 
 /**
  * After this call, all library internal resources will be cleaned up
- */ 
-VAStatus vaTerminate (
+ */
+VAStatus vaTerminate(
     VADisplay dpy
 );
 
 /**
  * vaQueryVendorString returns a pointer to a zero-terminated string
- * describing some aspects of the VA implemenation on a specific    
+ * describing some aspects of the VA implemenation on a specific
  * hardware accelerator. The format of the returned string is vendor
  * specific and at the discretion of the implementer.
  * e.g. for the Intel GMA500 implementation, an example would be:
  * "Intel GMA500 - 2.0.0.32L.0005"
  */
-const char *vaQueryVendorString (
+const char *vaQueryVendorString(
     VADisplay dpy
 );
 
@@ -484,29 +483,28 @@
 /**
  * Return a function pointer given a function name in the library.
  * This allows private interfaces into the library
- */ 
-VAPrivFunc vaGetLibFunc (
+ */
+VAPrivFunc vaGetLibFunc(
     VADisplay dpy,
     const char *func
 );
 
 /** Currently defined profiles */
-typedef enum
-{
+typedef enum {
     /** \brief Profile ID used for video processing. */
     VAProfileNone                       = -1,
-    VAProfileMPEG2Simple		= 0,
-    VAProfileMPEG2Main			= 1,
-    VAProfileMPEG4Simple		= 2,
-    VAProfileMPEG4AdvancedSimple	= 3,
-    VAProfileMPEG4Main			= 4,
+    VAProfileMPEG2Simple        = 0,
+    VAProfileMPEG2Main          = 1,
+    VAProfileMPEG4Simple        = 2,
+    VAProfileMPEG4AdvancedSimple    = 3,
+    VAProfileMPEG4Main          = 4,
     VAProfileH264Baseline va_deprecated_enum = 5,
-    VAProfileH264Main			= 6,
-    VAProfileH264High			= 7,
-    VAProfileVC1Simple			= 8,
-    VAProfileVC1Main			= 9,
-    VAProfileVC1Advanced		= 10,
-    VAProfileH263Baseline		= 11,
+    VAProfileH264Main           = 6,
+    VAProfileH264High           = 7,
+    VAProfileVC1Simple          = 8,
+    VAProfileVC1Main            = 9,
+    VAProfileVC1Advanced        = 10,
+    VAProfileH263Baseline       = 11,
     VAProfileJPEGBaseline               = 12,
     VAProfileH264ConstrainedBaseline    = 13,
     VAProfileVP8Version0_3              = 14,
@@ -535,17 +533,16 @@
 } VAProfile;
 
 /**
- *  Currently defined entrypoints 
+ *  Currently defined entrypoints
  */
-typedef enum
-{
-    VAEntrypointVLD		= 1,
-    VAEntrypointIZZ		= 2,
-    VAEntrypointIDCT		= 3,
-    VAEntrypointMoComp		= 4,
-    VAEntrypointDeblocking	= 5,
-    VAEntrypointEncSlice	= 6,	/* slice level encode */
-    VAEntrypointEncPicture 	= 7,	/* pictuer encode, JPEG, etc */
+typedef enum {
+    VAEntrypointVLD     = 1,
+    VAEntrypointIZZ     = 2,
+    VAEntrypointIDCT        = 3,
+    VAEntrypointMoComp      = 4,
+    VAEntrypointDeblocking  = 5,
+    VAEntrypointEncSlice    = 6,    /* slice level encode */
+    VAEntrypointEncPicture  = 7,    /* pictuer encode, JPEG, etc */
     /*
      * For an implementation that supports a low power/high performance variant
      * for slice level encode, it can choose to expose the
@@ -554,7 +551,7 @@
      * application can query the encoding configuration attributes to find
      * out more details if this entrypoint is supported.
      */
-    VAEntrypointEncSliceLP 	= 8,
+    VAEntrypointEncSliceLP  = 8,
     VAEntrypointVideoProc       = 10,   /**< Video pre/post-processing. */
     /**
      * \brief VAEntrypointFEI
@@ -605,14 +602,13 @@
 } VAEntrypoint;
 
 /** Currently defined configuration attribute types */
-typedef enum
-{
-    VAConfigAttribRTFormat		= 0,
-    VAConfigAttribSpatialResidual	= 1,
-    VAConfigAttribSpatialClipping	= 2,
-    VAConfigAttribIntraResidual		= 3,
-    VAConfigAttribEncryption		= 4,
-    VAConfigAttribRateControl		= 5,
+typedef enum {
+    VAConfigAttribRTFormat      = 0,
+    VAConfigAttribSpatialResidual   = 1,
+    VAConfigAttribSpatialClipping   = 2,
+    VAConfigAttribIntraResidual     = 3,
+    VAConfigAttribEncryption        = 4,
+    VAConfigAttribRateControl       = 5,
 
     /** @name Attributes for decoding */
     /**@{*/
@@ -627,14 +623,14 @@
      *
      * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
      */
-    VAConfigAttribDecSliceMode		= 6,
-   /**
-     * \brief JPEG decoding attribute. Read-only.
-     *
-     * This attribute exposes a number of capabilities of the underlying
-     * JPEG implementation. The attribute value is partitioned into fields as defined in the
-     * VAConfigAttribValDecJPEG union.
-     */
+    VAConfigAttribDecSliceMode      = 6,
+    /**
+      * \brief JPEG decoding attribute. Read-only.
+      *
+      * This attribute exposes a number of capabilities of the underlying
+      * JPEG implementation. The attribute value is partitioned into fields as defined in the
+      * VAConfigAttribValDecJPEG union.
+      */
     VAConfigAttribDecJPEG             = 7,
     /**
      * \brief Decode processing support. Read/write.
@@ -668,7 +664,7 @@
      * same as “render_target” set in vaBeginPicture(), but the driver may choose
      * to ignore this parameter.
      */
-    VAConfigAttribDecProcessing		= 8,
+    VAConfigAttribDecProcessing     = 8,
     /** @name Attributes for encoding */
     /**@{*/
     /**
@@ -756,7 +752,7 @@
      * \brief JPEG encoding attribute. Read-only.
      *
      * This attribute exposes a number of capabilities of the underlying
-     * JPEG implementation. The attribute value is partitioned into fields as defined in the 
+     * JPEG implementation. The attribute value is partitioned into fields as defined in the
      * VAConfigAttribValEncJPEG union.
      */
     VAConfigAttribEncJPEG             = 20,
@@ -765,8 +761,8 @@
      *
      * This attribute conveys whether the driver supports different quality level settings
      * for encoding. A value less than or equal to 1 means that the encoder only has a single
-     * quality setting, and a value greater than 1 represents the number of quality levels 
-     * that can be configured. e.g. a value of 2 means there are two distinct quality levels. 
+     * quality setting, and a value greater than 1 represents the number of quality levels
+     * that can be configured. e.g. a value of 2 means there are two distinct quality levels.
      */
     VAConfigAttribEncQualityRange     = 21,
     /**
@@ -787,9 +783,9 @@
     /**
      * \brief Encoding skip frame attribute. Read-only.
      *
-     * This attribute conveys whether the driver supports sending skip frame parameters 
-     * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has 
-     * externally skipped frames. 
+     * This attribute conveys whether the driver supports sending skip frame parameters
+     * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has
+     * externally skipped frames.
      */
     VAConfigAttribEncSkipFrame        = 24,
     /**
@@ -835,7 +831,7 @@
      * rect encoding is supported, the ROI information is passed to the driver using
      * VAEncMiscParameterTypeDirtyRect.
      */
-     VAConfigAttribEncDirtyRect       = 28,
+    VAConfigAttribEncDirtyRect       = 28,
     /**
      * \brief Parallel Rate Control (hierachical B) attribute. Read-only.
      *
@@ -847,30 +843,30 @@
      * per layer per GOP will be passed to driver through VAEncMiscParameterParallelRateControl
      * structure.Currently three layers are defined.
      */
-     VAConfigAttribEncParallelRateControl   = 29,
-     /**
-     * \brief Dynamic Scaling Attribute. Read-only.
-     *
-     * This attribute conveys whether encoder is capable to determine dynamic frame
-     * resolutions adaptive to bandwidth utilization and processing power, etc.
-     * It is a boolean value 0 - unsupported, 1 - supported.
-     * If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status.
-     */
-     VAConfigAttribEncDynamicScaling        = 30,
-     /**
-     * \brief frame size tolerance support
-     * it indicates the tolerance of frame size
-     */
-     VAConfigAttribFrameSizeToleranceSupport = 31,
-     /**
-     * \brief Encode function type for FEI.
-     *
-     * This attribute conveys whether the driver supports different function types for encode.
-     * It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently
-     * it is for FEI entry point only.
-     * Default is VA_FEI_FUNCTION_ENC_PAK.
-     */
-     VAConfigAttribFEIFunctionType     = 32,
+    VAConfigAttribEncParallelRateControl   = 29,
+    /**
+    * \brief Dynamic Scaling Attribute. Read-only.
+    *
+    * This attribute conveys whether encoder is capable to determine dynamic frame
+    * resolutions adaptive to bandwidth utilization and processing power, etc.
+    * It is a boolean value 0 - unsupported, 1 - supported.
+    * If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status.
+    */
+    VAConfigAttribEncDynamicScaling        = 30,
+    /**
+    * \brief frame size tolerance support
+    * it indicates the tolerance of frame size
+    */
+    VAConfigAttribFrameSizeToleranceSupport = 31,
+    /**
+    * \brief Encode function type for FEI.
+    *
+    * This attribute conveys whether the driver supports different function types for encode.
+    * It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently
+    * it is for FEI entry point only.
+    * Default is VA_FEI_FUNCTION_ENC_PAK.
+    */
+    VAConfigAttribFEIFunctionType     = 32,
     /**
      * \brief Maximum number of FEI MV predictors. Read-only.
      *
@@ -887,14 +883,14 @@
      * VAConfigAttribValStats union. Currently it is for VAEntrypointStats only.
      */
     VAConfigAttribStats               = 34,
-     /**
-     * \brief Tile Support Attribute. Read-only.
-     *
-     * This attribute conveys whether encoder is capable to support tiles.
-     * If not supported, the tile related parameters sent to encoder, such as
-     * tiling structure, should be ignored. 0 - unsupported, 1 - supported.
-     */
-     VAConfigAttribEncTileSupport        = 35,
+    /**
+    * \brief Tile Support Attribute. Read-only.
+    *
+    * This attribute conveys whether encoder is capable to support tiles.
+    * If not supported, the tile related parameters sent to encoder, such as
+    * tiling structure, should be ignored. 0 - unsupported, 1 - supported.
+    */
+    VAConfigAttribEncTileSupport        = 35,
     /**
      * \brief whether accept rouding setting from application. Read-only.
      * This attribute is for encode quality, if it is report,
@@ -909,7 +905,7 @@
     VAConfigAttribQPBlockSize            = 37,
     /**
      * \brief encode max frame size attribute. Read-only
-     * attribute value \c VAConfigAttribValMaxFrameSize represent max frame size support   
+     * attribute value \c VAConfigAttribValMaxFrameSize represent max frame size support
      */
     VAConfigAttribMaxFrameSize           = 38,
     /** \brief inter frame prediction directrion attribute. Read-only.
@@ -1017,27 +1013,27 @@
 
 /* Attribute values for VAConfigAttribRTFormat. */
 
-#define VA_RT_FORMAT_YUV420	0x00000001	///< YUV 4:2:0 8-bit.
-#define VA_RT_FORMAT_YUV422	0x00000002	///< YUV 4:2:2 8-bit.
-#define VA_RT_FORMAT_YUV444	0x00000004	///< YUV 4:4:4 8-bit.
-#define VA_RT_FORMAT_YUV411	0x00000008	///< YUV 4:1:1 8-bit.
-#define VA_RT_FORMAT_YUV400	0x00000010	///< Greyscale 8-bit.
-#define VA_RT_FORMAT_YUV420_10	0x00000100	///< YUV 4:2:0 10-bit.
-#define VA_RT_FORMAT_YUV422_10	0x00000200	///< YUV 4:2:2 10-bit.
-#define VA_RT_FORMAT_YUV444_10	0x00000400	///< YUV 4:4:4 10-bit.
-#define VA_RT_FORMAT_YUV420_12	0x00001000	///< YUV 4:2:0 12-bit.
-#define VA_RT_FORMAT_YUV422_12	0x00002000	///< YUV 4:2:2 12-bit.
-#define VA_RT_FORMAT_YUV444_12	0x00004000	///< YUV 4:4:4 12-bit.
+#define VA_RT_FORMAT_YUV420 0x00000001  ///< YUV 4:2:0 8-bit.
+#define VA_RT_FORMAT_YUV422 0x00000002  ///< YUV 4:2:2 8-bit.
+#define VA_RT_FORMAT_YUV444 0x00000004  ///< YUV 4:4:4 8-bit.
+#define VA_RT_FORMAT_YUV411 0x00000008  ///< YUV 4:1:1 8-bit.
+#define VA_RT_FORMAT_YUV400 0x00000010  ///< Greyscale 8-bit.
+#define VA_RT_FORMAT_YUV420_10  0x00000100  ///< YUV 4:2:0 10-bit.
+#define VA_RT_FORMAT_YUV422_10  0x00000200  ///< YUV 4:2:2 10-bit.
+#define VA_RT_FORMAT_YUV444_10  0x00000400  ///< YUV 4:4:4 10-bit.
+#define VA_RT_FORMAT_YUV420_12  0x00001000  ///< YUV 4:2:0 12-bit.
+#define VA_RT_FORMAT_YUV422_12  0x00002000  ///< YUV 4:2:2 12-bit.
+#define VA_RT_FORMAT_YUV444_12  0x00004000  ///< YUV 4:4:4 12-bit.
 
-#define VA_RT_FORMAT_RGB16	0x00010000	///< Packed RGB, 16 bits per pixel.
-#define VA_RT_FORMAT_RGB32	0x00020000	///< Packed RGB, 32 bits per pixel, 8 bits per colour sample.
-#define VA_RT_FORMAT_RGBP	0x00100000	///< Planar RGB, 8 bits per sample.
-#define VA_RT_FORMAT_RGB32_10	0x00200000	///< Packed RGB, 32 bits per pixel, 10 bits per colour sample.
+#define VA_RT_FORMAT_RGB16  0x00010000  ///< Packed RGB, 16 bits per pixel.
+#define VA_RT_FORMAT_RGB32  0x00020000  ///< Packed RGB, 32 bits per pixel, 8 bits per colour sample.
+#define VA_RT_FORMAT_RGBP   0x00100000  ///< Planar RGB, 8 bits per sample.
+#define VA_RT_FORMAT_RGB32_10   0x00200000  ///< Packed RGB, 32 bits per pixel, 10 bits per colour sample.
 
-#define VA_RT_FORMAT_PROTECTED	0x80000000
+#define VA_RT_FORMAT_PROTECTED  0x80000000
 
-#define VA_RT_FORMAT_RGB32_10BPP	VA_RT_FORMAT_RGB32_10	///< @deprecated use VA_RT_FORMAT_RGB32_10 instead.
-#define VA_RT_FORMAT_YUV420_10BPP	VA_RT_FORMAT_YUV420_10	///< @deprecated use VA_RT_FORMAT_YUV420_10 instead.
+#define VA_RT_FORMAT_RGB32_10BPP    VA_RT_FORMAT_RGB32_10   ///< @deprecated use VA_RT_FORMAT_RGB32_10 instead.
+#define VA_RT_FORMAT_YUV420_10BPP   VA_RT_FORMAT_YUV420_10  ///< @deprecated use VA_RT_FORMAT_YUV420_10 instead.
 
 /** @name Attribute values for VAConfigAttribRateControl */
 /**@{*/
@@ -1055,7 +1051,7 @@
 #define VA_RC_VBR_CONSTRAINED           0x00000020
 /** \brief Intelligent Constant Quality. Provided an initial ICQ_quality_factor,
  *  adjusts QP at a frame and MB level based on motion to improve subjective quality. */
-#define VA_RC_ICQ			0x00000040
+#define VA_RC_ICQ           0x00000040
 /** \brief Macroblock based rate control.  Per MB control is decided
  *  internally in the encoder. It may be combined with other RC modes, except CQP. */
 #define VA_RC_MB                        0x00000080
@@ -1086,7 +1082,7 @@
  *  bits_per_second in VAEncMiscParameterRateControl is target bitrate for AVBR.
  *  Convergence is specified in the unit of frame.
  *  window_size in VAEncMiscParameterRateControl is equal to convergence for AVBR.
- *  Accuracy is in the range of [1,100], 1 means one percent, and so on. 
+ *  Accuracy is in the range of [1,100], 1 means one percent, and so on.
  *  target_percentage in VAEncMiscParameterRateControl is equal to accuracy for AVBR.
  * */
 #define VA_RC_AVBR                      0x00000800
@@ -1113,10 +1109,10 @@
 /**@{*/
 typedef union _VAConfigAttribValDecJPEG {
     struct {
-    /** \brief Set to (1 << VA_ROTATION_xxx) for supported rotation angles. */
-    uint32_t rotation : 4;
-    /** \brief Reserved for future use. */
-    uint32_t reserved : 28;
+        /** \brief Set to (1 << VA_ROTATION_xxx) for supported rotation angles. */
+        uint32_t rotation : 4;
+        /** \brief Reserved for future use. */
+        uint32_t reserved : 28;
     } bits;
     uint32_t value;
 } VAConfigAttribValDecJPEG;
@@ -1201,16 +1197,16 @@
 /** \brief Attribute value for VAConfigAttribMaxFrameSize */
 typedef union _VAConfigAttribValMaxFrameSize {
     struct {
-        /** \brief support max frame size 
+        /** \brief support max frame size
           * if max_frame_size == 1, VAEncMiscParameterTypeMaxFrameSize/VAEncMiscParameterBufferMaxFrameSize
           * could be used to set the frame size, if multiple_pass also equal 1, VAEncMiscParameterTypeMultiPassFrameSize
-          * VAEncMiscParameterBufferMultiPassFrameSize could be used to set frame size and pass information 
-          */ 
+          * VAEncMiscParameterBufferMultiPassFrameSize could be used to set frame size and pass information
+          */
         uint32_t max_frame_size : 1;
         /** \brief multiple_pass support */
         uint32_t multiple_pass  : 1;
         /** \brief reserved bits for future, must be zero*/
-        uint32_t reserved       :30;
+        uint32_t reserved       : 30;
     } bits;
     uint32_t value;
 } VAConfigAttribValMaxFrameSize;
@@ -1282,7 +1278,7 @@
 typedef union _VAConfigAttribValEncROI {
     struct {
         /** \brief The number of ROI regions supported, 0 if ROI is not supported. */
-        uint32_t num_roi_regions 		: 8;
+        uint32_t num_roi_regions        : 8;
         /**
          * \brief A flag indicates whether ROI priority is supported
          *
@@ -1294,7 +1290,7 @@
          * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP
          * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
          */
-        uint32_t roi_rc_priority_support	: 1;
+        uint32_t roi_rc_priority_support    : 1;
         /**
          * \brief A flag indicates whether ROI delta QP is supported
          *
@@ -1308,8 +1304,8 @@
          */
         uint32_t roi_rc_qp_delta_support    : 1;
         uint32_t reserved                   : 22;
-     } bits;
-     uint32_t value;
+    } bits;
+    uint32_t value;
 } VAConfigAttribValEncROI;
 
 /** \brief Attribute value for VAConfigAttribEncRateControlExt */
@@ -1366,19 +1362,19 @@
         uint32_t reserved                       : 23;
     } bits;
     uint32_t value;
-}VAConfigAttribValMultipleFrame;
+} VAConfigAttribValMultipleFrame;
 
 /** brief Attribute value VAConfigAttribValContextPriority */
-typedef union _VAConfigAttribValContextPriority{
-    struct{
+typedef union _VAConfigAttribValContextPriority {
+    struct {
         /** \brief the priority , for the Query operation (read) it represents highest priority
          * for the set operation (write), value should be [0~highest priority] , 0 is lowest priority*/
-        uint32_t priority     :16;
+        uint32_t priority     : 16;
         /** \brief reserved bits for future, must be zero*/
-        uint32_t reserved     :16;
-    }bits;
+        uint32_t reserved     : 16;
+    } bits;
     uint32_t value;
-}VAConfigAttribValContextPriority;
+} VAConfigAttribValContextPriority;
 
 /** @name Attribute values for VAConfigAttribProtectedContentCipherAlgorithm */
 /** \brief AES cipher */
@@ -1423,59 +1419,59 @@
 /**@}*/
 /**
  * if an attribute is not applicable for a given
- * profile/entrypoint pair, then set the value to the following 
+ * profile/entrypoint pair, then set the value to the following
  */
 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000
 
 /** Get maximum number of profiles supported by the implementation */
-int vaMaxNumProfiles (
+int vaMaxNumProfiles(
     VADisplay dpy
 );
 
 /** Get maximum number of entrypoints supported by the implementation */
-int vaMaxNumEntrypoints (
+int vaMaxNumEntrypoints(
     VADisplay dpy
 );
 
 /** Get maximum number of attributs supported by the implementation */
-int vaMaxNumConfigAttributes (
+int vaMaxNumConfigAttributes(
     VADisplay dpy
 );
 
 /**
- * Query supported profiles 
+ * Query supported profiles
  * The caller must provide a "profile_list" array that can hold at
  * least vaMaxNumProfile() entries. The actual number of profiles
  * returned in "profile_list" is returned in "num_profile".
  */
-VAStatus vaQueryConfigProfiles (
+VAStatus vaQueryConfigProfiles(
     VADisplay dpy,
-    VAProfile *profile_list,	/* out */
-    int *num_profiles		/* out */
+    VAProfile *profile_list,    /* out */
+    int *num_profiles       /* out */
 );
 
 /**
- * Query supported entrypoints for a given profile 
+ * Query supported entrypoints for a given profile
  * The caller must provide an "entrypoint_list" array that can hold at
- * least vaMaxNumEntrypoints() entries. The actual number of entrypoints 
+ * least vaMaxNumEntrypoints() entries. The actual number of entrypoints
  * returned in "entrypoint_list" is returned in "num_entrypoints".
  */
-VAStatus vaQueryConfigEntrypoints (
+VAStatus vaQueryConfigEntrypoints(
     VADisplay dpy,
     VAProfile profile,
-    VAEntrypoint *entrypoint_list,	/* out */
-    int *num_entrypoints		/* out */
+    VAEntrypoint *entrypoint_list,  /* out */
+    int *num_entrypoints        /* out */
 );
 
 /**
- * Get attributes for a given profile/entrypoint pair 
- * The caller must provide an "attrib_list" with all attributes to be 
- * retrieved.  Upon return, the attributes in "attrib_list" have been 
- * updated with their value.  Unknown attributes or attributes that are 
- * not supported for the given profile/entrypoint pair will have their 
+ * Get attributes for a given profile/entrypoint pair
+ * The caller must provide an "attrib_list" with all attributes to be
+ * retrieved.  Upon return, the attributes in "attrib_list" have been
+ * updated with their value.  Unknown attributes or attributes that are
+ * not supported for the given profile/entrypoint pair will have their
  * value set to VA_ATTRIB_NOT_SUPPORTED
  */
-VAStatus vaGetConfigAttributes (
+VAStatus vaGetConfigAttributes(
     VADisplay dpy,
     VAProfile profile,
     VAEntrypoint entrypoint,
@@ -1490,41 +1486,41 @@
 
 /**
  * Create a configuration for the video decode/encode/processing pipeline
- * it passes in the attribute list that specifies the attributes it cares 
- * about, with the rest taking default values.  
+ * it passes in the attribute list that specifies the attributes it cares
+ * about, with the rest taking default values.
  */
-VAStatus vaCreateConfig (
+VAStatus vaCreateConfig(
     VADisplay dpy,
-    VAProfile profile, 
-    VAEntrypoint entrypoint, 
+    VAProfile profile,
+    VAEntrypoint entrypoint,
     VAConfigAttrib *attrib_list,
     int num_attribs,
     VAConfigID *config_id /* out */
 );
 
 /**
- * Free resources associdated with a given config 
+ * Free resources associdated with a given config
  */
-VAStatus vaDestroyConfig (
+VAStatus vaDestroyConfig(
     VADisplay dpy,
     VAConfigID config_id
 );
 
 /**
- * Query all attributes for a given configuration 
+ * Query all attributes for a given configuration
  * The profile of the configuration is returned in "profile"
  * The entrypoint of the configuration is returned in "entrypoint"
- * The caller must provide an "attrib_list" array that can hold at least 
- * vaMaxNumConfigAttributes() entries. The actual number of attributes 
+ * The caller must provide an "attrib_list" array that can hold at least
+ * vaMaxNumConfigAttributes() entries. The actual number of attributes
  * returned in "attrib_list" is returned in "num_attribs"
  */
-VAStatus vaQueryConfigAttributes (
+VAStatus vaQueryConfigAttributes(
     VADisplay dpy,
-    VAConfigID config_id, 
-    VAProfile *profile, 	/* out */
-    VAEntrypoint *entrypoint, 	/* out */
+    VAConfigID config_id,
+    VAProfile *profile,     /* out */
+    VAEntrypoint *entrypoint,   /* out */
     VAConfigAttrib *attrib_list,/* out */
-    int *num_attribs 		/* out */
+    int *num_attribs        /* out */
 );
 
 
@@ -1542,7 +1538,7 @@
  * between different contexts, e.g. a surface is used as the output of a decode context
  * and the input of a video process context. Surfaces can only be destroyed after all
  * contexts using these surfaces have been destroyed.
- * 
+ *
  * Both contexts and surfaces are identified by unique IDs and its
  * implementation specific internals are kept opaque to the clients
  */
@@ -1551,8 +1547,8 @@
 
 typedef VAGenericID VASurfaceID;
 
-#define VA_INVALID_ID		0xffffffff
-#define VA_INVALID_SURFACE	VA_INVALID_ID
+#define VA_INVALID_ID       0xffffffff
+#define VA_INVALID_SURFACE  VA_INVALID_ID
 
 /** \brief Generic value types. */
 typedef enum  {
@@ -1622,7 +1618,7 @@
      * stated, the common VASurfaceAttribExternalBuffers should be used.
      */
     VASurfaceAttribExternalBufferDescriptor,
-    /** \brief Surface usage hint, gives the driver a hint of intended usage 
+    /** \brief Surface usage hint, gives the driver a hint of intended usage
      *  to optimize allocation (e.g. tiling) (int, read/write). */
     VASurfaceAttribUsageHint,
     /** \brief List of possible DRM format modifiers (pointer, write).
@@ -1646,23 +1642,23 @@
     VAGenericValue      value;
 } VASurfaceAttrib;
 
-/** 
- * @name VASurfaceAttribMemoryType values in bit fields. 
- * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for 
+/**
+ * @name VASurfaceAttribMemoryType values in bit fields.
+ * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for
  * Linux DRM, Bit 23:20 are reserved for Android. DRM and Android specific
  * types are defined in DRM and Android header files.
  */
 /**@{*/
 /** \brief VA memory type (default) is supported. */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_VA			0x00000001
+#define VA_SURFACE_ATTRIB_MEM_TYPE_VA           0x00000001
 /** \brief V4L2 buffer memory type is supported. */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2			0x00000002
+#define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2         0x00000002
 /** \brief User pointer memory type is supported. */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR		0x00000004
+#define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR     0x00000004
 /**@}*/
 
-/** 
- * \brief VASurfaceAttribExternalBuffers structure for 
+/**
+ * \brief VASurfaceAttribExternalBuffers structure for
  * the VASurfaceAttribExternalBufferDescriptor attribute.
  */
 typedef struct _VASurfaceAttribExternalBuffers {
@@ -1693,33 +1689,33 @@
 /** @name VASurfaceAttribExternalBuffers flags */
 /**@{*/
 /** \brief Enable memory tiling */
-#define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING	0x00000001
+#define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING    0x00000001
 /** \brief Memory is cacheable */
-#define VA_SURFACE_EXTBUF_DESC_CACHED		0x00000002
+#define VA_SURFACE_EXTBUF_DESC_CACHED       0x00000002
 /** \brief Memory is non-cacheable */
-#define VA_SURFACE_EXTBUF_DESC_UNCACHED		0x00000004
+#define VA_SURFACE_EXTBUF_DESC_UNCACHED     0x00000004
 /** \brief Memory is write-combined */
-#define VA_SURFACE_EXTBUF_DESC_WC		0x00000008
+#define VA_SURFACE_EXTBUF_DESC_WC       0x00000008
 /** \brief Memory is protected */
 #define VA_SURFACE_EXTBUF_DESC_PROTECTED        0x80000000
 
 /** @name VASurfaceAttribUsageHint attribute usage hint flags */
 /**@{*/
 /** \brief Surface usage not indicated. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC 	0x00000000
+#define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC    0x00000000
 /** \brief Surface used by video decoder. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER 	0x00000001
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER    0x00000001
 /** \brief Surface used by video encoder. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER 	0x00000002
+#define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER    0x00000002
 /** \brief Surface read by video post-processing. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ 	0x00000004
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ   0x00000004
 /** \brief Surface written by video post-processing. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE 	0x00000008
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE  0x00000008
 /** \brief Surface used for display. */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY 	0x00000010
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY    0x00000010
 /** \brief Surface used for export to third-party APIs, e.g. via
  *  vaExportSurfaceHandle(). */
-#define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT 	0x00000020
+#define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT     0x00000020
 
 /**@}*/
 
@@ -1786,16 +1782,16 @@
     VASurfaceAttrib    *attrib_list,
     unsigned int        num_attribs
 );
-    
+
 /**
- * vaDestroySurfaces - Destroy resources associated with surfaces. 
+ * vaDestroySurfaces - Destroy resources associated with surfaces.
  *  Surfaces can only be destroyed after all contexts using these surfaces have been
- *  destroyed.  
+ *  destroyed.
  *  dpy: display
  *  surfaces: array of surfaces to destroy
  *  num_surfaces: number of surfaces in the array to be destroyed.
  */
-VAStatus vaDestroySurfaces (
+VAStatus vaDestroySurfaces(
     VADisplay dpy,
     VASurfaceID *surfaces,
     int num_surfaces
@@ -1814,7 +1810,7 @@
  *  num_render_targets: number of render targets in the above array
  *  context: created context id upon return
  */
-VAStatus vaCreateContext (
+VAStatus vaCreateContext(
     VADisplay dpy,
     VAConfigID config_id,
     int picture_width,
@@ -1822,15 +1818,15 @@
     int flag,
     VASurfaceID *render_targets,
     int num_render_targets,
-    VAContextID *context		/* out */
+    VAContextID *context        /* out */
 );
 
 /**
- * vaDestroyContext - Destroy a context 
+ * vaDestroyContext - Destroy a context
  *  dpy: display
  *  context: context to be destroyed
  */
-VAStatus vaDestroyContext (
+VAStatus vaDestroyContext(
     VADisplay dpy,
     VAContextID context
 );
@@ -1853,7 +1849,7 @@
  *  mf_context: Multi-Frame context encapsulating all associated context
  *  for multi-frame submission.
  */
-VAStatus vaCreateMFContext (
+VAStatus vaCreateMFContext(
     VADisplay dpy,
     VAMFContextID *mf_context    /* out */
 );
@@ -1891,7 +1887,7 @@
  *  context: context being associated with Multi-Frame context.
  *  mf_context: - multi-frame context used to associate contexts for multi-frame submission.
  */
-VAStatus vaMFAddContext (
+VAStatus vaMFAddContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
@@ -1909,14 +1905,14 @@
  *  mf_context: VAMFContextID where context is added
  *  context: VAContextID to be added
  */
-VAStatus vaMFReleaseContext (
+VAStatus vaMFReleaseContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
 );
 
 /**
- * Buffers 
+ * Buffers
  * Buffers are used to pass various types of data from the
  * client to the server. The server maintains a data store
  * for each buffer created, and the client idenfies a buffer
@@ -1925,32 +1921,31 @@
 
 typedef VAGenericID VABufferID;
 
-typedef enum
-{
-    VAPictureParameterBufferType	= 0,
-    VAIQMatrixBufferType		= 1,
-    VABitPlaneBufferType		= 2,
-    VASliceGroupMapBufferType		= 3,
-    VASliceParameterBufferType		= 4,
-    VASliceDataBufferType		= 5,
-    VAMacroblockParameterBufferType	= 6,
-    VAResidualDataBufferType		= 7,
-    VADeblockingParameterBufferType	= 8,
-    VAImageBufferType			= 9,
-    VAProtectedSliceDataBufferType	= 10,
+typedef enum {
+    VAPictureParameterBufferType    = 0,
+    VAIQMatrixBufferType        = 1,
+    VABitPlaneBufferType        = 2,
+    VASliceGroupMapBufferType       = 3,
+    VASliceParameterBufferType      = 4,
+    VASliceDataBufferType       = 5,
+    VAMacroblockParameterBufferType = 6,
+    VAResidualDataBufferType        = 7,
+    VADeblockingParameterBufferType = 8,
+    VAImageBufferType           = 9,
+    VAProtectedSliceDataBufferType  = 10,
     VAQMatrixBufferType                 = 11,
     VAHuffmanTableBufferType            = 12,
     VAProbabilityBufferType             = 13,
 
-/* Following are encode buffer types */
-    VAEncCodedBufferType		= 21,
-    VAEncSequenceParameterBufferType	= 22,
-    VAEncPictureParameterBufferType	= 23,
-    VAEncSliceParameterBufferType	= 24,
+    /* Following are encode buffer types */
+    VAEncCodedBufferType        = 21,
+    VAEncSequenceParameterBufferType    = 22,
+    VAEncPictureParameterBufferType = 23,
+    VAEncSliceParameterBufferType   = 24,
     VAEncPackedHeaderParameterBufferType = 25,
     VAEncPackedHeaderDataBufferType     = 26,
-    VAEncMiscParameterBufferType	= 27,
-    VAEncMacroblockParameterBufferType	= 28,
+    VAEncMiscParameterBufferType    = 27,
+    VAEncMacroblockParameterBufferType  = 28,
     VAEncMacroblockMapBufferType        = 29,
 
     /**
@@ -1961,7 +1956,7 @@
      * #VAEncQPBufferH264 for details
      */
     VAEncQPBufferType                   = 30,
-/* Following are video processing buffer types */
+    /* Following are video processing buffer types */
     /**
      * \brief Video processing pipeline parameter buffer.
      *
@@ -2057,17 +2052,16 @@
  * backend driver should keep the parameter unchanged if there no new
  * parameter updated.
  */
-typedef struct _VAContextParameterUpdateBuffer
-{
-    union{
+typedef struct _VAContextParameterUpdateBuffer {
+    union {
         struct {
             /** \brief indicate whether context priority changed */
-            uint32_t context_priority_update :1;
+            uint32_t context_priority_update : 1;
             /** \brief Reserved bits for future use, must be zero */
-            uint32_t reserved                :31;
+            uint32_t reserved                : 31;
         } bits;
         uint32_t value;
-    }flags;
+    } flags;
     /** \brief task/context priority */
     VAConfigAttribValContextPriority context_priority;
     /** \brief Reserved bytes for future use, must be zero */
@@ -2093,69 +2087,69 @@
 
 /** \brief structure for encrypted segment info. */
 typedef struct _VAEncryptionSegmentInfo {
-  /** \brief  The offset relative to the start of the bitstream input in
-   *  bytes of the start of the segment */
-  uint32_t segment_start_offset;
-  /** \brief  The length of the segments in bytes */
-  uint32_t segment_length;
-  /** \brief  The length in bytes of the remainder of an incomplete block
-   *  from a previous segment*/
-  uint32_t partial_aes_block_size;
-  /** \brief  The length in bytes of the initial clear data */
-  uint32_t init_byte_length;
-  /** \brief  This will be AES counter for secure decode and secure encode
-   *  when numSegments equals 1, valid size is specified by
-   * \c key_blob_size */
-  uint8_t aes_cbc_iv_or_ctr[64];
-  /** \brief Reserved bytes for future use, must be zero */
-  uint32_t va_reserved[VA_PADDING_MEDIUM];
+    /** \brief  The offset relative to the start of the bitstream input in
+     *  bytes of the start of the segment */
+    uint32_t segment_start_offset;
+    /** \brief  The length of the segments in bytes */
+    uint32_t segment_length;
+    /** \brief  The length in bytes of the remainder of an incomplete block
+     *  from a previous segment*/
+    uint32_t partial_aes_block_size;
+    /** \brief  The length in bytes of the initial clear data */
+    uint32_t init_byte_length;
+    /** \brief  This will be AES counter for secure decode and secure encode
+     *  when numSegments equals 1, valid size is specified by
+     * \c key_blob_size */
+    uint8_t aes_cbc_iv_or_ctr[64];
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t va_reserved[VA_PADDING_MEDIUM];
 } VAEncryptionSegmentInfo;
 
 /** \brief Encryption parameters buffer for VAEncryptionParameterBufferType */
 typedef struct _VAEncryptionParameters {
-  /** \brief Encryption type, refer to \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR,
-   * \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC, \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR,
-   * or \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC */
-  uint32_t encryption_type;
-  /** \brief The number of sengments */
-  uint32_t num_segments;
-  /** \brief Pointer of segments */
-  VAEncryptionSegmentInfo *segment_info;
-  /** \brief The status report index reserved for CENC fullsample workload.
-   * The related structures and definitions are vendor specific.
-  */
-  uint32_t status_report_index;
-  /** \brief CENC counter length */
-  uint32_t size_of_length;
-  /** \brief Wrapped decrypt blob (Snd)kb, valid size is specified by
-   * \c key_blob_size */
-  uint8_t wrapped_decrypt_blob[64];
-  /** \brief Wrapped Key blob info (Sne)kb, valid size is specified by
-   * \c key_blob_size */
-  uint8_t wrapped_encrypt_blob[64];
-  /** \brief key blob size
-   * It could be \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or
-   * \c VA_PC_BLOCK_SIZE_256
-   */
-  uint32_t key_blob_size;
-  /** \brief Indicates the number of 16-byte BLOCKS that are encrypted in any
-   *  given encrypted region of segments.
-   *  If this value is zero:
-   *    1. All bytes in encrypted region of segments are encrypted, i.e. the
-   *       CENC or CBC1 scheme is being used
-   *    2. blocks_stripe_clear must also be zero.
-   *  If this value is non-zero, blocks_stripe_clear must also be non-zero.
-   */
-  uint32_t blocks_stripe_encrypted;
-  /** \brief Indicates the number of 16-byte BLOCKS that are clear in any given
-   *  encrypted region of segments, as defined by the CENS and CBCS schemes in
-   *  the common encryption spec.
-   *  If this value is zero, all bytes in encrypted region of segments are
-   *  encrypted, i.e. the CENC or CBC1 scheme is being used.
-   */
-  uint32_t blocks_stripe_clear;
-  /** \brief Reserved bytes for future use, must be zero */
-  uint32_t va_reserved[VA_PADDING_MEDIUM];
+    /** \brief Encryption type, refer to \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR,
+     * \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC, \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR,
+     * or \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC */
+    uint32_t encryption_type;
+    /** \brief The number of sengments */
+    uint32_t num_segments;
+    /** \brief Pointer of segments */
+    VAEncryptionSegmentInfo *segment_info;
+    /** \brief The status report index reserved for CENC fullsample workload.
+     * The related structures and definitions are vendor specific.
+    */
+    uint32_t status_report_index;
+    /** \brief CENC counter length */
+    uint32_t size_of_length;
+    /** \brief Wrapped decrypt blob (Snd)kb, valid size is specified by
+     * \c key_blob_size */
+    uint8_t wrapped_decrypt_blob[64];
+    /** \brief Wrapped Key blob info (Sne)kb, valid size is specified by
+     * \c key_blob_size */
+    uint8_t wrapped_encrypt_blob[64];
+    /** \brief key blob size
+     * It could be \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or
+     * \c VA_PC_BLOCK_SIZE_256
+     */
+    uint32_t key_blob_size;
+    /** \brief Indicates the number of 16-byte BLOCKS that are encrypted in any
+     *  given encrypted region of segments.
+     *  If this value is zero:
+     *    1. All bytes in encrypted region of segments are encrypted, i.e. the
+     *       CENC or CBC1 scheme is being used
+     *    2. blocks_stripe_clear must also be zero.
+     *  If this value is non-zero, blocks_stripe_clear must also be non-zero.
+     */
+    uint32_t blocks_stripe_encrypted;
+    /** \brief Indicates the number of 16-byte BLOCKS that are clear in any given
+     *  encrypted region of segments, as defined by the CENS and CBCS schemes in
+     *  the common encryption spec.
+     *  If this value is zero, all bytes in encrypted region of segments are
+     *  encrypted, i.e. the CENC or CBC1 scheme is being used.
+     */
+    uint32_t blocks_stripe_clear;
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t va_reserved[VA_PADDING_MEDIUM];
 } VAEncryptionParameters;
 
 /**
@@ -2220,12 +2214,11 @@
     unsigned int       *processing_rate
 );
 
-typedef enum
-{
-    VAEncMiscParameterTypeFrameRate 	= 0,
-    VAEncMiscParameterTypeRateControl  	= 1,
-    VAEncMiscParameterTypeMaxSliceSize	= 2,
-    VAEncMiscParameterTypeAIR    	= 3,
+typedef enum {
+    VAEncMiscParameterTypeFrameRate     = 0,
+    VAEncMiscParameterTypeRateControl   = 1,
+    VAEncMiscParameterTypeMaxSliceSize  = 2,
+    VAEncMiscParameterTypeAIR       = 3,
     /** \brief Buffer type used to express a maximum frame size (in bits). */
     VAEncMiscParameterTypeMaxFrameSize  = 4,
     /** \brief Buffer type used for HRD parameters. */
@@ -2268,11 +2261,11 @@
     VAEncPackedHeaderPicture    = 2,
     /** \brief Packed slice header. */
     VAEncPackedHeaderSlice      = 3,
-    /** 
-     * \brief Packed raw header. 
-     * 
-     * Packed raw data header can be used by the client to insert a header  
-     * into the bitstream data buffer at the point it is passed, the driver 
+    /**
+     * \brief Packed raw header.
+     *
+     * Packed raw data header can be used by the client to insert a header
+     * into the bitstream data buffer at the point it is passed, the driver
      * will handle the raw packed header based on "has_emulation_bytes" field
      * in the packed header parameter structure.
      */
@@ -2305,7 +2298,7 @@
  *    VABufferID buf_id;
  *    VAEncMiscParameterBuffer *misc_param;
  *    VAEncMiscParameterRateControl *misc_rate_ctrl;
- * 
+ *
  *    vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType,
  *              sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRateControl),
  *              1, NULL, &buf_id);
@@ -2317,15 +2310,13 @@
  *    vaUnmapBuffer(dpy, buf_id);
  *    vaRenderPicture(dpy, context, &buf_id, 1);
  */
-typedef struct _VAEncMiscParameterBuffer
-{
+typedef struct _VAEncMiscParameterBuffer {
     VAEncMiscParameterType type;
     uint32_t data[];
 } VAEncMiscParameterBuffer;
 
 /** \brief Temporal layer Structure*/
-typedef struct _VAEncMiscParameterTemporalLayerStructure
-{
+typedef struct _VAEncMiscParameterTemporalLayerStructure {
     /** \brief The number of temporal layers */
     uint32_t number_of_layers;
     /** \brief The length of the array defining frame layer membership. Should be 1-32 */
@@ -2344,8 +2335,7 @@
 
 
 /** \brief Rate control parameters */
-typedef struct _VAEncMiscParameterRateControl
-{
+typedef struct _VAEncMiscParameterRateControl {
     /** The maximum bit-rate which the the rate controller should generate. */
     uint32_t bits_per_second;
     /** The target bit-rate which the rate controller should generate, as a percentage of the
@@ -2376,10 +2366,8 @@
      * Only used by some drivers - see driver documentation for details.  Set to zero if unused.
      */
     uint32_t basic_unit_size;
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** Force rate controller reset.
              *
              * The next frame will be treated as the start of a new stream, with all rate
@@ -2464,8 +2452,7 @@
  * provided in all modes using a bitrate target (variable framerate is not
  * supported).
  */
-typedef struct _VAEncMiscParameterFrameRate
-{
+typedef struct _VAEncMiscParameterFrameRate {
     /** Encode framerate.
      *
      * The framerate is specified as a number of frames per second, as a
@@ -2486,17 +2473,15 @@
      * in the low 2 bytes.
      */
     uint32_t framerate;
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** The temporal layer that these framerate parameters apply to. */
             uint32_t temporal_id : 8;
             /** Reserved for future use, must be zero. */
             uint32_t reserved : 24;
-         } bits;
-         uint32_t value;
-     } framerate_flags;
+        } bits;
+        uint32_t value;
+    } framerate_flags;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
@@ -2507,16 +2492,14 @@
  * The encoder will attempt to make sure that individual slices do not exceed this size
  * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
  */
-typedef struct _VAEncMiscParameterMaxSliceSize
-{
+typedef struct _VAEncMiscParameterMaxSliceSize {
     uint32_t max_slice_size;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterMaxSliceSize;
 
-typedef struct _VAEncMiscParameterAIR
-{
+typedef struct _VAEncMiscParameterAIR {
     uint32_t air_num_mbs;
     uint32_t air_threshold;
     uint32_t air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
@@ -2528,23 +2511,21 @@
 /*
  * \brief Rolling intra refresh data structure for encoding.
  */
-typedef struct _VAEncMiscParameterRIR
-{
-    union
-    {
+typedef struct _VAEncMiscParameterRIR {
+    union {
         struct
-	/**
-	 * \brief Indicate if intra refresh is enabled in column/row.
-	 *
-	 * App should query VAConfigAttribEncIntraRefresh to confirm RIR support
-	 * by the driver before sending this structure.
-         */
+        /**
+         * \brief Indicate if intra refresh is enabled in column/row.
+         *
+         * App should query VAConfigAttribEncIntraRefresh to confirm RIR support
+         * by the driver before sending this structure.
+             */
         {
-	    /* \brief enable RIR in column */
+            /* \brief enable RIR in column */
             uint32_t enable_rir_column : 1;
-	    /* \brief enable RIR in row */
+            /* \brief enable RIR in row */
             uint32_t enable_rir_row : 1;
-	    uint32_t reserved : 30;
+            uint32_t reserved : 30;
         } bits;
         uint32_t value;
     } rir_flags;
@@ -2575,8 +2556,7 @@
  *
  * If not provided, the encoder may use arbitrary amounts of buffering.
  */
-typedef struct _VAEncMiscParameterHRD
-{
+typedef struct _VAEncMiscParameterHRD {
     /** The initial fullness of the HRD coded picture buffer, in bits.
      *
      * This sets how full the CPB is when encoding begins - that is, how much
@@ -2648,13 +2628,13 @@
 /**
  * \brief Encoding quality level.
  *
- * The encoding quality could be set through this structure, if the implementation  
- * supports multiple quality levels. The quality level set through this structure is 
+ * The encoding quality could be set through this structure, if the implementation
+ * supports multiple quality levels. The quality level set through this structure is
  * persistent over the entire coded sequence, or until a new structure is being sent.
- * The quality level range can be queried through the VAConfigAttribEncQualityRange 
- * attribute. A lower value means higher quality, and a value of 1 represents the highest 
- * quality. The quality level setting is used as a trade-off between quality and speed/power 
- * consumption, with higher quality corresponds to lower speed and higher power consumption. 
+ * The quality level range can be queried through the VAConfigAttribEncQualityRange
+ * attribute. A lower value means higher quality, and a value of 1 represents the highest
+ * quality. The quality level setting is used as a trade-off between quality and speed/power
+ * consumption, with higher quality corresponds to lower speed and higher power consumption.
  */
 typedef struct _VAEncMiscParameterBufferQualityLevel {
     /** \brief Encoding quality level setting. When set to 0, default quality
@@ -2672,20 +2652,17 @@
  * Some encoders support special types of quantization such as trellis, and this structure
  * can be used by the app to control these special types of quantization by the encoder.
  */
-typedef struct _VAEncMiscParameterQuantization
-{
-    union
-    {
-    /* if no flags is set then quantization is determined by the driver */
-        struct
-        {
-	    /* \brief disable trellis for all frames/fields */
+typedef struct _VAEncMiscParameterQuantization {
+    union {
+        /* if no flags is set then quantization is determined by the driver */
+        struct {
+            /* \brief disable trellis for all frames/fields */
             uint32_t disable_trellis : 1;
-	    /* \brief enable trellis for I frames/fields */
+            /* \brief enable trellis for I frames/fields */
             uint32_t enable_trellis_I : 1;
-	    /* \brief enable trellis for P frames/fields */
+            /* \brief enable trellis for P frames/fields */
             uint32_t enable_trellis_P : 1;
-	    /* \brief enable trellis for B frames/fields */
+            /* \brief enable trellis for B frames/fields */
             uint32_t enable_trellis_B : 1;
             uint32_t reserved : 28;
         } bits;
@@ -2697,23 +2674,23 @@
 /**
  * \brief Encoding skip frame.
  *
- * The application may choose to skip frames externally to the encoder (e.g. drop completely or 
- * code as all skip's). For rate control purposes the encoder will need to know the size and number 
- * of skipped frames.  Skip frame(s) indicated through this structure is applicable only to the 
- * current frame.  It is allowed for the application to still send in packed headers for the driver to 
- * pack, although no frame will be encoded (e.g. for HW to encrypt the frame).  
+ * The application may choose to skip frames externally to the encoder (e.g. drop completely or
+ * code as all skip's). For rate control purposes the encoder will need to know the size and number
+ * of skipped frames.  Skip frame(s) indicated through this structure is applicable only to the
+ * current frame.  It is allowed for the application to still send in packed headers for the driver to
+ * pack, although no frame will be encoded (e.g. for HW to encrypt the frame).
  */
 typedef struct _VAEncMiscParameterSkipFrame {
     /** \brief Indicates skip frames as below.
       * 0: Encode as normal, no skip.
-      * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal.  
+      * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal.
       * 2: The current frame is to be skipped, do not encode it but pack/encrypt the packed header contents
-      *    (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame 
+      *    (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame
       *    in VAEncPackedHeaderPicture).  */
     uint8_t               skip_frame_flag;
     /** \brief The number of frames skipped prior to the current frame.  Valid when skip_frame_flag = 1. */
     uint8_t               num_skip_frames;
-    /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.   When skip_frame_flag = 2, 
+    /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.   When skip_frame_flag = 2,
       * the size of the current skipped frame that is to be packed/encrypted in bits. */
     uint32_t                size_skip_frames;
 
@@ -2730,31 +2707,30 @@
  * supported ROIs can be queried through the VAConfigAttribEncROI.  The encoder will use the
  * ROI information to adjust the QP values of the MB's that fall within the ROIs.
  */
-typedef struct _VAEncROI
-{
-        /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate
-         *  codec coding units.  It is relative to frame coordinates for the frame case and
-         *  to field coordinates for the field case. */
-        VARectangle     roi_rectangle;
-        /**
-         * \brief ROI value
-         *
-         * \ref roi_value specifies ROI delta QP or ROI priority.
-         * --  ROI delta QP is the value that will be added on top of the frame level QP.
-         * --  ROI priority specifies the priority of a region, it can be positive (more important)
-         * or negative (less important) values and is compared with non-ROI region (taken as value 0),
-         * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value
-         * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping
-         * regions, the roi_value that is first in the ROI array will have priority.
-         *
-         * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter
-         * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI.
-         *
-         * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when
-         * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta
-         * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority.
-         */
-        int8_t            roi_value;
+typedef struct _VAEncROI {
+    /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate
+     *  codec coding units.  It is relative to frame coordinates for the frame case and
+     *  to field coordinates for the field case. */
+    VARectangle     roi_rectangle;
+    /**
+     * \brief ROI value
+     *
+     * \ref roi_value specifies ROI delta QP or ROI priority.
+     * --  ROI delta QP is the value that will be added on top of the frame level QP.
+     * --  ROI priority specifies the priority of a region, it can be positive (more important)
+     * or negative (less important) values and is compared with non-ROI region (taken as value 0),
+     * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value
+     * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping
+     * regions, the roi_value that is first in the ROI array will have priority.
+     *
+     * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter
+     * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI.
+     *
+     * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when
+     * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta
+     * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority.
+     */
+    int8_t            roi_value;
 } VAEncROI;
 
 typedef struct _VAEncMiscParameterBufferROI {
@@ -2767,8 +2743,8 @@
     int8_t                max_delta_qp;
     int8_t                min_delta_qp;
 
-   /** \brief Pointer to a VAEncROI array with num_roi elements.  It is relative to frame
-     *  coordinates for the frame case and to field coordinates for the field case.*/
+    /** \brief Pointer to a VAEncROI array with num_roi elements.  It is relative to frame
+      *  coordinates for the frame case and to field coordinates for the field case.*/
     VAEncROI            *roi;
     union {
         struct {
@@ -2804,13 +2780,12 @@
  * areas not covered by dirty rect rectangles are assumed to have not changed compared to the
  * previous picture.  The encoder may do some internal optimizations.
  */
-typedef struct _VAEncMiscParameterBufferDirtyRect
-{
+typedef struct _VAEncMiscParameterBufferDirtyRect {
     /** \brief Number of Rectangle being sent.*/
     uint32_t    num_roi_rectangle;
 
     /** \brief Pointer to a VARectangle array with num_roi_rectangle elements.*/
-     VARectangle    *roi_rectangle;
+    VARectangle    *roi_rectangle;
 } VAEncMiscParameterBufferDirtyRect;
 
 /** \brief Attribute value for VAConfigAttribEncParallelRateControl */
@@ -2826,12 +2801,9 @@
 
 /** per frame encoder quality controls, once set they will persist for all future frames
   *till it is updated again. */
-typedef struct _VAEncMiscParameterEncQuality
-{
-    union
-    {
-        struct
-        {
+typedef struct _VAEncMiscParameterEncQuality {
+    union {
+        struct {
             /** Use raw frames for reference instead of reconstructed frames.
               * it only impact motion estimation (ME)  stage, and will not impact MC stage
               * so the reconstruct picture will can match with decode side */
@@ -2903,8 +2875,7 @@
  *  offset parameters for quantization.
  *  Valid when \c VAConfigAttribCustomRoundingControl equals 1.
  */
-typedef struct _VAEncMiscParameterCustomRoundingControl
-{
+typedef struct _VAEncMiscParameterCustomRoundingControl {
     union {
         struct {
             /** \brief Enable customized rounding offset for intra blocks.
@@ -2929,8 +2900,8 @@
              */
             uint32_t    rounding_offset_inter           : 7;
 
-           /* Reserved */
-            uint32_t    reserved                        :16;
+            /* Reserved */
+            uint32_t    reserved                        : 16;
         }  bits;
         uint32_t    value;
     }   rounding_offset_setting;
@@ -2940,21 +2911,20 @@
  * There will be cases where the bitstream buffer will not have enough room to hold
  * the data for the entire slice, and the following flags will be used in the slice
  * parameter to signal to the server for the possible cases.
- * If a slice parameter buffer and slice data buffer pair is sent to the server with 
- * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases below), 
- * then a slice parameter and data buffer needs to be sent again to complete this slice. 
+ * If a slice parameter buffer and slice data buffer pair is sent to the server with
+ * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases below),
+ * then a slice parameter and data buffer needs to be sent again to complete this slice.
  */
-#define VA_SLICE_DATA_FLAG_ALL		0x00	/* whole slice is in the buffer */
-#define VA_SLICE_DATA_FLAG_BEGIN	0x01	/* The beginning of the slice is in the buffer but the end if not */
-#define VA_SLICE_DATA_FLAG_MIDDLE	0x02	/* Neither beginning nor end of the slice is in the buffer */
-#define VA_SLICE_DATA_FLAG_END		0x04	/* end of the slice is in the buffer */
+#define VA_SLICE_DATA_FLAG_ALL      0x00    /* whole slice is in the buffer */
+#define VA_SLICE_DATA_FLAG_BEGIN    0x01    /* The beginning of the slice is in the buffer but the end if not */
+#define VA_SLICE_DATA_FLAG_MIDDLE   0x02    /* Neither beginning nor end of the slice is in the buffer */
+#define VA_SLICE_DATA_FLAG_END      0x04    /* end of the slice is in the buffer */
 
 /* Codec-independent Slice Parameter Buffer base */
-typedef struct _VASliceParameterBufferBase
-{
-    uint32_t slice_data_size;	/* number of bytes in the slice data buffer for this slice */
-    uint32_t slice_data_offset;	/* the offset to the first byte of slice data */
-    uint32_t slice_data_flag;	/* see VA_SLICE_DATA_FLAG_XXX definitions */
+typedef struct _VASliceParameterBufferBase {
+    uint32_t slice_data_size;   /* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_offset; /* the offset to the first byte of slice data */
+    uint32_t slice_data_flag;   /* see VA_SLICE_DATA_FLAG_XXX definitions */
 } VASliceParameterBufferBase;
 
 /**********************************
@@ -3002,14 +2972,13 @@
 /****************************
  * MPEG-2 data structures
  ****************************/
- 
+
 /* MPEG-2 Picture Parameter Buffer */
-/* 
+/*
  * For each frame or field, and before any slice data, a single
  * picture parameter buffer must be send.
  */
-typedef struct _VAPictureParameterBufferMPEG2
-{
+typedef struct _VAPictureParameterBufferMPEG2 {
     uint16_t horizontal_size;
     uint16_t vertical_size;
     VASurfaceID forward_reference_picture;
@@ -3019,17 +2988,17 @@
     int32_t f_code; /* pack all four fcode into this */
     union {
         struct {
-            uint32_t intra_dc_precision		: 2; 
-            uint32_t picture_structure		: 2; 
-            uint32_t top_field_first		: 1; 
-            uint32_t frame_pred_frame_dct		: 1; 
-            uint32_t concealment_motion_vectors	: 1;
-            uint32_t q_scale_type			: 1;
-            uint32_t intra_vlc_format		: 1;
-            uint32_t alternate_scan			: 1;
-            uint32_t repeat_first_field		: 1;
-            uint32_t progressive_frame		: 1;
-            uint32_t is_first_field			: 1; /* indicate whether the current field
+            uint32_t intra_dc_precision     : 2;
+            uint32_t picture_structure      : 2;
+            uint32_t top_field_first        : 1;
+            uint32_t frame_pred_frame_dct       : 1;
+            uint32_t concealment_motion_vectors : 1;
+            uint32_t q_scale_type           : 1;
+            uint32_t intra_vlc_format       : 1;
+            uint32_t alternate_scan         : 1;
+            uint32_t repeat_first_field     : 1;
+            uint32_t progressive_frame      : 1;
+            uint32_t is_first_field         : 1; /* indicate whether the current field
                                                               * is the first field for field picture
                                                               */
         } bits;
@@ -3041,8 +3010,7 @@
 } VAPictureParameterBufferMPEG2;
 
 /** MPEG-2 Inverse Quantization Matrix Buffer */
-typedef struct _VAIQMatrixBufferMPEG2
-{
+typedef struct _VAIQMatrixBufferMPEG2 {
     /** \brief Same as the MPEG-2 bitstream syntax element. */
     int32_t load_intra_quantiser_matrix;
     /** \brief Same as the MPEG-2 bitstream syntax element. */
@@ -3065,8 +3033,7 @@
 } VAIQMatrixBufferMPEG2;
 
 /** MPEG-2 Slice Parameter Buffer */
-typedef struct _VASliceParameterBufferMPEG2
-{
+typedef struct _VASliceParameterBufferMPEG2 {
     uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
     uint32_t slice_data_offset;/* the offset to the first byte of slice data */
     uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
@@ -3081,10 +3048,9 @@
 } VASliceParameterBufferMPEG2;
 
 /** MPEG-2 Macroblock Parameter Buffer */
-typedef struct _VAMacroblockParameterBufferMPEG2
-{
+typedef struct _VAMacroblockParameterBufferMPEG2 {
     uint16_t macroblock_address;
-    /* 
+    /*
      * macroblock_address (in raster scan order)
      * top-left: 0
      * bottom-right: picture-height-in-mb*picture-width-in-mb - 1
@@ -3092,14 +3058,14 @@
     uint8_t macroblock_type;  /* see definition below */
     union {
         struct {
-            uint32_t frame_motion_type		: 2; 
-            uint32_t field_motion_type		: 2; 
-            uint32_t dct_type			: 1; 
+            uint32_t frame_motion_type      : 2;
+            uint32_t field_motion_type      : 2;
+            uint32_t dct_type           : 1;
         } bits;
         uint32_t value;
     } macroblock_modes;
-    uint8_t motion_vertical_field_select; 
-    /* 
+    uint8_t motion_vertical_field_select;
+    /*
      * motion_vertical_field_select:
      * see section 6.3.17.2 in the spec
      * only the lower 4 bits are used
@@ -3110,11 +3076,11 @@
      */
     int16_t PMV[2][2][2]; /* see Table 7-7 in the spec */
     uint16_t coded_block_pattern;
-    /* 
-     * The bitplanes for coded_block_pattern are described 
+    /*
+     * The bitplanes for coded_block_pattern are described
      * in Figure 6.10-12 in the spec
      */
-     
+
     /* Number of skipped macroblocks after this macroblock */
     uint16_t num_skipped_macroblocks;
 
@@ -3122,48 +3088,47 @@
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAMacroblockParameterBufferMPEG2;
 
-/* 
+/*
  * OR'd flags for macroblock_type (section 6.3.17.1 in the spec)
  */
-#define VA_MB_TYPE_MOTION_FORWARD	0x02
-#define VA_MB_TYPE_MOTION_BACKWARD	0x04
-#define VA_MB_TYPE_MOTION_PATTERN	0x08
-#define VA_MB_TYPE_MOTION_INTRA		0x10
+#define VA_MB_TYPE_MOTION_FORWARD   0x02
+#define VA_MB_TYPE_MOTION_BACKWARD  0x04
+#define VA_MB_TYPE_MOTION_PATTERN   0x08
+#define VA_MB_TYPE_MOTION_INTRA     0x10
 
 /**
- * MPEG-2 Residual Data Buffer 
- * For each macroblock, there wil be 64 shorts (16-bit) in the 
+ * MPEG-2 Residual Data Buffer
+ * For each macroblock, there wil be 64 shorts (16-bit) in the
  * residual data buffer
  */
 
 /****************************
  * MPEG-4 Part 2 data structures
  ****************************/
- 
+
 /* MPEG-4 Picture Parameter Buffer */
-/* 
+/*
  * For each frame or field, and before any slice data, a single
  * picture parameter buffer must be send.
  */
-typedef struct _VAPictureParameterBufferMPEG4
-{
+typedef struct _VAPictureParameterBufferMPEG4 {
     uint16_t vop_width;
     uint16_t vop_height;
     VASurfaceID forward_reference_picture;
     VASurfaceID backward_reference_picture;
     union {
         struct {
-            uint32_t short_video_header		: 1; 
-            uint32_t chroma_format			: 2; 
-            uint32_t interlaced			: 1; 
-            uint32_t obmc_disable			: 1; 
-            uint32_t sprite_enable			: 2; 
-            uint32_t sprite_warping_accuracy	: 2; 
-            uint32_t quant_type			: 1; 
-            uint32_t quarter_sample			: 1; 
-            uint32_t data_partitioned		: 1; 
-            uint32_t reversible_vlc			: 1; 
-            uint32_t resync_marker_disable		: 1; 
+            uint32_t short_video_header     : 1;
+            uint32_t chroma_format          : 2;
+            uint32_t interlaced         : 1;
+            uint32_t obmc_disable           : 1;
+            uint32_t sprite_enable          : 2;
+            uint32_t sprite_warping_accuracy    : 2;
+            uint32_t quant_type         : 1;
+            uint32_t quarter_sample         : 1;
+            uint32_t data_partitioned       : 1;
+            uint32_t reversible_vlc         : 1;
+            uint32_t resync_marker_disable      : 1;
         } bits;
         uint32_t value;
     } vol_fields;
@@ -3173,12 +3138,12 @@
     uint8_t quant_precision;
     union {
         struct {
-            uint32_t vop_coding_type		: 2; 
-            uint32_t backward_reference_vop_coding_type	: 2; 
-            uint32_t vop_rounding_type		: 1; 
-            uint32_t intra_dc_vlc_thr		: 3; 
-            uint32_t top_field_first		: 1; 
-            uint32_t alternate_vertical_scan_flag	: 1; 
+            uint32_t vop_coding_type        : 2;
+            uint32_t backward_reference_vop_coding_type : 2;
+            uint32_t vop_rounding_type      : 1;
+            uint32_t intra_dc_vlc_thr       : 3;
+            uint32_t top_field_first        : 1;
+            uint32_t alternate_vertical_scan_flag   : 1;
         } bits;
         uint32_t value;
     } vop_fields;
@@ -3197,8 +3162,7 @@
 } VAPictureParameterBufferMPEG4;
 
 /** MPEG-4 Inverse Quantization Matrix Buffer */
-typedef struct _VAIQMatrixBufferMPEG4
-{
+typedef struct _VAIQMatrixBufferMPEG4 {
     /** Same as the MPEG-4:2 bitstream syntax element. */
     int32_t load_intra_quant_mat;
     /** Same as the MPEG-4:2 bitstream syntax element. */
@@ -3213,8 +3177,7 @@
 } VAIQMatrixBufferMPEG4;
 
 /** MPEG-4 Slice Parameter Buffer */
-typedef struct _VASliceParameterBufferMPEG4
-{
+typedef struct _VASliceParameterBufferMPEG4 {
     uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
     uint32_t slice_data_offset;/* the offset to the first byte of slice data */
     uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
@@ -3236,11 +3199,11 @@
     VAMvMode1MvHalfPel                 = 1,
     VAMvMode1MvHalfPelBilinear         = 2,
     VAMvModeMixedMv                    = 3,
-    VAMvModeIntensityCompensation      = 4 
+    VAMvModeIntensityCompensation      = 4
 } VAMvModeVC1;
 
 /** VC-1 Picture Parameter Buffer */
-/* 
+/*
  * For each picture, and before any slice data, a picture parameter
  * buffer must be send. Multiple picture parameter buffers may be
  * sent for a single picture. In that case picture parameters will
@@ -3252,85 +3215,84 @@
  *   type as defined by QUANTIZER (J.1.19) and either
  *   PQUANTIZER (7.1.1.8) or PQINDEX (7.1.1.6)
  */
-typedef struct _VAPictureParameterBufferVC1
-{
+typedef struct _VAPictureParameterBufferVC1 {
     VASurfaceID forward_reference_picture;
     VASurfaceID backward_reference_picture;
     /* if out-of-loop post-processing is done on the render
-       target, then we need to keep the in-loop decoded 
+       target, then we need to keep the in-loop decoded
        picture as a reference picture */
     VASurfaceID inloop_decoded_picture;
 
     /* sequence layer for AP or meta data for SP and MP */
     union {
         struct {
-            uint32_t pulldown	: 1; /* SEQUENCE_LAYER::PULLDOWN */
-            uint32_t interlace	: 1; /* SEQUENCE_LAYER::INTERLACE */
-            uint32_t tfcntrflag	: 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
-            uint32_t finterpflag	: 1; /* SEQUENCE_LAYER::FINTERPFLAG */
-            uint32_t psf		: 1; /* SEQUENCE_LAYER::PSF */
-            uint32_t multires	: 1; /* METADATA::MULTIRES */
-            uint32_t overlap	: 1; /* METADATA::OVERLAP */
-            uint32_t syncmarker	: 1; /* METADATA::SYNCMARKER */
-            uint32_t rangered	: 1; /* METADATA::RANGERED */
-            uint32_t max_b_frames	: 3; /* METADATA::MAXBFRAMES */
-            uint32_t profile	: 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
+            uint32_t pulldown   : 1; /* SEQUENCE_LAYER::PULLDOWN */
+            uint32_t interlace  : 1; /* SEQUENCE_LAYER::INTERLACE */
+            uint32_t tfcntrflag : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
+            uint32_t finterpflag    : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
+            uint32_t psf        : 1; /* SEQUENCE_LAYER::PSF */
+            uint32_t multires   : 1; /* METADATA::MULTIRES */
+            uint32_t overlap    : 1; /* METADATA::OVERLAP */
+            uint32_t syncmarker : 1; /* METADATA::SYNCMARKER */
+            uint32_t rangered   : 1; /* METADATA::RANGERED */
+            uint32_t max_b_frames   : 3; /* METADATA::MAXBFRAMES */
+            uint32_t profile    : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
         } bits;
         uint32_t value;
     } sequence_fields;
 
-    uint16_t coded_width;		/* ENTRY_POINT_LAYER::CODED_WIDTH */
-    uint16_t coded_height;	/* ENTRY_POINT_LAYER::CODED_HEIGHT */
-    union {
-	struct {
-            uint32_t broken_link	: 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
-            uint32_t closed_entry	: 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
-            uint32_t panscan_flag	: 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
-            uint32_t loopfilter	: 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
-	} bits;
-	uint32_t value;
-    } entrypoint_fields;
-    uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
-    uint8_t fast_uvmc_flag;	/* ENTRY_POINT_LAYER::FASTUVMC */
+    uint16_t coded_width;       /* ENTRY_POINT_LAYER::CODED_WIDTH */
+    uint16_t coded_height;  /* ENTRY_POINT_LAYER::CODED_HEIGHT */
     union {
         struct {
-            uint32_t luma_flag	: 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
-            uint32_t luma		: 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
-            uint32_t chroma_flag	: 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
-            uint32_t chroma		: 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
+            uint32_t broken_link    : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
+            uint32_t closed_entry   : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
+            uint32_t panscan_flag   : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
+            uint32_t loopfilter : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
+        } bits;
+        uint32_t value;
+    } entrypoint_fields;
+    uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
+    uint8_t fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */
+    union {
+        struct {
+            uint32_t luma_flag  : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
+            uint32_t luma       : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
+            uint32_t chroma_flag    : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
+            uint32_t chroma     : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
         } bits;
         uint32_t value;
     } range_mapping_fields;
 
-    uint8_t b_picture_fraction;	/* Index for PICTURE_LAYER::BFRACTION value in Table 40 (7.1.1.14) */
-    uint8_t cbp_table;		/* PICTURE_LAYER::CBPTAB/ICBPTAB */
-    uint8_t mb_mode_table;	/* PICTURE_LAYER::MBMODETAB */
+    uint8_t b_picture_fraction; /* Index for PICTURE_LAYER::BFRACTION value in Table 40 (7.1.1.14) */
+    uint8_t cbp_table;      /* PICTURE_LAYER::CBPTAB/ICBPTAB */
+    uint8_t mb_mode_table;  /* PICTURE_LAYER::MBMODETAB */
     uint8_t range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */
-    uint8_t rounding_control;	/* PICTURE_LAYER::RNDCTRL */
-    uint8_t post_processing;	/* PICTURE_LAYER::POSTPROC */
-    uint8_t picture_resolution_index;	/* PICTURE_LAYER::RESPIC */
-    uint8_t luma_scale;		/* PICTURE_LAYER::LUMSCALE */
-    uint8_t luma_shift;		/* PICTURE_LAYER::LUMSHIFT */
+    uint8_t rounding_control;   /* PICTURE_LAYER::RNDCTRL */
+    uint8_t post_processing;    /* PICTURE_LAYER::POSTPROC */
+    uint8_t picture_resolution_index;   /* PICTURE_LAYER::RESPIC */
+    uint8_t luma_scale;     /* PICTURE_LAYER::LUMSCALE */
+    uint8_t luma_shift;     /* PICTURE_LAYER::LUMSHIFT */
 
     union {
         struct {
-            uint32_t picture_type		: 3; /* PICTURE_LAYER::PTYPE */
-            uint32_t frame_coding_mode	: 3; /* PICTURE_LAYER::FCM */
-            uint32_t top_field_first	: 1; /* PICTURE_LAYER::TFF */
-            uint32_t is_first_field		: 1; /* set to 1 if it is the first field */
-            uint32_t intensity_compensation	: 1; /* PICTURE_LAYER::INTCOMP */
+            uint32_t picture_type       : 3; /* PICTURE_LAYER::PTYPE */
+            uint32_t frame_coding_mode  : 3; /* PICTURE_LAYER::FCM */
+            uint32_t top_field_first    : 1; /* PICTURE_LAYER::TFF */
+            uint32_t is_first_field     : 1; /* set to 1 if it is the first field */
+            uint32_t intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */
         } bits;
         uint32_t value;
     } picture_fields;
     union {
         struct {
-            uint32_t mv_type_mb	: 1; 	/* PICTURE::MVTYPEMB */
-            uint32_t direct_mb	: 1; 	/* PICTURE::DIRECTMB */
-            uint32_t skip_mb	: 1; 	/* PICTURE::SKIPMB */
-            uint32_t field_tx	: 1; 	/* PICTURE::FIELDTX */
-            uint32_t forward_mb	: 1;	/* PICTURE::FORWARDMB */
-            uint32_t ac_pred	: 1;	/* PICTURE::ACPRED */
-            uint32_t overflags	: 1;	/* PICTURE::OVERFLAGS */
+            uint32_t mv_type_mb : 1;    /* PICTURE::MVTYPEMB */
+            uint32_t direct_mb  : 1;    /* PICTURE::DIRECTMB */
+            uint32_t skip_mb    : 1;    /* PICTURE::SKIPMB */
+            uint32_t field_tx   : 1;    /* PICTURE::FIELDTX */
+            uint32_t forward_mb : 1;    /* PICTURE::FORWARDMB */
+            uint32_t ac_pred    : 1;    /* PICTURE::ACPRED */
+            uint32_t overflags  : 1;    /* PICTURE::OVERFLAGS */
         } flags;
         uint32_t value;
     } raw_coding;
@@ -3338,10 +3300,10 @@
         struct {
             uint32_t bp_mv_type_mb   : 1;    /* PICTURE::MVTYPEMB */
             uint32_t bp_direct_mb    : 1;    /* PICTURE::DIRECTMB */
-            uint32_t bp_skip_mb      : 1;    /* PICTURE::SKIPMB */  
-            uint32_t bp_field_tx     : 1;    /* PICTURE::FIELDTX */ 
+            uint32_t bp_skip_mb      : 1;    /* PICTURE::SKIPMB */
+            uint32_t bp_field_tx     : 1;    /* PICTURE::FIELDTX */
             uint32_t bp_forward_mb   : 1;    /* PICTURE::FORWARDMB */
-            uint32_t bp_ac_pred      : 1;    /* PICTURE::ACPRED */   
+            uint32_t bp_ac_pred      : 1;    /* PICTURE::ACPRED */
             uint32_t bp_overflags    : 1;    /* PICTURE::OVERFLAGS */
         } flags;
         uint32_t value;
@@ -3349,51 +3311,51 @@
     union {
         struct {
             uint32_t reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */
-            uint32_t reference_distance	: 5;/* PICTURE_LAYER::REFDIST */
+            uint32_t reference_distance : 5;/* PICTURE_LAYER::REFDIST */
             uint32_t num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */
-            uint32_t reference_field_pic_indicator	: 1;/* PICTURE_LAYER::REFFIELD */
+            uint32_t reference_field_pic_indicator  : 1;/* PICTURE_LAYER::REFFIELD */
         } bits;
         uint32_t value;
     } reference_fields;
     union {
         struct {
-            uint32_t mv_mode		: 3; /* PICTURE_LAYER::MVMODE */
-            uint32_t mv_mode2		: 3; /* PICTURE_LAYER::MVMODE2 */
-            uint32_t mv_table		: 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
+            uint32_t mv_mode        : 3; /* PICTURE_LAYER::MVMODE */
+            uint32_t mv_mode2       : 3; /* PICTURE_LAYER::MVMODE2 */
+            uint32_t mv_table       : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
             uint32_t two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */
-            uint32_t four_mv_switch		: 1; /* PICTURE_LAYER::4MVSWITCH */
+            uint32_t four_mv_switch     : 1; /* PICTURE_LAYER::4MVSWITCH */
             uint32_t four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
-            uint32_t extended_mv_flag	: 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
-            uint32_t extended_mv_range	: 2; /* PICTURE_LAYER::MVRANGE */
-            uint32_t extended_dmv_flag	: 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
-            uint32_t extended_dmv_range	: 2; /* PICTURE_LAYER::DMVRANGE */
+            uint32_t extended_mv_flag   : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
+            uint32_t extended_mv_range  : 2; /* PICTURE_LAYER::MVRANGE */
+            uint32_t extended_dmv_flag  : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
+            uint32_t extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */
         } bits;
         uint32_t value;
     } mv_fields;
     union {
         struct {
-            uint32_t dquant	: 2; 	/* ENTRY_POINT_LAYER::DQUANT */
-            uint32_t quantizer     : 2; 	/* ENTRY_POINT_LAYER::QUANTIZER */
-            uint32_t half_qp	: 1; 	/* PICTURE_LAYER::HALFQP */
+            uint32_t dquant : 2;    /* ENTRY_POINT_LAYER::DQUANT */
+            uint32_t quantizer     : 2;     /* ENTRY_POINT_LAYER::QUANTIZER */
+            uint32_t half_qp    : 1;    /* PICTURE_LAYER::HALFQP */
             uint32_t pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */
             uint32_t pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */
-            uint32_t dq_frame	: 1; 	/* VOPDQUANT::DQUANTFRM */
-            uint32_t dq_profile	: 2; 	/* VOPDQUANT::DQPROFILE */
-            uint32_t dq_sb_edge	: 2; 	/* VOPDQUANT::DQSBEDGE */
-            uint32_t dq_db_edge 	: 2; 	/* VOPDQUANT::DQDBEDGE */
-            uint32_t dq_binary_level : 1; 	/* VOPDQUANT::DQBILEVEL */
+            uint32_t dq_frame   : 1;    /* VOPDQUANT::DQUANTFRM */
+            uint32_t dq_profile : 2;    /* VOPDQUANT::DQPROFILE */
+            uint32_t dq_sb_edge : 2;    /* VOPDQUANT::DQSBEDGE */
+            uint32_t dq_db_edge     : 2;    /* VOPDQUANT::DQDBEDGE */
+            uint32_t dq_binary_level : 1;   /* VOPDQUANT::DQBILEVEL */
             uint32_t alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */
         } bits;
         uint32_t value;
     } pic_quantizer_fields;
     union {
         struct {
-            uint32_t variable_sized_transform_flag	: 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
-            uint32_t mb_level_transform_type_flag	: 1;/* PICTURE_LAYER::TTMBF */
-            uint32_t frame_level_transform_type	: 2;/* PICTURE_LAYER::TTFRM */
-            uint32_t transform_ac_codingset_idx1	: 2;/* PICTURE_LAYER::TRANSACFRM */
-            uint32_t transform_ac_codingset_idx2	: 2;/* PICTURE_LAYER::TRANSACFRM2 */
-            uint32_t intra_transform_dc_table	: 1;/* PICTURE_LAYER::TRANSDCTAB */
+            uint32_t variable_sized_transform_flag  : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
+            uint32_t mb_level_transform_type_flag   : 1;/* PICTURE_LAYER::TTMBF */
+            uint32_t frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */
+            uint32_t transform_ac_codingset_idx1    : 2;/* PICTURE_LAYER::TRANSACFRM */
+            uint32_t transform_ac_codingset_idx2    : 2;/* PICTURE_LAYER::TRANSACFRM2 */
+            uint32_t intra_transform_dc_table   : 1;/* PICTURE_LAYER::TRANSDCTAB */
         } bits;
         uint32_t value;
     } transform_fields;
@@ -3407,26 +3369,25 @@
 } VAPictureParameterBufferVC1;
 
 /** VC-1 Bitplane Buffer
-There will be at most three bitplanes coded in any picture header. To send 
+There will be at most three bitplanes coded in any picture header. To send
 the bitplane data more efficiently, each byte is divided in two nibbles, with
 each nibble carrying three bitplanes for one macroblock.  The following table
 shows the bitplane data arrangement within each nibble based on the picture
 type.
 
-Picture Type	Bit3		Bit2		Bit1		Bit0
-I or BI				OVERFLAGS	ACPRED		FIELDTX
-P				MYTYPEMB	SKIPMB		DIRECTMB
-B				FORWARDMB	SKIPMB		DIRECTMB
+Picture Type    Bit3        Bit2        Bit1        Bit0
+I or BI             OVERFLAGS   ACPRED      FIELDTX
+P               MYTYPEMB    SKIPMB      DIRECTMB
+B               FORWARDMB   SKIPMB      DIRECTMB
 
-Within each byte, the lower nibble is for the first MB and the upper nibble is 
+Within each byte, the lower nibble is for the first MB and the upper nibble is
 for the second MB.  E.g. the lower nibble of the first byte in the bitplane
-buffer is for Macroblock #1 and the upper nibble of the first byte is for 
+buffer is for Macroblock #1 and the upper nibble of the first byte is for
 Macroblock #2 in the first row.
 */
 
 /* VC-1 Slice Parameter Buffer */
-typedef struct _VASliceParameterBufferVC1
-{
+typedef struct _VASliceParameterBufferVC1 {
     uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
     uint32_t slice_data_offset;/* the offset to the first byte of slice data */
     uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
@@ -3438,16 +3399,15 @@
 } VASliceParameterBufferVC1;
 
 /* VC-1 Slice Data Buffer */
-/* 
-This is simplely a buffer containing raw bit-stream bytes 
+/*
+This is simplely a buffer containing raw bit-stream bytes
 */
 
 /****************************
  * H.264/AVC data structures
  ****************************/
 
-typedef struct _VAPictureH264
-{
+typedef struct _VAPictureH264 {
     VASurfaceID picture_id;
     uint32_t frame_idx;
     uint32_t flags;
@@ -3458,21 +3418,20 @@
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAPictureH264;
 /* flags in VAPictureH264 could be OR of the following */
-#define VA_PICTURE_H264_INVALID			0x00000001
-#define VA_PICTURE_H264_TOP_FIELD		0x00000002
-#define VA_PICTURE_H264_BOTTOM_FIELD		0x00000004
-#define VA_PICTURE_H264_SHORT_TERM_REFERENCE	0x00000008
-#define VA_PICTURE_H264_LONG_TERM_REFERENCE	0x00000010
+#define VA_PICTURE_H264_INVALID         0x00000001
+#define VA_PICTURE_H264_TOP_FIELD       0x00000002
+#define VA_PICTURE_H264_BOTTOM_FIELD        0x00000004
+#define VA_PICTURE_H264_SHORT_TERM_REFERENCE    0x00000008
+#define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010
 
 /** H.264 Picture Parameter Buffer */
-/* 
+/*
  * For each picture, and before any slice data, a single
  * picture parameter buffer must be send.
  */
-typedef struct _VAPictureParameterBufferH264
-{
+typedef struct _VAPictureParameterBufferH264 {
     VAPictureH264 CurrPic;
-    VAPictureH264 ReferenceFrames[16];	/* in DPB */
+    VAPictureH264 ReferenceFrames[16];  /* in DPB */
     uint16_t picture_width_in_mbs_minus1;
     uint16_t picture_height_in_mbs_minus1;
     uint8_t bit_depth_luma_minus8;
@@ -3480,17 +3439,17 @@
     uint8_t num_ref_frames;
     union {
         struct {
-            uint32_t chroma_format_idc			: 2; 
-            uint32_t residual_colour_transform_flag		: 1; /* Renamed to separate_colour_plane_flag in newer standard versions. */
-            uint32_t gaps_in_frame_num_value_allowed_flag	: 1; 
-            uint32_t frame_mbs_only_flag			: 1; 
-            uint32_t mb_adaptive_frame_field_flag		: 1; 
-            uint32_t direct_8x8_inference_flag		: 1; 
-            uint32_t MinLumaBiPredSize8x8			: 1; /* see A.3.3.2 */
-            uint32_t log2_max_frame_num_minus4		: 4;
-            uint32_t pic_order_cnt_type			: 2;
-            uint32_t log2_max_pic_order_cnt_lsb_minus4	: 4;
-            uint32_t delta_pic_order_always_zero_flag	: 1;
+            uint32_t chroma_format_idc          : 2;
+            uint32_t residual_colour_transform_flag     : 1; /* Renamed to separate_colour_plane_flag in newer standard versions. */
+            uint32_t gaps_in_frame_num_value_allowed_flag   : 1;
+            uint32_t frame_mbs_only_flag            : 1;
+            uint32_t mb_adaptive_frame_field_flag       : 1;
+            uint32_t direct_8x8_inference_flag      : 1;
+            uint32_t MinLumaBiPredSize8x8           : 1; /* see A.3.3.2 */
+            uint32_t log2_max_frame_num_minus4      : 4;
+            uint32_t pic_order_cnt_type         : 2;
+            uint32_t log2_max_pic_order_cnt_lsb_minus4  : 4;
+            uint32_t delta_pic_order_always_zero_flag   : 1;
         } bits;
         uint32_t value;
     } seq_fields;
@@ -3504,16 +3463,16 @@
     int8_t second_chroma_qp_index_offset;
     union {
         struct {
-            uint32_t entropy_coding_mode_flag	: 1;
-            uint32_t weighted_pred_flag		: 1;
-            uint32_t weighted_bipred_idc		: 2;
-            uint32_t transform_8x8_mode_flag	: 1;
-            uint32_t field_pic_flag			: 1;
-            uint32_t constrained_intra_pred_flag	: 1;
-            uint32_t pic_order_present_flag			: 1; /* Renamed to bottom_field_pic_order_in_frame_present_flag in newer standard versions. */
+            uint32_t entropy_coding_mode_flag   : 1;
+            uint32_t weighted_pred_flag     : 1;
+            uint32_t weighted_bipred_idc        : 2;
+            uint32_t transform_8x8_mode_flag    : 1;
+            uint32_t field_pic_flag         : 1;
+            uint32_t constrained_intra_pred_flag    : 1;
+            uint32_t pic_order_present_flag         : 1; /* Renamed to bottom_field_pic_order_in_frame_present_flag in newer standard versions. */
             uint32_t deblocking_filter_control_present_flag : 1;
-            uint32_t redundant_pic_cnt_present_flag		: 1;
-            uint32_t reference_pic_flag			: 1; /* nal_ref_idc != 0 */
+            uint32_t redundant_pic_cnt_present_flag     : 1;
+            uint32_t reference_pic_flag         : 1; /* nal_ref_idc != 0 */
         } bits;
         uint32_t value;
     } pic_fields;
@@ -3524,8 +3483,7 @@
 } VAPictureParameterBufferH264;
 
 /** H.264 Inverse Quantization Matrix Buffer */
-typedef struct _VAIQMatrixBufferH264
-{
+typedef struct _VAIQMatrixBufferH264 {
     /** \brief 4x4 scaling list, in raster scan order. */
     uint8_t ScalingList4x4[6][16];
     /** \brief 8x8 scaling list, in raster scan order. */
@@ -3536,8 +3494,7 @@
 } VAIQMatrixBufferH264;
 
 /** H.264 Slice Parameter Buffer */
-typedef struct _VASliceParameterBufferH264
-{
+typedef struct _VASliceParameterBufferH264 {
     uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
     /** \brief Byte offset to the NAL Header Unit for this slice. */
     uint32_t slice_data_offset;
@@ -3575,8 +3532,8 @@
     uint8_t disable_deblocking_filter_idc;
     int8_t slice_alpha_c0_offset_div2;
     int8_t slice_beta_offset_div2;
-    VAPictureH264 RefPicList0[32];	/* See 8.2.4.2 */
-    VAPictureH264 RefPicList1[32];	/* See 8.2.4.2 */
+    VAPictureH264 RefPicList0[32];  /* See 8.2.4.2 */
+    VAPictureH264 RefPicList1[32];  /* See 8.2.4.2 */
     uint8_t luma_log2_weight_denom;
     uint8_t chroma_log2_weight_denom;
     uint8_t luma_weight_l0_flag;
@@ -3597,13 +3554,12 @@
 } VASliceParameterBufferH264;
 
 /****************************
- * Common encode data structures 
+ * Common encode data structures
  ****************************/
-typedef enum
-{
-    VAEncPictureTypeIntra		= 0,
-    VAEncPictureTypePredictive		= 1,
-    VAEncPictureTypeBidirectional	= 2,
+typedef enum {
+    VAEncPictureTypeIntra       = 0,
+    VAEncPictureTypePredictive      = 1,
+    VAEncPictureTypeBidirectional   = 2,
 } VAEncPictureType;
 
 /**
@@ -3613,16 +3569,15 @@
  * This is a deprecated encode slice parameter buffer, All applications
  * \c can use VAEncSliceParameterBufferXXX (XXX = MPEG2, HEVC, H264, JPEG)
  */
-typedef struct _VAEncSliceParameterBuffer
-{
-    uint32_t start_row_number;	/* starting MB row number for this slice */
-    uint32_t slice_height;	/* slice height measured in MB */
+typedef struct _VAEncSliceParameterBuffer {
+    uint32_t start_row_number;  /* starting MB row number for this slice */
+    uint32_t slice_height;  /* slice height measured in MB */
     union {
         struct {
-            uint32_t is_intra	: 1;
+            uint32_t is_intra   : 1;
             uint32_t disable_deblocking_filter_idc : 2;
-            uint32_t uses_long_term_ref		:1;
-            uint32_t is_long_term_ref		:1;
+            uint32_t uses_long_term_ref     : 1;
+            uint32_t is_long_term_ref       : 1;
         } bits;
         uint32_t value;
     } slice_flags;
@@ -3636,8 +3591,7 @@
  * H.263 specific encode data structures
  ****************************/
 
-typedef struct _VAEncSequenceParameterBufferH263
-{
+typedef struct _VAEncSequenceParameterBufferH263 {
     uint32_t intra_period;
     uint32_t bits_per_second;
     uint32_t frame_rate;
@@ -3648,8 +3602,7 @@
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSequenceParameterBufferH263;
 
-typedef struct _VAEncPictureParameterBufferH263
-{
+typedef struct _VAEncPictureParameterBufferH263 {
     VASurfaceID reference_picture;
     VASurfaceID reconstructed_picture;
     VABufferID coded_buf;
@@ -3665,8 +3618,7 @@
  * MPEG-4 specific encode data structures
  ****************************/
 
-typedef struct _VAEncSequenceParameterBufferMPEG4
-{
+typedef struct _VAEncSequenceParameterBufferMPEG4 {
     uint8_t profile_and_level_indication;
     uint32_t intra_period;
     uint32_t video_object_layer_width;
@@ -3683,8 +3635,7 @@
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSequenceParameterBufferMPEG4;
 
-typedef struct _VAEncPictureParameterBufferMPEG4
-{
+typedef struct _VAEncPictureParameterBufferMPEG4 {
     VASurfaceID reference_picture;
     VASurfaceID reconstructed_picture;
     VABufferID coded_buf;
@@ -3703,28 +3654,28 @@
 /** Buffer functions */
 
 /**
- * Creates a buffer for "num_elements" elements of "size" bytes and 
+ * Creates a buffer for "num_elements" elements of "size" bytes and
  * initalize with "data".
  * if "data" is null, then the contents of the buffer data store
  * are undefined.
- * Basically there are two ways to get buffer data to the server side. One is 
+ * Basically there are two ways to get buffer data to the server side. One is
  * to call vaCreateBuffer() with a non-null "data", which results the data being
- * copied to the data store on the server side.  A different method that 
+ * copied to the data store on the server side.  A different method that
  * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(),
  * and then use vaMapBuffer() to map the data store from the server side to the
  * client address space for access.
  * The user must call vaDestroyBuffer() to destroy a buffer.
- *  Note: image buffers are created by the library, not the client. Please see 
+ *  Note: image buffers are created by the library, not the client. Please see
  *        vaCreateImage on how image buffers are managed.
  */
-VAStatus vaCreateBuffer (
+VAStatus vaCreateBuffer(
     VADisplay dpy,
     VAContextID context,
-    VABufferType type,	/* in */
-    unsigned int size,	/* in */
+    VABufferType type,  /* in */
+    unsigned int size,  /* in */
     unsigned int num_elements, /* in */
-    void *data,		/* in */
-    VABufferID *buf_id	/* out */
+    void *data,     /* in */
+    VABufferID *buf_id  /* out */
 );
 
 /**
@@ -3750,14 +3701,14 @@
 );
 
 /**
- * Convey to the server how many valid elements are in the buffer. 
+ * Convey to the server how many valid elements are in the buffer.
  * e.g. if multiple slice parameters are being held in a single buffer,
  * this will communicate to the server the number of slice parameters
  * that are valid in the buffer.
  */
-VAStatus vaBufferSetNumElements (
+VAStatus vaBufferSetNumElements(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
+    VABufferID buf_id,  /* in */
     unsigned int num_elements /* in */
 );
 
@@ -3766,7 +3717,7 @@
  * device independent data structure for codedbuffer
  */
 
-/* 
+/*
  * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame
  * LARGE_SLICE(bit8):At least one slice in the current frame was large
  *              enough for the encoder to attempt to limit its size.
@@ -3779,8 +3730,8 @@
 #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK         0xff
 #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK            0x100
 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK         0x200
-#define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW		0x400
-#define VA_CODED_BUF_STATUS_BITRATE_HIGH		0x800
+#define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW        0x400
+#define VA_CODED_BUF_STATUS_BITRATE_HIGH        0x800
 /**
  * \brief The frame has exceeded the maximum requested size.
  *
@@ -3793,35 +3744,35 @@
  * \brief the bitstream is bad or corrupt.
  */
 #define VA_CODED_BUF_STATUS_BAD_BITSTREAM               0x8000
-#define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD	0xff0000
+#define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD   0xff0000
 
 /**
  * \brief The coded buffer segment status contains frame encoding passes number
  *
  * This is the mask to get the number of encoding passes from the coded
- * buffer segment status. 
+ * buffer segment status.
  * NUMBER_PASS(bit24~bit27): the number for encoding passes executed for the coded frame.
- * 
+ *
  */
 #define VA_CODED_BUF_STATUS_NUMBER_PASSES_MASK          0xf000000
 
 /**
- * \brief The coded buffer segment contains a single NAL unit. 
+ * \brief The coded buffer segment contains a single NAL unit.
  *
  * This flag indicates that the coded buffer segment contains a
- * single NAL unit. This flag might be useful to the user for 
+ * single NAL unit. This flag might be useful to the user for
  * processing the coded buffer.
  */
-#define VA_CODED_BUF_STATUS_SINGLE_NALU                 0x10000000	
+#define VA_CODED_BUF_STATUS_SINGLE_NALU                 0x10000000
 
 /**
  * \brief Coded buffer segment.
  *
  * #VACodedBufferSegment is an element of a linked list describing
  * some information on the coded buffer. The coded buffer segment
- * could contain either a single NAL unit, or more than one NAL unit. 
- * It is recommended (but not required) to return a single NAL unit 
- * in a coded buffer segment, and the implementation should set the 
+ * could contain either a single NAL unit, or more than one NAL unit.
+ * It is recommended (but not required) to return a single NAL unit
+ * in a coded buffer segment, and the implementation should set the
  * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case.
  */
 typedef  struct _VACodedBufferSegment  {
@@ -3846,7 +3797,7 @@
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VACodedBufferSegment;
-     
+
 /**
  * Map data store of the buffer into the client's address space
  * vaCreateBuffer() needs to be called with "data" set to NULL before
@@ -3855,10 +3806,10 @@
  * if buffer type is VAEncCodedBufferType, pbuf points to link-list of
  * VACodedBufferSegment, and the list is terminated if "next" is NULL
  */
-VAStatus vaMapBuffer (
+VAStatus vaMapBuffer(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
-    void **pbuf 	/* out */
+    VABufferID buf_id,  /* in */
+    void **pbuf     /* out */
 );
 
 /**
@@ -3866,9 +3817,9 @@
  * "Unmap" it to let the server know that the data is ready to be
  * consumed by the server
  */
-VAStatus vaUnmapBuffer (
+VAStatus vaUnmapBuffer(
     VADisplay dpy,
-    VABufferID buf_id	/* in */
+    VABufferID buf_id   /* in */
 );
 
 /**
@@ -3880,7 +3831,7 @@
  * Note re-using a shared buffer (e.g. a slice data buffer) between the host and the
  * hardware accelerator can result in performance dropping.
  */
-VAStatus vaDestroyBuffer (
+VAStatus vaDestroyBuffer(
     VADisplay dpy,
     VABufferID buffer_id
 );
@@ -4067,7 +4018,7 @@
  * - encode a picture from a target surface
  * - process a picture to a target surface
  */
-VAStatus vaBeginPicture (
+VAStatus vaBeginPicture(
     VADisplay dpy,
     VAContextID context,
     VASurfaceID render_target
@@ -4076,7 +4027,7 @@
 /**
  * Send video decode, encode or processing buffers to the server.
  */
-VAStatus vaRenderPicture (
+VAStatus vaRenderPicture(
     VADisplay dpy,
     VAContextID context,
     VABufferID *buffers,
@@ -4084,14 +4035,14 @@
 );
 
 /**
- * Make the end of rendering for a picture. 
- * The server should start processing all pending operations for this 
- * surface. This call is non-blocking. The client can start another 
+ * Make the end of rendering for a picture.
+ * The server should start processing all pending operations for this
+ * surface. This call is non-blocking. The client can start another
  * Begin/Render/End sequence on a different render target.
  * if VAContextID used in this function previously successfully passed
  * vaMFAddContext call, real processing will be started during vaMFSubmit
  */
-VAStatus vaEndPicture (
+VAStatus vaEndPicture(
     VADisplay dpy,
     VAContextID context
 );
@@ -4115,7 +4066,7 @@
  * contexts: list of contexts submitting their tasks for multi-frame operation.
  * num_contexts: number of passed contexts.
  */
-VAStatus vaMFSubmit (
+VAStatus vaMFSubmit(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID * contexts,
@@ -4124,16 +4075,16 @@
 
 /*
 
-Synchronization 
+Synchronization
 
 */
 
 /**
  * This function blocks until all pending operations on the render target
- * have been completed.  Upon return it is safe to use the render target for a 
- * different picture. 
+ * have been completed.  Upon return it is safe to use the render target for a
+ * different picture.
  */
-VAStatus vaSyncSurface (
+VAStatus vaSyncSurface(
     VADisplay dpy,
     VASurfaceID render_target
 );
@@ -4161,33 +4112,31 @@
  * @param[in] timeout_ns  the timeout in nanoseconds
  *
  */
-VAStatus vaSyncSurface2 (
+VAStatus vaSyncSurface2(
     VADisplay dpy,
     VASurfaceID surface,
     uint64_t timeout_ns
 );
 
-typedef enum
-{
-    VASurfaceRendering	= 1, /* Rendering in progress */ 
-    VASurfaceDisplaying	= 2, /* Displaying in progress (not safe to render into it) */ 
-                             /* this status is useful if surface is used as the source */
-                             /* of an overlay */
-    VASurfaceReady	= 4, /* not being rendered or displayed */
-    VASurfaceSkipped	= 8  /* Indicate a skipped frame during encode */
+typedef enum {
+    VASurfaceRendering  = 1, /* Rendering in progress */
+    VASurfaceDisplaying = 2, /* Displaying in progress (not safe to render into it) */
+    /* this status is useful if surface is used as the source */
+    /* of an overlay */
+    VASurfaceReady  = 4, /* not being rendered or displayed */
+    VASurfaceSkipped    = 8  /* Indicate a skipped frame during encode */
 } VASurfaceStatus;
 
 /**
- * Find out any pending ops on the render target 
+ * Find out any pending ops on the render target
  */
-VAStatus vaQuerySurfaceStatus (
+VAStatus vaQuerySurfaceStatus(
     VADisplay dpy,
     VASurfaceID render_target,
-    VASurfaceStatus *status	/* out */
+    VASurfaceStatus *status /* out */
 );
 
-typedef enum
-{
+typedef enum {
     VADecodeSliceMissing            = 0,
     VADecodeMBError                 = 1,
 } VADecodeErrorType;
@@ -4196,8 +4145,7 @@
  * Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
  * an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
 */
-typedef struct _VASurfaceDecodeMBErrors
-{
+typedef struct _VASurfaceDecodeMBErrors {
     int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
     uint32_t start_mb; /* start mb address with errors */
     uint32_t end_mb;  /* end mb address with errors */
@@ -4264,9 +4212,9 @@
 
 /**
  * Images and Subpictures
- * VAImage is used to either get the surface data to client memory, or 
- * to copy image data in client memory to a surface. 
- * Both images, subpictures and surfaces follow the same 2D coordinate system where origin 
+ * VAImage is used to either get the surface data to client memory, or
+ * to copy image data in client memory to a surface.
+ * Both images, subpictures and surfaces follow the same 2D coordinate system where origin
  * is at the upper left corner with positive X to the right and positive Y down
  */
 #define VA_FOURCC(ch0, ch1, ch2, ch3) \
@@ -4278,48 +4226,48 @@
 /** NV12: two-plane 8-bit YUV 4:2:0.
  * The first plane contains Y, the second plane contains U and V in pairs of bytes.
  */
-#define VA_FOURCC_NV12		0x3231564E
+#define VA_FOURCC_NV12      0x3231564E
 /** NV21: two-plane 8-bit YUV 4:2:0.
  * Same as NV12, but with U and V swapped.
  */
-#define VA_FOURCC_NV21		0x3132564E
+#define VA_FOURCC_NV21      0x3132564E
 
 /** AI44: packed 4-bit YA.
  *
  * The bottom half of each byte contains luma, the top half contains alpha.
  */
-#define VA_FOURCC_AI44		0x34344149
+#define VA_FOURCC_AI44      0x34344149
 
 /** RGBA: packed 8-bit RGBA.
  *
  * Four bytes per pixel: red, green, blue, alpha.
  */
-#define VA_FOURCC_RGBA		0x41424752
+#define VA_FOURCC_RGBA      0x41424752
 /** RGBX: packed 8-bit RGB.
  *
  * Four bytes per pixel: red, green, blue, unspecified.
  */
-#define VA_FOURCC_RGBX		0x58424752
+#define VA_FOURCC_RGBX      0x58424752
 /** BGRA: packed 8-bit RGBA.
  *
  * Four bytes per pixel: blue, green, red, alpha.
  */
-#define VA_FOURCC_BGRA		0x41524742
+#define VA_FOURCC_BGRA      0x41524742
 /** BGRX: packed 8-bit RGB.
  *
  * Four bytes per pixel: blue, green, red, unspecified.
  */
-#define VA_FOURCC_BGRX		0x58524742
+#define VA_FOURCC_BGRX      0x58524742
 /** ARGB: packed 8-bit RGBA.
  *
  * Four bytes per pixel: alpha, red, green, blue.
  */
-#define VA_FOURCC_ARGB		0x42475241
+#define VA_FOURCC_ARGB      0x42475241
 /** XRGB: packed 8-bit RGB.
  *
  * Four bytes per pixel: unspecified, red, green, blue.
  */
-#define VA_FOURCC_XRGB		0x42475258
+#define VA_FOURCC_XRGB      0x42475258
 /** ABGR: packed 8-bit RGBA.
  *
  * Four bytes per pixel: alpha, blue, green, red.
@@ -4562,20 +4510,19 @@
 #define VA_FOURCC_XYUV          0x56555958
 
 /* byte order */
-#define VA_LSB_FIRST		1
-#define VA_MSB_FIRST		2
+#define VA_LSB_FIRST        1
+#define VA_MSB_FIRST        2
 
-typedef struct _VAImageFormat
-{
-    uint32_t	fourcc;
-    uint32_t	byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
-    uint32_t	bits_per_pixel;
+typedef struct _VAImageFormat {
+    uint32_t    fourcc;
+    uint32_t    byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
+    uint32_t    bits_per_pixel;
     /* for RGB formats */
-    uint32_t	depth; /* significant bits per pixel */
-    uint32_t	red_mask;
-    uint32_t	green_mask;
-    uint32_t	blue_mask;
-    uint32_t	alpha_mask;
+    uint32_t    depth; /* significant bits per pixel */
+    uint32_t    red_mask;
+    uint32_t    green_mask;
+    uint32_t    blue_mask;
+    uint32_t    alpha_mask;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
@@ -4583,40 +4530,39 @@
 
 typedef VAGenericID VAImageID;
 
-typedef struct _VAImage
-{
-    VAImageID		image_id; /* uniquely identify this image */
-    VAImageFormat	format;
-    VABufferID		buf;	/* image data buffer */
+typedef struct _VAImage {
+    VAImageID       image_id; /* uniquely identify this image */
+    VAImageFormat   format;
+    VABufferID      buf;    /* image data buffer */
     /*
      * Image data will be stored in a buffer of type VAImageBufferType to facilitate
-     * data store on the server side for optimal performance. The buffer will be 
+     * data store on the server side for optimal performance. The buffer will be
      * created by the CreateImage function, and proper storage allocated based on the image
-     * size and format. This buffer is managed by the library implementation, and 
+     * size and format. This buffer is managed by the library implementation, and
      * accessed by the client through the buffer Map/Unmap functions.
      */
-    uint16_t	width; 
-    uint16_t	height;
-    uint32_t	data_size;
-    uint32_t	num_planes;	/* can not be greater than 3 */
-    /* 
+    uint16_t    width;
+    uint16_t    height;
+    uint32_t    data_size;
+    uint32_t    num_planes; /* can not be greater than 3 */
+    /*
      * An array indicating the scanline pitch in bytes for each plane.
      * Each plane may have a different pitch. Maximum 3 planes for planar formats
      */
-    uint32_t	pitches[3];
-    /* 
-     * An array indicating the byte offset from the beginning of the image data 
+    uint32_t    pitches[3];
+    /*
+     * An array indicating the byte offset from the beginning of the image data
      * to the start of each plane.
      */
-    uint32_t	offsets[3];
+    uint32_t    offsets[3];
 
     /* The following fields are only needed for paletted formats */
     int32_t num_palette_entries;   /* set to zero for non-palette images */
-    /* 
-     * Each component is one byte and entry_bytes indicates the number of components in 
-     * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images   
+    /*
+     * Each component is one byte and entry_bytes indicates the number of components in
+     * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images
      */
-    int32_t entry_bytes; 
+    int32_t entry_bytes;
     /*
      * An array of ascii characters describing the order of the components within the bytes.
      * Only entry_bytes characters of the string are used.
@@ -4628,64 +4574,64 @@
 } VAImage;
 
 /** Get maximum number of image formats supported by the implementation */
-int vaMaxNumImageFormats (
+int vaMaxNumImageFormats(
     VADisplay dpy
 );
 
 /**
- * Query supported image formats 
+ * Query supported image formats
  * The caller must provide a "format_list" array that can hold at
  * least vaMaxNumImageFormats() entries. The actual number of formats
  * returned in "format_list" is returned in "num_formats".
  */
-VAStatus vaQueryImageFormats (
+VAStatus vaQueryImageFormats(
     VADisplay dpy,
-    VAImageFormat *format_list,	/* out */
-    int *num_formats		/* out */
+    VAImageFormat *format_list, /* out */
+    int *num_formats        /* out */
 );
 
 /**
  * Create a VAImage structure
- * The width and height fields returned in the VAImage structure may get 
- * enlarged for some YUV formats. Upon return from this function, 
- * image->buf has been created and proper storage allocated by the library. 
+ * The width and height fields returned in the VAImage structure may get
+ * enlarged for some YUV formats. Upon return from this function,
+ * image->buf has been created and proper storage allocated by the library.
  * The client can access the image through the Map/Unmap calls.
  */
-VAStatus vaCreateImage (
+VAStatus vaCreateImage(
     VADisplay dpy,
     VAImageFormat *format,
     int width,
     int height,
-    VAImage *image	/* out */
+    VAImage *image  /* out */
 );
 
 /**
  * Should call DestroyImage before destroying the surface it is bound to
  */
-VAStatus vaDestroyImage (
+VAStatus vaDestroyImage(
     VADisplay dpy,
     VAImageID image
 );
 
-VAStatus vaSetImagePalette (
+VAStatus vaSetImagePalette(
     VADisplay dpy,
     VAImageID image,
-    /* 
-     * pointer to an array holding the palette data.  The size of the array is 
-     * num_palette_entries * entry_bytes in size.  The order of the components 
-     * in the palette is described by the component_order in VAImage struct    
+    /*
+     * pointer to an array holding the palette data.  The size of the array is
+     * num_palette_entries * entry_bytes in size.  The order of the components
+     * in the palette is described by the component_order in VAImage struct
      */
-    unsigned char *palette 
+    unsigned char *palette
 );
 
 /**
  * Retrive surface data into a VAImage
  * Image must be in a format supported by the implementation
  */
-VAStatus vaGetImage (
+VAStatus vaGetImage(
     VADisplay dpy,
     VASurfaceID surface,
-    int x,	/* coordinates of the upper left source pixel */
+    int x,  /* coordinates of the upper left source pixel */
     int y,
     unsigned int width, /* width and height of the region */
     unsigned int height,
@@ -4698,7 +4644,7 @@
  * Returns a VA_STATUS_ERROR_SURFACE_BUSY if the surface
  * shouldn't be rendered into when this is called
  */
-VAStatus vaPutImage (
+VAStatus vaPutImage(
     VADisplay dpy,
     VASurfaceID surface,
     VAImageID image,
@@ -4743,71 +4689,71 @@
  * image and image buffer structures will be destroyed; however, the underlying
  * surface will remain unchanged until freed with vaDestroySurfaces.
  */
-VAStatus vaDeriveImage (
+VAStatus vaDeriveImage(
     VADisplay dpy,
     VASurfaceID surface,
-    VAImage *image	/* out */
+    VAImage *image  /* out */
 );
 
 /**
- * Subpictures 
- * Subpicture is a special type of image that can be blended 
+ * Subpictures
+ * Subpicture is a special type of image that can be blended
  * with a surface during vaPutSurface(). Subpicture can be used to render
- * DVD sub-titles or closed captioning text etc.  
+ * DVD sub-titles or closed captioning text etc.
  */
 
 typedef VAGenericID VASubpictureID;
 
 /** Get maximum number of subpicture formats supported by the implementation */
-int vaMaxNumSubpictureFormats (
+int vaMaxNumSubpictureFormats(
     VADisplay dpy
 );
 
 /** flags for subpictures */
-#define VA_SUBPICTURE_CHROMA_KEYING			0x0001
-#define VA_SUBPICTURE_GLOBAL_ALPHA			0x0002
-#define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD	0x0004
+#define VA_SUBPICTURE_CHROMA_KEYING         0x0001
+#define VA_SUBPICTURE_GLOBAL_ALPHA          0x0002
+#define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD   0x0004
 /**
- * Query supported subpicture formats 
+ * Query supported subpicture formats
  * The caller must provide a "format_list" array that can hold at
- * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag 
- * for each format to indicate additional capabilities for that format. The actual 
+ * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
+ * for each format to indicate additional capabilities for that format. The actual
  * number of formats returned in "format_list" is returned in "num_formats".
  *  flags: returned value to indicate addtional capabilities
  *         VA_SUBPICTURE_CHROMA_KEYING - supports chroma-keying
  *         VA_SUBPICTURE_GLOBAL_ALPHA - supports global alpha
- * 	   VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD - supports unscaled screen relative subpictures for On Screen Display
+ *     VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD - supports unscaled screen relative subpictures for On Screen Display
  */
 
-VAStatus vaQuerySubpictureFormats (
+VAStatus vaQuerySubpictureFormats(
     VADisplay dpy,
-    VAImageFormat *format_list,	/* out */
-    unsigned int *flags,	/* out */
-    unsigned int *num_formats	/* out */
+    VAImageFormat *format_list, /* out */
+    unsigned int *flags,    /* out */
+    unsigned int *num_formats   /* out */
 );
 
 /**
- * Subpictures are created with an image associated. 
+ * Subpictures are created with an image associated.
  */
-VAStatus vaCreateSubpicture (
+VAStatus vaCreateSubpicture(
     VADisplay dpy,
     VAImageID image,
-    VASubpictureID *subpicture	/* out */
+    VASubpictureID *subpicture  /* out */
 );
 
 /**
  * Destroy the subpicture before destroying the image it is assocated to
  */
-VAStatus vaDestroySubpicture (
+VAStatus vaDestroySubpicture(
     VADisplay dpy,
     VASubpictureID subpicture
 );
 
 /**
- * Bind an image to the subpicture. This image will now be associated with 
+ * Bind an image to the subpicture. This image will now be associated with
  * the subpicture instead of the one at creation.
  */
-VAStatus vaSetSubpictureImage (
+VAStatus vaSetSubpictureImage(
     VADisplay dpy,
     VASubpictureID subpicture,
     VAImageID image
@@ -4817,12 +4763,12 @@
  * If chromakey is enabled, then the area where the source value falls within
  * the chromakey [min, max] range is transparent
  * The chromakey component format is the following:
- *  For RGB: [0:7] Red [8:15] Blue [16:23] Green   
+ *  For RGB: [0:7] Red [8:15] Blue [16:23] Green
  *  For YUV: [0:7] V [8:15] U [16:23] Y
  * The chromakey mask can be used to mask out certain components for chromakey
  * comparision
  */
-VAStatus vaSetSubpictureChromakey (
+VAStatus vaSetSubpictureChromakey(
     VADisplay dpy,
     VASubpictureID subpicture,
     unsigned int chromakey_min,
@@ -4831,24 +4777,24 @@
 );
 
 /**
- * Global alpha value is between 0 and 1. A value of 1 means fully opaque and 
+ * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
  * a value of 0 means fully transparent. If per-pixel alpha is also specified then
  * the overall alpha is per-pixel alpha multiplied by the global alpha
  */
-VAStatus vaSetSubpictureGlobalAlpha (
+VAStatus vaSetSubpictureGlobalAlpha(
     VADisplay dpy,
     VASubpictureID subpicture,
-    float global_alpha 
+    float global_alpha
 );
 
 /**
  * vaAssociateSubpicture associates the subpicture with target_surfaces.
- * It defines the region mapping between the subpicture and the target  
+ * It defines the region mapping between the subpicture and the target
  * surfaces through source and destination rectangles (with the same width and height).
  * Both will be displayed at the next call to vaPutSurface.  Additional
  * associations before the call to vaPutSurface simply overrides the association.
  */
-VAStatus vaAssociateSubpicture (
+VAStatus vaAssociateSubpicture(
     VADisplay dpy,
     VASubpictureID subpicture,
     VASurfaceID *target_surfaces,
@@ -4871,7 +4817,7 @@
 /**
  * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
  */
-VAStatus vaDeassociateSubpicture (
+VAStatus vaDeassociateSubpicture(
     VADisplay dpy,
     VASubpictureID subpicture,
     VASurfaceID *target_surfaces,
@@ -4896,8 +4842,7 @@
  */
 
 /* PowerVR IEP Lite attributes */
-typedef enum
-{
+typedef enum {
     VADISPLAYATTRIB_BLE_OFF              = 0x00,
     VADISPLAYATTRIB_BLE_LOW,
     VADISPLAYATTRIB_BLE_MEDIUM,
@@ -4957,8 +4902,8 @@
  * is unsupport or UNKNOWN.
  */
 
-typedef union _VADisplayAttribValSubDevice{
-    struct{
+typedef union _VADisplayAttribValSubDevice {
+    struct {
         /** \brief current sub device index, read - write */
         uint32_t current_sub_device     : 4;
         /** \brief sub devices count, read - only */
@@ -4981,17 +4926,16 @@
          * \endcode
          */
         uint32_t sub_device_mask       : 16;
-    }bits;
+    } bits;
     uint32_t value;
-}VADisplayAttribValSubDevice;
+} VADisplayAttribValSubDevice;
 
 /** Currently defined display attribute types */
-typedef enum
-{
-    VADisplayAttribBrightness		= 0,
-    VADisplayAttribContrast		= 1,
-    VADisplayAttribHue			= 2,
-    VADisplayAttribSaturation		= 3,
+typedef enum {
+    VADisplayAttribBrightness       = 0,
+    VADisplayAttribContrast     = 1,
+    VADisplayAttribHue          = 2,
+    VADisplayAttribSaturation       = 3,
     /* client can specifiy a background color for the target window
      * the new feature of video conference,
      * the uncovered area of the surface is filled by this color
@@ -5000,9 +4944,9 @@
     VADisplayAttribBackgroundColor      = 4,
     /*
      * this is a gettable only attribute. For some implementations that use the
-     * hardware overlay, after PutSurface is called, the surface can not be    
-     * re-used until after the subsequent PutSurface call. If this is the case 
-     * then the value for this attribute will be set to 1 so that the client   
+     * hardware overlay, after PutSurface is called, the surface can not be
+     * re-used until after the subsequent PutSurface call. If this is the case
+     * then the value for this attribute will be set to 1 so that the client
      * will not attempt to re-use the surface right after returning from a call
      * to PutSurface.
      *
@@ -5010,7 +4954,7 @@
      * driver may use overlay or GPU alternatively
      */
     VADisplayAttribDirectSurface       = 5,
-    VADisplayAttribRotation            = 6,	
+    VADisplayAttribRotation            = 6,
     VADisplayAttribOutofLoopDeblock    = 7,
 
     /* PowerVR IEP Lite specific attributes */
@@ -5025,8 +4969,8 @@
     VADisplayAttribCSCMatrix           = 12,
     /* specify the constant color used to blend with video surface
      * Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB
-     *      d: the final color to overwrite into the frame buffer 
-     *      v: decoded video after color conversion, 
+     *      d: the final color to overwrite into the frame buffer
+     *      v: decoded video after color conversion,
      *      c: video color specified by VADisplayAttribBlendColor
      *      b: background color of the drawable
      */
@@ -5040,7 +4984,7 @@
      * customized overlay color key, the format is RGB888
      * [23:16] = Red, [15:08] = Green, [07:00] = Blue.
      */
-    VADisplayAttribOverlayColorKey	= 15,
+    VADisplayAttribOverlayColorKey  = 15,
     /*
      * The hint for the implementation of vaPutSurface
      * normally, the driver could use an overlay or GPU to render the surface on the screen
@@ -5049,7 +4993,7 @@
     VADisplayAttribRenderMode           = 16,
     /*
      * specify if vaPutSurface needs to render into specified monitors
-     * one example is that one external monitor (e.g. HDMI) is enabled, 
+     * one example is that one external monitor (e.g. HDMI) is enabled,
      * but the window manager is not aware of it, and there is no associated drawable
      */
     VADisplayAttribRenderDevice        = 17,
@@ -5070,17 +5014,16 @@
 } VADisplayAttribType;
 
 /* flags for VADisplayAttribute */
-#define VA_DISPLAY_ATTRIB_NOT_SUPPORTED	0x0000
-#define VA_DISPLAY_ATTRIB_GETTABLE	0x0001
-#define VA_DISPLAY_ATTRIB_SETTABLE	0x0002
+#define VA_DISPLAY_ATTRIB_NOT_SUPPORTED 0x0000
+#define VA_DISPLAY_ATTRIB_GETTABLE  0x0001
+#define VA_DISPLAY_ATTRIB_SETTABLE  0x0002
 
-typedef struct _VADisplayAttribute
-{
+typedef struct _VADisplayAttribute {
     VADisplayAttribType type;
     int32_t min_value;
     int32_t max_value;
-    int32_t value;	/* used by the set/get attribute functions */
-/* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
+    int32_t value;  /* used by the set/get attribute functions */
+    /* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
     uint32_t flags;
 
     /** \brief Reserved bytes for future use, must be zero */
@@ -5088,41 +5031,41 @@
 } VADisplayAttribute;
 
 /** Get maximum number of display attributs supported by the implementation */
-int vaMaxNumDisplayAttributes (
+int vaMaxNumDisplayAttributes(
     VADisplay dpy
 );
 
 /**
- * Query display attributes 
+ * Query display attributes
  * The caller must provide a "attr_list" array that can hold at
  * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
  * returned in "attr_list" is returned in "num_attributes".
  */
-VAStatus vaQueryDisplayAttributes (
+VAStatus vaQueryDisplayAttributes(
     VADisplay dpy,
-    VADisplayAttribute *attr_list,	/* out */
-    int *num_attributes			/* out */
+    VADisplayAttribute *attr_list,  /* out */
+    int *num_attributes         /* out */
 );
 
 /**
- * Get display attributes 
+ * Get display attributes
  * This function returns the current attribute values in "attr_list".
  * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
- * from vaQueryDisplayAttributes() can have their values retrieved.  
+ * from vaQueryDisplayAttributes() can have their values retrieved.
  */
-VAStatus vaGetDisplayAttributes (
+VAStatus vaGetDisplayAttributes(
     VADisplay dpy,
-    VADisplayAttribute *attr_list,	/* in/out */
+    VADisplayAttribute *attr_list,  /* in/out */
     int num_attributes
 );
 
 /**
- * Set display attributes 
+ * Set display attributes
  * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
- * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or 
+ * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or
  * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
  */
-VAStatus vaSetDisplayAttributes (
+VAStatus vaSetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
@@ -5131,22 +5074,21 @@
 /****************************
  * HEVC data structures
  ****************************/
-/** 
+/**
  * \brief Description of picture properties of those in DPB surfaces.
  *
- * If only progressive scan is supported, each surface contains one whole 
+ * If only progressive scan is supported, each surface contains one whole
  * frame picture.
  * Otherwise, each surface contains two fields of whole picture.
  * In this case, two entries of ReferenceFrames[] may share same picture_id
  * value.
  */
-typedef struct _VAPictureHEVC
-{
-    /** \brief reconstructed picture buffer surface index 
+typedef struct _VAPictureHEVC {
+    /** \brief reconstructed picture buffer surface index
      * invalid when taking value VA_INVALID_SURFACE.
      */
     VASurfaceID             picture_id;
-    /** \brief picture order count. 
+    /** \brief picture order count.
      * in HEVC, POCs for top and bottom fields of same picture should
      * take different values.
      */
@@ -5160,9 +5102,9 @@
 
 /* flags in VAPictureHEVC could be OR of the following */
 #define VA_PICTURE_HEVC_INVALID                 0x00000001
-/** \brief indication of interlace scan picture. 
+/** \brief indication of interlace scan picture.
  * should take same value for all the pictures in sequence.
- */ 
+ */
 #define VA_PICTURE_HEVC_FIELD_PIC               0x00000002
 /** \brief polarity of the field picture.
  * top field takes even lines of buffer surface.
@@ -5173,7 +5115,7 @@
 #define VA_PICTURE_HEVC_LONG_TERM_REFERENCE     0x00000008
 /**
  * VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE, VA_PICTURE_HEVC_RPS_ST_CURR_AFTER
- * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should 
+ * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should
  * be exclusive. No more than one of them can be set for any picture.
  * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
  * equals NumPocTotalCurr, which should be equal to or smaller than 8.
@@ -5181,31 +5123,30 @@
  * The pictures in DPB with any of these three flags turned on are referred by
  * the current picture.
  */
-/** \brief RefPicSetStCurrBefore of HEVC spec variable 
- * Number of ReferenceFrames[] entries with this bit set equals 
+/** \brief RefPicSetStCurrBefore of HEVC spec variable
+ * Number of ReferenceFrames[] entries with this bit set equals
  * NumPocStCurrBefore.
  */
 #define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE      0x00000010
 /** \brief RefPicSetStCurrAfter of HEVC spec variable
- * Number of ReferenceFrames[] entries with this bit set equals 
+ * Number of ReferenceFrames[] entries with this bit set equals
  * NumPocStCurrAfter.
  */
 #define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER       0x00000020
 /** \brief RefPicSetLtCurr of HEVC spec variable
- * Number of ReferenceFrames[] entries with this bit set equals 
+ * Number of ReferenceFrames[] entries with this bit set equals
  * NumPocLtCurr.
  */
 #define VA_PICTURE_HEVC_RPS_LT_CURR             0x00000040
 
-typedef enum{
+typedef enum {
     VACopyObjectSurface = 0,
     VACopyObjectBuffer  = 1,
 } VACopyObjectType;
 
 typedef struct _VACopyObject {
     VACopyObjectType  obj_type;    // type of object.
-    union
-    {
+    union {
         VASurfaceID surface_id;
         VABufferID  buffer_id;
     } object;
@@ -5213,16 +5154,16 @@
     uint32_t    va_reserved[VA_PADDING_MEDIUM];
 } VACopyObject;
 
-typedef union _VACopyOption{
+typedef union _VACopyOption {
     struct {
         /** \brief va copy synchronization, the value should be /c VA_EXEC_SYNC or /c VA_EXEC_ASYNC */
         uint32_t va_copy_sync : 2;
         /** \brief va copy mode, the value should be VA_EXEC_MODE_XXX */
         uint32_t va_copy_mode : 4;
-        uint32_t reserved     :26;
-    }bits;
+        uint32_t reserved     : 26;
+    } bits;
     uint32_t value;
-}VACopyOption;
+} VACopyOption;
 
 /** \brief Copies an object.
  *
diff --git a/va/va_android.h b/va/va_android.h
index bf017e5..dfed8fd 100644
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -27,9 +27,9 @@
 #include <va/va.h>
 
 /** \brief Android Gralloc buffer memory type. */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC	0x00100000
+#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC  0x00100000
 /** \brief Android ION buffer memory type. */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION		0x00200000
+#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION      0x00200000
 
 #ifdef __cplusplus
 extern "C" {
@@ -38,7 +38,7 @@
 /*
  * Returns a suitable VADisplay for VA API
  */
-VADisplay vaGetDisplay (
+VADisplay vaGetDisplay(
     void *android_dpy
 );
 
diff --git a/va/va_backend.h b/va/va_backend.h
index 44e621a..149b6a3 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -53,462 +53,460 @@
     VA_DISPLAY_WAYLAND  = 0x40,
 };
 
-struct VADriverVTable
-{
-	VAStatus (*vaTerminate) ( VADriverContextP ctx );
+struct VADriverVTable {
+    VAStatus(*vaTerminate)(VADriverContextP ctx);
 
-	VAStatus (*vaQueryConfigProfiles) (
-		VADriverContextP ctx,
-		VAProfile *profile_list,	/* out */
-		int *num_profiles			/* out */
-	);
+    VAStatus(*vaQueryConfigProfiles)(
+        VADriverContextP ctx,
+        VAProfile *profile_list,    /* out */
+        int *num_profiles           /* out */
+    );
 
-	VAStatus (*vaQueryConfigEntrypoints) (
-		VADriverContextP ctx,
-		VAProfile profile,
-		VAEntrypoint  *entrypoint_list,	/* out */
-		int *num_entrypoints			/* out */
-	);
+    VAStatus(*vaQueryConfigEntrypoints)(
+        VADriverContextP ctx,
+        VAProfile profile,
+        VAEntrypoint  *entrypoint_list, /* out */
+        int *num_entrypoints            /* out */
+    );
 
-	VAStatus (*vaGetConfigAttributes) (
-		VADriverContextP ctx,
-		VAProfile profile,
-		VAEntrypoint entrypoint,
-		VAConfigAttrib *attrib_list,	/* in/out */
-		int num_attribs
-	);
+    VAStatus(*vaGetConfigAttributes)(
+        VADriverContextP ctx,
+        VAProfile profile,
+        VAEntrypoint entrypoint,
+        VAConfigAttrib *attrib_list,    /* in/out */
+        int num_attribs
+    );
 
-	VAStatus (*vaCreateConfig) (
-		VADriverContextP ctx,
-		VAProfile profile, 
-		VAEntrypoint entrypoint, 
-		VAConfigAttrib *attrib_list,
-		int num_attribs,
-		VAConfigID *config_id		/* out */
-	);
+    VAStatus(*vaCreateConfig)(
+        VADriverContextP ctx,
+        VAProfile profile,
+        VAEntrypoint entrypoint,
+        VAConfigAttrib *attrib_list,
+        int num_attribs,
+        VAConfigID *config_id       /* out */
+    );
 
-	VAStatus (*vaDestroyConfig) (
-		VADriverContextP ctx,
-		VAConfigID config_id
-	);
+    VAStatus(*vaDestroyConfig)(
+        VADriverContextP ctx,
+        VAConfigID config_id
+    );
 
-	VAStatus (*vaQueryConfigAttributes) (
-		VADriverContextP ctx,
-		VAConfigID config_id, 
-		VAProfile *profile,		/* out */
-		VAEntrypoint *entrypoint, 	/* out */
-		VAConfigAttrib *attrib_list,	/* out */
-		int *num_attribs		/* out */
-	);
+    VAStatus(*vaQueryConfigAttributes)(
+        VADriverContextP ctx,
+        VAConfigID config_id,
+        VAProfile *profile,     /* out */
+        VAEntrypoint *entrypoint,   /* out */
+        VAConfigAttrib *attrib_list,    /* out */
+        int *num_attribs        /* out */
+    );
 
-	VAStatus (*vaCreateSurfaces) (
-		VADriverContextP ctx,
-		int width,
-		int height,
-		int format,
-		int num_surfaces,
-		VASurfaceID *surfaces		/* out */
-	);
+    VAStatus(*vaCreateSurfaces)(
+        VADriverContextP ctx,
+        int width,
+        int height,
+        int format,
+        int num_surfaces,
+        VASurfaceID *surfaces       /* out */
+    );
 
-	VAStatus (*vaDestroySurfaces) (
-		VADriverContextP ctx,
-		VASurfaceID *surface_list,
-		int num_surfaces
-	);
+    VAStatus(*vaDestroySurfaces)(
+        VADriverContextP ctx,
+        VASurfaceID *surface_list,
+        int num_surfaces
+    );
 
-	VAStatus (*vaCreateContext) (
-		VADriverContextP ctx,
-		VAConfigID config_id,
-		int picture_width,
-		int picture_height,
-		int flag,
-		VASurfaceID *render_targets,
-		int num_render_targets,
-		VAContextID *context		/* out */
-	);
+    VAStatus(*vaCreateContext)(
+        VADriverContextP ctx,
+        VAConfigID config_id,
+        int picture_width,
+        int picture_height,
+        int flag,
+        VASurfaceID *render_targets,
+        int num_render_targets,
+        VAContextID *context        /* out */
+    );
 
-	VAStatus (*vaDestroyContext) (
-		VADriverContextP ctx,
-		VAContextID context
-	);
+    VAStatus(*vaDestroyContext)(
+        VADriverContextP ctx,
+        VAContextID context
+    );
 
-	VAStatus (*vaCreateBuffer) (
-		VADriverContextP ctx,
-		VAContextID context,		/* in */
-		VABufferType type,		/* in */
-		unsigned int size,		/* in */
-		unsigned int num_elements,	/* in */
-		void *data,			/* in */
-                VABufferID *buf_id
-	);
+    VAStatus(*vaCreateBuffer)(
+        VADriverContextP ctx,
+        VAContextID context,        /* in */
+        VABufferType type,      /* in */
+        unsigned int size,      /* in */
+        unsigned int num_elements,  /* in */
+        void *data,         /* in */
+        VABufferID *buf_id
+    );
 
-	VAStatus (*vaBufferSetNumElements) (
-		VADriverContextP ctx,
-		VABufferID buf_id,	/* in */
-		unsigned int num_elements	/* in */
-	);
+    VAStatus(*vaBufferSetNumElements)(
+        VADriverContextP ctx,
+        VABufferID buf_id,  /* in */
+        unsigned int num_elements   /* in */
+    );
 
-	VAStatus (*vaMapBuffer) (
-		VADriverContextP ctx,
-		VABufferID buf_id,	/* in */
-		void **pbuf         /* out */
-	);
+    VAStatus(*vaMapBuffer)(
+        VADriverContextP ctx,
+        VABufferID buf_id,  /* in */
+        void **pbuf         /* out */
+    );
 
-	VAStatus (*vaUnmapBuffer) (
-		VADriverContextP ctx,
-		VABufferID buf_id	/* in */
-	);
+    VAStatus(*vaUnmapBuffer)(
+        VADriverContextP ctx,
+        VABufferID buf_id   /* in */
+    );
 
-	VAStatus (*vaDestroyBuffer) (
-		VADriverContextP ctx,
-		VABufferID buffer_id
-	);
+    VAStatus(*vaDestroyBuffer)(
+        VADriverContextP ctx,
+        VABufferID buffer_id
+    );
 
-	VAStatus (*vaBeginPicture) (
-		VADriverContextP ctx,
-		VAContextID context,
-		VASurfaceID render_target
-	);
+    VAStatus(*vaBeginPicture)(
+        VADriverContextP ctx,
+        VAContextID context,
+        VASurfaceID render_target
+    );
 
-	VAStatus (*vaRenderPicture) (
-		VADriverContextP ctx,
-		VAContextID context,
-		VABufferID *buffers,
-		int num_buffers
-	);
+    VAStatus(*vaRenderPicture)(
+        VADriverContextP ctx,
+        VAContextID context,
+        VABufferID *buffers,
+        int num_buffers
+    );
 
-	VAStatus (*vaEndPicture) (
-		VADriverContextP ctx,
-		VAContextID context
-	);
+    VAStatus(*vaEndPicture)(
+        VADriverContextP ctx,
+        VAContextID context
+    );
 
-	VAStatus (*vaSyncSurface) (
-		VADriverContextP ctx,
-		VASurfaceID render_target
-	);
+    VAStatus(*vaSyncSurface)(
+        VADriverContextP ctx,
+        VASurfaceID render_target
+    );
 
-	VAStatus (*vaQuerySurfaceStatus) (
-		VADriverContextP ctx,
-		VASurfaceID render_target,
-		VASurfaceStatus *status	/* out */
-	);
+    VAStatus(*vaQuerySurfaceStatus)(
+        VADriverContextP ctx,
+        VASurfaceID render_target,
+        VASurfaceStatus *status /* out */
+    );
 
-	VAStatus (*vaQuerySurfaceError) (
-		VADriverContextP ctx,
-		VASurfaceID render_target,
-                VAStatus error_status,
-                void **error_info /*out*/
-	);
+    VAStatus(*vaQuerySurfaceError)(
+        VADriverContextP ctx,
+        VASurfaceID render_target,
+        VAStatus error_status,
+        void **error_info /*out*/
+    );
 
-	VAStatus (*vaPutSurface) (
-    		VADriverContextP ctx,
-		VASurfaceID surface,
-		void* draw, /* Drawable of window system */
-		short srcx,
-		short srcy,
-		unsigned short srcw,
-		unsigned short srch,
-		short destx,
-		short desty,
-		unsigned short destw,
-		unsigned short desth,
-		VARectangle *cliprects, /* client supplied clip list */
-		unsigned int number_cliprects, /* number of clip rects in the clip list */
-		unsigned int flags /* de-interlacing flags */
-	);
+    VAStatus(*vaPutSurface)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        void* draw, /* Drawable of window system */
+        short srcx,
+        short srcy,
+        unsigned short srcw,
+        unsigned short srch,
+        short destx,
+        short desty,
+        unsigned short destw,
+        unsigned short desth,
+        VARectangle *cliprects, /* client supplied clip list */
+        unsigned int number_cliprects, /* number of clip rects in the clip list */
+        unsigned int flags /* de-interlacing flags */
+    );
 
-	VAStatus (*vaQueryImageFormats) (
-		VADriverContextP ctx,
-		VAImageFormat *format_list,        /* out */
-		int *num_formats           /* out */
-	);
+    VAStatus(*vaQueryImageFormats)(
+        VADriverContextP ctx,
+        VAImageFormat *format_list,        /* out */
+        int *num_formats           /* out */
+    );
 
-	VAStatus (*vaCreateImage) (
-		VADriverContextP ctx,
-		VAImageFormat *format,
-		int width,
-		int height,
-		VAImage *image     /* out */
-	);
+    VAStatus(*vaCreateImage)(
+        VADriverContextP ctx,
+        VAImageFormat *format,
+        int width,
+        int height,
+        VAImage *image     /* out */
+    );
 
-	VAStatus (*vaDeriveImage) (
-		VADriverContextP ctx,
-		VASurfaceID surface,
-		VAImage *image     /* out */
-	);
+    VAStatus(*vaDeriveImage)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        VAImage *image     /* out */
+    );
 
-	VAStatus (*vaDestroyImage) (
-		VADriverContextP ctx,
-		VAImageID image
-	);
-	
-	VAStatus (*vaSetImagePalette) (
-	        VADriverContextP ctx,
-	        VAImageID image,
-	        /*
-                 * pointer to an array holding the palette data.  The size of the array is
-                 * num_palette_entries * entry_bytes in size.  The order of the components
-                 * in the palette is described by the component_order in VAImage struct
-                 */
-                unsigned char *palette
-	);
-	
-	VAStatus (*vaGetImage) (
-		VADriverContextP ctx,
-		VASurfaceID surface,
-		int x,     /* coordinates of the upper left source pixel */
-		int y,
-		unsigned int width, /* width and height of the region */
-		unsigned int height,
-		VAImageID image
-	);
+    VAStatus(*vaDestroyImage)(
+        VADriverContextP ctx,
+        VAImageID image
+    );
 
-	VAStatus (*vaPutImage) (
-		VADriverContextP ctx,
-		VASurfaceID surface,
-		VAImageID image,
-		int src_x,
-		int src_y,
-		unsigned int src_width,
-		unsigned int src_height,
-		int dest_x,
-		int dest_y,
-		unsigned int dest_width,
-		unsigned int dest_height
-	);
+    VAStatus(*vaSetImagePalette)(
+        VADriverContextP ctx,
+        VAImageID image,
+        /*
+             * pointer to an array holding the palette data.  The size of the array is
+             * num_palette_entries * entry_bytes in size.  The order of the components
+             * in the palette is described by the component_order in VAImage struct
+             */
+        unsigned char *palette
+    );
 
-	VAStatus (*vaQuerySubpictureFormats) (
-		VADriverContextP ctx,
-		VAImageFormat *format_list,        /* out */
-		unsigned int *flags,       /* out */
-		unsigned int *num_formats  /* out */
-	);
+    VAStatus(*vaGetImage)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        int x,     /* coordinates of the upper left source pixel */
+        int y,
+        unsigned int width, /* width and height of the region */
+        unsigned int height,
+        VAImageID image
+    );
 
-	VAStatus (*vaCreateSubpicture) (
-		VADriverContextP ctx,
-		VAImageID image,
-		VASubpictureID *subpicture   /* out */
-	);
+    VAStatus(*vaPutImage)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        VAImageID image,
+        int src_x,
+        int src_y,
+        unsigned int src_width,
+        unsigned int src_height,
+        int dest_x,
+        int dest_y,
+        unsigned int dest_width,
+        unsigned int dest_height
+    );
 
-	VAStatus (*vaDestroySubpicture) (
-		VADriverContextP ctx,
-		VASubpictureID subpicture
-	);
+    VAStatus(*vaQuerySubpictureFormats)(
+        VADriverContextP ctx,
+        VAImageFormat *format_list,        /* out */
+        unsigned int *flags,       /* out */
+        unsigned int *num_formats  /* out */
+    );
 
-        VAStatus (*vaSetSubpictureImage) (
-                VADriverContextP ctx,
-                VASubpictureID subpicture,
-                VAImageID image
-        );
+    VAStatus(*vaCreateSubpicture)(
+        VADriverContextP ctx,
+        VAImageID image,
+        VASubpictureID *subpicture   /* out */
+    );
 
-	VAStatus (*vaSetSubpictureChromakey) (
-		VADriverContextP ctx,
-		VASubpictureID subpicture,
-		unsigned int chromakey_min,
-		unsigned int chromakey_max,
-		unsigned int chromakey_mask
-	);
+    VAStatus(*vaDestroySubpicture)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture
+    );
 
-	VAStatus (*vaSetSubpictureGlobalAlpha) (
-		VADriverContextP ctx,
-		VASubpictureID subpicture,
-		float global_alpha 
-	);
+    VAStatus(*vaSetSubpictureImage)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture,
+        VAImageID image
+    );
 
-	VAStatus (*vaAssociateSubpicture) (
-		VADriverContextP ctx,
-		VASubpictureID subpicture,
-		VASurfaceID *target_surfaces,
-		int num_surfaces,
-		short src_x, /* upper left offset in subpicture */
-		short src_y,
-		unsigned short src_width,
-		unsigned short src_height,
-		short dest_x, /* upper left offset in surface */
-		short dest_y,
-		unsigned short dest_width,
-		unsigned short dest_height,
-		/*
-		 * whether to enable chroma-keying or global-alpha
-		 * see VA_SUBPICTURE_XXX values
-		 */
-		unsigned int flags
-	);
+    VAStatus(*vaSetSubpictureChromakey)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture,
+        unsigned int chromakey_min,
+        unsigned int chromakey_max,
+        unsigned int chromakey_mask
+    );
 
-	VAStatus (*vaDeassociateSubpicture) (
-		VADriverContextP ctx,
-		VASubpictureID subpicture,
-		VASurfaceID *target_surfaces,
-		int num_surfaces
-	);
+    VAStatus(*vaSetSubpictureGlobalAlpha)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture,
+        float global_alpha
+    );
 
-	VAStatus (*vaQueryDisplayAttributes) (
-		VADriverContextP ctx,
-		VADisplayAttribute *attr_list,	/* out */
-		int *num_attributes		/* out */
-        );
+    VAStatus(*vaAssociateSubpicture)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture,
+        VASurfaceID *target_surfaces,
+        int num_surfaces,
+        short src_x, /* upper left offset in subpicture */
+        short src_y,
+        unsigned short src_width,
+        unsigned short src_height,
+        short dest_x, /* upper left offset in surface */
+        short dest_y,
+        unsigned short dest_width,
+        unsigned short dest_height,
+        /*
+         * whether to enable chroma-keying or global-alpha
+         * see VA_SUBPICTURE_XXX values
+         */
+        unsigned int flags
+    );
 
-	VAStatus (*vaGetDisplayAttributes) (
-		VADriverContextP ctx,
-		VADisplayAttribute *attr_list,	/* in/out */
-		int num_attributes
-        );
-        
-        VAStatus (*vaSetDisplayAttributes) (
-		VADriverContextP ctx,
-                VADisplayAttribute *attr_list,
-                int num_attributes
-        );
+    VAStatus(*vaDeassociateSubpicture)(
+        VADriverContextP ctx,
+        VASubpictureID subpicture,
+        VASurfaceID *target_surfaces,
+        int num_surfaces
+    );
 
-        /* used by va trace */        
-        VAStatus (*vaBufferInfo) (
-                   VADriverContextP ctx,      /* in */
-                   VABufferID buf_id,         /* in */
-                   VABufferType *type,        /* out */
-                   unsigned int *size,        /* out */
-                   unsigned int *num_elements /* out */
-        );
+    VAStatus(*vaQueryDisplayAttributes)(
+        VADriverContextP ctx,
+        VADisplayAttribute *attr_list,  /* out */
+        int *num_attributes     /* out */
+    );
 
-        /* lock/unlock surface for external access */    
-        VAStatus (*vaLockSurface) (
-		VADriverContextP ctx,
-                VASurfaceID surface,
-                unsigned int *fourcc, /* out  for follow argument */
-                unsigned int *luma_stride,
-                unsigned int *chroma_u_stride,
-                unsigned int *chroma_v_stride,
-                unsigned int *luma_offset,
-                unsigned int *chroma_u_offset,
-                unsigned int *chroma_v_offset,
-                unsigned int *buffer_name, /* if it is not NULL, assign the low lever
+    VAStatus(*vaGetDisplayAttributes)(
+        VADriverContextP ctx,
+        VADisplayAttribute *attr_list,  /* in/out */
+        int num_attributes
+    );
+
+    VAStatus(*vaSetDisplayAttributes)(
+        VADriverContextP ctx,
+        VADisplayAttribute *attr_list,
+        int num_attributes
+    );
+
+    /* used by va trace */
+    VAStatus(*vaBufferInfo)(
+        VADriverContextP ctx,      /* in */
+        VABufferID buf_id,         /* in */
+        VABufferType *type,        /* out */
+        unsigned int *size,        /* out */
+        unsigned int *num_elements /* out */
+    );
+
+    /* lock/unlock surface for external access */
+    VAStatus(*vaLockSurface)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        unsigned int *fourcc, /* out  for follow argument */
+        unsigned int *luma_stride,
+        unsigned int *chroma_u_stride,
+        unsigned int *chroma_v_stride,
+        unsigned int *luma_offset,
+        unsigned int *chroma_u_offset,
+        unsigned int *chroma_v_offset,
+        unsigned int *buffer_name, /* if it is not NULL, assign the low lever
                                             * surface buffer name
                                             */
-                void **buffer /* if it is not NULL, map the surface buffer for
+        void **buffer /* if it is not NULL, map the surface buffer for
                                 * CPU access
                                 */
-        );
-    
-        VAStatus (*vaUnlockSurface) (
-		VADriverContextP ctx,
-                VASurfaceID surface
-        );
+    );
 
-        /* DEPRECATED */
-        VAStatus
-        (*vaGetSurfaceAttributes)(
-            VADriverContextP    dpy,
-            VAConfigID          config,
-            VASurfaceAttrib    *attrib_list,
-            unsigned int        num_attribs
-        );
+    VAStatus(*vaUnlockSurface)(
+        VADriverContextP ctx,
+        VASurfaceID surface
+    );
 
-        VAStatus
-        (*vaCreateSurfaces2)(
-            VADriverContextP    ctx,
-            unsigned int        format,
-            unsigned int        width,
-            unsigned int        height,
-            VASurfaceID        *surfaces,
-            unsigned int        num_surfaces,
-            VASurfaceAttrib    *attrib_list,
-            unsigned int        num_attribs
-        );
+    /* DEPRECATED */
+    VAStatus
+    (*vaGetSurfaceAttributes)(
+        VADriverContextP    dpy,
+        VAConfigID          config,
+        VASurfaceAttrib    *attrib_list,
+        unsigned int        num_attribs
+    );
 
-        VAStatus
-        (*vaQuerySurfaceAttributes)(
-            VADriverContextP    dpy,
-            VAConfigID          config,
-            VASurfaceAttrib    *attrib_list,
-            unsigned int       *num_attribs
-        );
+    VAStatus
+    (*vaCreateSurfaces2)(
+        VADriverContextP    ctx,
+        unsigned int        format,
+        unsigned int        width,
+        unsigned int        height,
+        VASurfaceID        *surfaces,
+        unsigned int        num_surfaces,
+        VASurfaceAttrib    *attrib_list,
+        unsigned int        num_attribs
+    );
 
-        VAStatus
-        (*vaAcquireBufferHandle)(
-            VADriverContextP    ctx,
-            VABufferID          buf_id,         /* in */
-            VABufferInfo *      buf_info        /* in/out */
-        );
+    VAStatus
+    (*vaQuerySurfaceAttributes)(
+        VADriverContextP    dpy,
+        VAConfigID          config,
+        VASurfaceAttrib    *attrib_list,
+        unsigned int       *num_attribs
+    );
 
-        VAStatus
-        (*vaReleaseBufferHandle)(
-            VADriverContextP    ctx,
-            VABufferID          buf_id          /* in */
-        );
+    VAStatus
+    (*vaAcquireBufferHandle)(
+        VADriverContextP    ctx,
+        VABufferID          buf_id,         /* in */
+        VABufferInfo *      buf_info        /* in/out */
+    );
 
-        VAStatus (*vaCreateMFContext) (
-            VADriverContextP ctx,
-            VAMFContextID *mfe_context    /* out */
-        );
+    VAStatus
+    (*vaReleaseBufferHandle)(
+        VADriverContextP    ctx,
+        VABufferID          buf_id          /* in */
+    );
 
-        VAStatus (*vaMFAddContext) (
-            VADriverContextP ctx,
-            VAMFContextID mf_context,
-            VAContextID context
-        );
+    VAStatus(*vaCreateMFContext)(
+        VADriverContextP ctx,
+        VAMFContextID *mfe_context    /* out */
+    );
 
-        VAStatus (*vaMFReleaseContext) (
-            VADriverContextP ctx,
-            VAMFContextID mf_context,
-            VAContextID context
-        );
+    VAStatus(*vaMFAddContext)(
+        VADriverContextP ctx,
+        VAMFContextID mf_context,
+        VAContextID context
+    );
 
-        VAStatus (*vaMFSubmit) (
-            VADriverContextP ctx,
-            VAMFContextID mf_context,
-            VAContextID *contexts,
-            int num_contexts
-        );
-	VAStatus (*vaCreateBuffer2) (
-            VADriverContextP ctx,
-            VAContextID context,                /* in */
-            VABufferType type,                  /* in */
-            unsigned int width,                 /* in */
-            unsigned int height,                /* in */
-            unsigned int *unit_size,            /* out */
-            unsigned int *pitch,                /* out */
-            VABufferID *buf_id                  /* out */
-	);
+    VAStatus(*vaMFReleaseContext)(
+        VADriverContextP ctx,
+        VAMFContextID mf_context,
+        VAContextID context
+    );
 
-        VAStatus (*vaQueryProcessingRate) (
-            VADriverContextP ctx,               /* in */
-            VAConfigID config_id,               /* in */
-            VAProcessingRateParameter *proc_buf,/* in */
-            unsigned int *processing_rate	/* out */
-        );
+    VAStatus(*vaMFSubmit)(
+        VADriverContextP ctx,
+        VAMFContextID mf_context,
+        VAContextID *contexts,
+        int num_contexts
+    );
+    VAStatus(*vaCreateBuffer2)(
+        VADriverContextP ctx,
+        VAContextID context,                /* in */
+        VABufferType type,                  /* in */
+        unsigned int width,                 /* in */
+        unsigned int height,                /* in */
+        unsigned int *unit_size,            /* out */
+        unsigned int *pitch,                /* out */
+        VABufferID *buf_id                  /* out */
+    );
 
-        VAStatus
-        (*vaExportSurfaceHandle)(
-            VADriverContextP    ctx,
-            VASurfaceID         surface_id,     /* in */
-            uint32_t            mem_type,       /* in */
-            uint32_t            flags,          /* in */
-            void               *descriptor      /* out */
-        );
-        VAStatus (*vaSyncSurface2) (
-            VADriverContextP ctx,
-            VASurfaceID surface,
-            uint64_t timeout_ns
-        );
+    VAStatus(*vaQueryProcessingRate)(
+        VADriverContextP ctx,               /* in */
+        VAConfigID config_id,               /* in */
+        VAProcessingRateParameter *proc_buf,/* in */
+        unsigned int *processing_rate   /* out */
+    );
 
-        VAStatus (*vaSyncBuffer) (
-            VADriverContextP ctx,
-            VABufferID buf_id,
-            uint64_t timeout_ns
-        );
+    VAStatus
+    (*vaExportSurfaceHandle)(
+        VADriverContextP    ctx,
+        VASurfaceID         surface_id,     /* in */
+        uint32_t            mem_type,       /* in */
+        uint32_t            flags,          /* in */
+        void               *descriptor      /* out */
+    );
+    VAStatus(*vaSyncSurface2)(
+        VADriverContextP ctx,
+        VASurfaceID surface,
+        uint64_t timeout_ns
+    );
 
-        VAStatus
-        (*vaCopy)(
-            VADriverContextP    ctx,            /* in */
-            VACopyObject        *dst,           /* in */
-            VACopyObject        *src,           /* in */
-            VACopyOption        option          /* in */
-        );
-        /** \brief Reserved bytes for future use, must be zero */
-        unsigned long reserved[54];
+    VAStatus(*vaSyncBuffer)(
+        VADriverContextP ctx,
+        VABufferID buf_id,
+        uint64_t timeout_ns
+    );
+
+    VAStatus
+    (*vaCopy)(
+        VADriverContextP    ctx,            /* in */
+        VACopyObject        *dst,           /* in */
+        VACopyObject        *src,           /* in */
+        VACopyOption        option          /* in */
+    );
+    /** \brief Reserved bytes for future use, must be zero */
+    unsigned long reserved[54];
 };
 
-struct VADriverContext
-{
+struct VADriverContext {
     void *pDriverData;
 
     /**
@@ -557,7 +555,7 @@
     int max_display_attributes;
     const char *str_vendor;
 
-    void *handle;			/* dlopen handle */
+    void *handle;           /* dlopen handle */
 
     /**
      * \brief DRM state.
@@ -573,7 +571,7 @@
      */
     void *drm_state;
 
-    void *glx;				/* opaque for GLX code */
+    void *glx;              /* opaque for GLX code */
 
     /** \brief VA display type. */
     unsigned long display_type;
@@ -648,24 +646,23 @@
 };
 
 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
-struct VADisplayContext
-{
+struct VADisplayContext {
     int vadpy_magic;
-    
+
     VADisplayContextP pNext;
     VADriverContextP pDriverContext;
 
-    int (*vaIsValid) (
-	VADisplayContextP ctx
+    int (*vaIsValid)(
+        VADisplayContextP ctx
     );
 
-    void (*vaDestroy) (
-	VADisplayContextP ctx
+    void (*vaDestroy)(
+        VADisplayContextP ctx
     );
 
-    VAStatus (*vaGetDriverName) (
-	VADisplayContextP ctx,
-	char **driver_name
+    VAStatus(*vaGetDriverName)(
+        VADisplayContextP ctx,
+        char **driver_name
     );
 
     void *opaque; /* opaque for display extensions (e.g. GLX) */
@@ -676,12 +673,12 @@
     void *error_callback_user_context;
     VAMessageCallback info_callback;
     void *info_callback_user_context;
-    VAStatus (*vaGetNumCandidates) (
+    VAStatus(*vaGetNumCandidates)(
         VADisplayContextP ctx,
         int * num_candidates
     );
 
-    VAStatus (*vaGetDriverNameByIndex) (
+    VAStatus(*vaGetDriverNameByIndex)(
         VADisplayContextP ctx,
         char **driver_name,
         int  candidate_index
@@ -691,7 +688,7 @@
     unsigned long reserved[30];
 };
 
-typedef VAStatus (*VADriverInit) (
+typedef VAStatus(*VADriverInit)(
     VADriverContextP driver_context
 );
 
diff --git a/va/va_compat.c b/va/va_compat.c
index 113591f..c4d8923 100644
--- a/va/va_compat.c
+++ b/va/va_compat.c
@@ -40,4 +40,4 @@
     return vaCreateSurfaces(dpy, format, width, height, surfaces, num_surfaces,
                             NULL, 0);
 }
-VA_CPP_HELPER_ALIAS(vaCreateSurfaces, 0,32,0);
+VA_CPP_HELPER_ALIAS(vaCreateSurfaces, 0, 32, 0);
diff --git a/va/va_dec_av1.h b/va/va_dec_av1.h
index c165f39..c195538 100644
--- a/va/va_dec_av1.h
+++ b/va/va_dec_av1.h
@@ -80,13 +80,13 @@
 typedef struct _VASegmentationStructAV1 {
     union {
         struct {
-             /** Indicates whether segmentation map related syntax elements
-             *  are present or not for current frame. If equal to 0,
-             *  the segmentation map related syntax elements are
-             *  not present for the current frame and the control flags of
-             *  segmentation map related tables feature_data[][], and
-             *  feature_mask[] are not valid and shall be ignored by accelerator.
-             */
+            /** Indicates whether segmentation map related syntax elements
+            *  are present or not for current frame. If equal to 0,
+            *  the segmentation map related syntax elements are
+            *  not present for the current frame and the control flags of
+            *  segmentation map related tables feature_data[][], and
+            *  feature_mask[] are not valid and shall be ignored by accelerator.
+            */
             uint32_t         enabled                                     : 1;
             /** Value 1 indicates that the segmentation map are updated
              *  during the decoding of this frame.
@@ -213,7 +213,7 @@
     VAAV1TransformationCount
 } VAAV1TransformationType;
 
-typedef struct _VAWarpedMotionParamsAV1{
+typedef struct _VAWarpedMotionParamsAV1 {
 
     /** \brief Specify the type of warped motion */
     VAAV1TransformationType  wmtype;
@@ -240,8 +240,7 @@
  * per frame.
  *
  */
-typedef struct  _VADecPictureParameterBufferAV1
-{
+typedef struct  _VADecPictureParameterBufferAV1 {
     /**@{*/
 
     /** \brief sequence level information
@@ -407,23 +406,21 @@
     /* specify the tile index for context updating */
     uint16_t                context_update_tile_id;
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** \brief flags for current picture
              *  same syntax and semantic as those in AV1 code
              */
 
-             /** \brief Frame Type
-              *  0:     KEY_FRAME;
-              *  1:     INTER_FRAME;
-              *  2:     INTRA_ONLY_FRAME;
-              *  3:     SWITCH_FRAME
-              *  For SWITCH_FRAME, application shall set error_resilient_mode = 1,
-              *  refresh_frame_flags, etc. appropriately. And driver will convert it
-              *  to INTER_FRAME.
-              */
+            /** \brief Frame Type
+             *  0:     KEY_FRAME;
+             *  1:     INTER_FRAME;
+             *  2:     INTRA_ONLY_FRAME;
+             *  3:     SWITCH_FRAME
+             *  For SWITCH_FRAME, application shall set error_resilient_mode = 1,
+             *  refresh_frame_flags, etc. appropriately. And driver will convert it
+             *  to INTER_FRAME.
+             */
             uint32_t        frame_type                                  : 2;
             uint32_t        show_frame                                  : 1;
             uint32_t        showable_frame                              : 1;
@@ -471,10 +468,8 @@
     uint8_t                 filter_level_u;
     uint8_t                 filter_level_v;
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** \brief flags for reference pictures
              *  same syntax and semantic as those in AV1 code
              */
@@ -529,10 +524,8 @@
 
     /** \brief quantization_matrix
      */
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             uint16_t        using_qmatrix                               : 1;
             /** \brief qm level
              *  value range [0..15]
@@ -548,10 +541,8 @@
         uint16_t            value;
     } qmatrix_fields;
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** \brief delta_q parameters
              */
             uint32_t        delta_q_present_flag                        : 1;
@@ -612,10 +603,8 @@
 
     /** \brief loop restoration parameters
      */
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             uint16_t        yframe_restoration_type                     : 2;
             uint16_t        cbframe_restoration_type                    : 2;
             uint16_t        crframe_restoration_type                    : 2;
@@ -655,8 +644,7 @@
  * per tile information. And the bit stream in sent to driver in per
  * tile granularity.
  */
-typedef struct _VASliceParameterBufferAV1
-{
+typedef struct _VASliceParameterBufferAV1 {
     /**@{*/
     /** \brief The byte count of current tile in the bitstream buffer,
      *  starting from first byte of the buffer.
diff --git a/va/va_dec_hevc.h b/va/va_dec_hevc.h
index 53afd1a..eef0530 100644
--- a/va/va_dec_hevc.h
+++ b/va/va_dec_hevc.h
@@ -54,8 +54,7 @@
  * per frame.
  *
  */
-typedef struct  _VAPictureParameterBufferHEVC
-{
+typedef struct  _VAPictureParameterBufferHEVC {
     /** \brief buffer description of decoded current picture
      * only VA_PICTURE_HEVC_FIELD_PIC and VA_PICTURE_HEVC_BOTTOM_FIELD
      * of "flags" fields are meaningful.
@@ -69,11 +68,9 @@
     uint16_t                pic_height_in_luma_samples;
 
 
-    union
-    {
-        struct
-        {
-        /** following flags have same syntax and semantic as those in HEVC spec */
+    union {
+        struct {
+            /** following flags have same syntax and semantic as those in HEVC spec */
             uint32_t        chroma_format_idc                           : 2;
             uint32_t        separate_colour_plane_flag                  : 1;
             uint32_t        pcm_enabled_flag                            : 1;
@@ -139,10 +136,8 @@
     /**
      * \brief Parameters needed for parsing slice segment headers
      */
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** following parameters have same syntax with those in HEVC spec */
             uint32_t        lists_modification_present_flag             : 1;
             uint32_t        long_term_ref_pics_present_flag             : 1;
@@ -206,12 +201,9 @@
  * type is same as \ref VAPictureParameterBufferHEVC.
  *
  */
-typedef struct  _VAPictureParameterBufferHEVCRext
-{
-    union
-    {
-        struct
-        {
+typedef struct  _VAPictureParameterBufferHEVCRext {
+    union {
+        struct {
             /** \brief HEVC range extension flags
              *  The following flags bears the same syntax and semantics as
              *  those defined in HEVC bit stream spec.
@@ -260,12 +252,9 @@
  *together and the buffer type is same as \ref VAPictureParameterBufferHEVC.
  *
  */
-typedef struct  _VAPictureParameterBufferHEVCScc
-{
-    union
-    {
-        struct
-        {
+typedef struct  _VAPictureParameterBufferHEVCScc {
+    union {
+        struct {
             /** \brief HEVC Scc extension flags
              *  The following flags bears the same syntax and semantics as
              *  those defined in HEVC bit stream spec.
@@ -339,8 +328,7 @@
  * The data buffer should be sent once per frame.
  *
  */
-typedef struct  _VAPictureParameterBufferHEVCExtension
-{
+typedef struct  _VAPictureParameterBufferHEVCExtension {
     /** \brief basic HEVC picture parameters data structure
      */
     VAPictureParameterBufferHEVC           base;
@@ -367,8 +355,7 @@
  * For short format, this data structure is not sent by application.
  *
  */
-typedef struct  _VASliceParameterBufferHEVC
-{
+typedef struct  _VASliceParameterBufferHEVC {
     /** @name Codec-independent Slice Parameter Buffer base. */
 
     /**@{*/
@@ -400,34 +387,32 @@
      * value range [0..14, 0xFF], where 0xFF indicates invalid entry.
      */
     uint8_t                 RefPicList[2][15];
-    union
-    {
+    union {
         uint32_t            value;
-        struct
-        {
+        struct {
             /** current slice is last slice of picture. */
             uint32_t        LastSliceOfPic                              : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        dependent_slice_segment_flag                : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_type                                  : 2;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        color_plane_id                              : 2;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_sao_luma_flag                         : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_sao_chroma_flag                       : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        mvd_l1_zero_flag                            : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        cabac_init_flag                             : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_temporal_mvp_enabled_flag             : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_deblocking_filter_disabled_flag       : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        collocated_from_l0_flag                     : 1;
-    /** HEVC syntax element. */
+            /** HEVC syntax element. */
             uint32_t        slice_loop_filter_across_slices_enabled_flag : 1;
             uint32_t        reserved                                    : 18;
         } fields;
@@ -510,8 +495,7 @@
  * For short format, this data structure is not sent by application.
  *
  */
-typedef struct  _VASliceParameterBufferHEVCRext
-{
+typedef struct  _VASliceParameterBufferHEVCRext {
     /* below four parameters are used to replace data types of the
      * corresponding parameters of those in \# VASliceParameterBufferHEVC.
      */
@@ -520,10 +504,8 @@
     int16_t                 luma_offset_l1[15];
     int16_t                 ChromaOffsetL1[15][2];
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             uint32_t        cu_chroma_qp_offset_enabled_flag    : 1;
             uint32_t        use_integer_mv_flag                 : 1;
             /** \brief Reserved bytes for future use, must be zero */
@@ -553,13 +535,12 @@
  * This structure conveys parameters related to slice segment header and should
  * be sent once per slice. For HEVC range extension and HEVC Scc decoding,
  * application should parse both basic slice parameters and extented slice
- * parameters into this buffer structure and sent it. 
+ * parameters into this buffer structure and sent it.
  *
  * For short format, this data structure is not sent by application.
  *
  */
-typedef struct  _VASliceParameterBufferHEVCExtension
-{
+typedef struct  _VASliceParameterBufferHEVCExtension {
     /** \brief baseline HEVC slice parameters data structure */
     VASliceParameterBufferHEVC               base;
 
@@ -577,8 +558,7 @@
  *
  * Matrix entries are in raster scan order which follows HEVC spec.
  */
-typedef struct _VAIQMatrixBufferHEVC
-{
+typedef struct _VAIQMatrixBufferHEVC {
     /**
      * \brief scaling lists,
      * corresponds to same HEVC spec syntax element
diff --git a/va/va_dec_vp8.h b/va/va_dec_vp8.h
index 7e6eb00..8004f7d 100644
--- a/va/va_dec_vp8.h
+++ b/va/va_dec_vp8.h
@@ -43,13 +43,12 @@
  */
 
 /**
- * \brief VPX Bool Coder Context structure 
+ * \brief VPX Bool Coder Context structure
  *
  * This common structure is defined for potential sharing by other VP formats
  *
  */
-typedef struct _VABoolCoderContextVPX
-{
+typedef struct _VABoolCoderContextVPX {
     /* partition 0 "range" */
     uint8_t range;
     /* partition 0 "value" */
@@ -69,8 +68,7 @@
  * per frame.
  *
  */
-typedef struct  _VAPictureParameterBufferVP8
-{
+typedef struct  _VAPictureParameterBufferVP8 {
     /* frame width in pixels */
     uint32_t frame_width;
     /* frame height in pixels */
@@ -87,38 +85,38 @@
 
     union {
         struct {
-	    /* same as key_frame in bitstream syntax, 0 means a key frame */
-            uint32_t key_frame			: 1; 
-	    /* same as version in bitstream syntax */
-            uint32_t version			: 3;
-	    /* same as segmentation_enabled in bitstream syntax */
-            uint32_t segmentation_enabled		: 1;
-	    /* same as update_mb_segmentation_map in bitstream syntax */
-            uint32_t update_mb_segmentation_map	: 1;
-	    /* same as update_segment_feature_data in bitstream syntax */
-            uint32_t update_segment_feature_data	: 1;
-	    /* same as filter_type in bitstream syntax */
-            uint32_t filter_type			: 1; 
-	    /* same as sharpness_level in bitstream syntax */
-            uint32_t sharpness_level		: 3; 
-	    /* same as loop_filter_adj_enable in bitstream syntax */
-            uint32_t loop_filter_adj_enable		: 1; 
-	    /* same as mode_ref_lf_delta_update in bitstream syntax */
-            uint32_t mode_ref_lf_delta_update	: 1; 
-	    /* same as sign_bias_golden in bitstream syntax */
-            uint32_t sign_bias_golden		: 1; 
-	    /* same as sign_bias_alternate in bitstream syntax */
-            uint32_t sign_bias_alternate		: 1; 
-	    /* same as mb_no_coeff_skip in bitstream syntax */
-            uint32_t mb_no_coeff_skip		: 1; 
-	    /* flag to indicate that loop filter should be disabled */
-            uint32_t loop_filter_disable		: 1; 
+            /* same as key_frame in bitstream syntax, 0 means a key frame */
+            uint32_t key_frame          : 1;
+            /* same as version in bitstream syntax */
+            uint32_t version            : 3;
+            /* same as segmentation_enabled in bitstream syntax */
+            uint32_t segmentation_enabled       : 1;
+            /* same as update_mb_segmentation_map in bitstream syntax */
+            uint32_t update_mb_segmentation_map : 1;
+            /* same as update_segment_feature_data in bitstream syntax */
+            uint32_t update_segment_feature_data    : 1;
+            /* same as filter_type in bitstream syntax */
+            uint32_t filter_type            : 1;
+            /* same as sharpness_level in bitstream syntax */
+            uint32_t sharpness_level        : 3;
+            /* same as loop_filter_adj_enable in bitstream syntax */
+            uint32_t loop_filter_adj_enable     : 1;
+            /* same as mode_ref_lf_delta_update in bitstream syntax */
+            uint32_t mode_ref_lf_delta_update   : 1;
+            /* same as sign_bias_golden in bitstream syntax */
+            uint32_t sign_bias_golden       : 1;
+            /* same as sign_bias_alternate in bitstream syntax */
+            uint32_t sign_bias_alternate        : 1;
+            /* same as mb_no_coeff_skip in bitstream syntax */
+            uint32_t mb_no_coeff_skip       : 1;
+            /* flag to indicate that loop filter should be disabled */
+            uint32_t loop_filter_disable        : 1;
         } bits;
         uint32_t value;
     } pic_fields;
 
     /*
-     * probabilities of the segment_id decoding tree and same as 
+     * probabilities of the segment_id decoding tree and same as
      * mb_segment_tree_probs in the spec.
      */
     uint8_t mb_segment_tree_probs[3];
@@ -139,18 +137,18 @@
     /* same as prob_gf in bitstream syntax */
     uint8_t prob_gf;
 
-    /* 
+    /*
      * list of 4 probabilities of the luma intra prediction mode decoding
      * tree and same as y_mode_probs in frame header
      */
-    uint8_t y_mode_probs[4]; 
+    uint8_t y_mode_probs[4];
     /*
      * list of 3 probabilities of the chroma intra prediction mode decoding
      * tree and same as uv_mode_probs in frame header
      */
     uint8_t uv_mode_probs[3];
-    /* 
-     * updated mv decoding probabilities and same as mv_probs in 
+    /*
+     * updated mv decoding probabilities and same as mv_probs in
      * frame header
      */
     uint8_t mv_probs[2][19];
@@ -164,15 +162,14 @@
 /**
  * \brief VP8 Slice Parameter Buffer Structure
  *
- * This structure conveys parameters related to data partitions and should be 
+ * This structure conveys parameters related to data partitions and should be
  * sent once per frame. Slice data buffer of VASliceDataBufferType is used
  * to send the partition data.
  *
  */
-typedef struct  _VASliceParameterBufferVP8
-{
+typedef struct  _VASliceParameterBufferVP8 {
     /*
-     * number of bytes in the slice data buffer for the partitions 
+     * number of bytes in the slice data buffer for the partitions
      */
     uint32_t slice_data_size;
     /*
@@ -182,7 +179,7 @@
     /*
      * see VA_SLICE_DATA_FLAG_XXX definitions
      */
-    uint32_t slice_data_flag; 
+    uint32_t slice_data_flag;
     /*
      * offset to the first bit of MB from the first byte of partition data(slice_data_offset)
      */
@@ -207,19 +204,18 @@
 /**
  * \brief VP8 Coefficient Probability Data Buffer Structure
  *
- * Contains the contents of the token probability table, which may be 
- * incrementally modified in the frame header. There are four dimensions to 
- * the token probability array. The outermost dimension is indexed by the 
- * type of plane being decoded; the next dimension is selected by the 
- * position of the coefficient being decoded; the third dimension, * roughly 
- * speaking, measures the "local complexity" or extent to which nearby 
- * coefficients are non-zero; the fourth, and final, dimension of the token 
- * probability array is indexed by the position in the token tree structure, 
+ * Contains the contents of the token probability table, which may be
+ * incrementally modified in the frame header. There are four dimensions to
+ * the token probability array. The outermost dimension is indexed by the
+ * type of plane being decoded; the next dimension is selected by the
+ * position of the coefficient being decoded; the third dimension, * roughly
+ * speaking, measures the "local complexity" or extent to which nearby
+ * coefficients are non-zero; the fourth, and final, dimension of the token
+ * probability array is indexed by the position in the token tree structure,
  * as are all tree probability arrays. This structure is sent once per frame.
  *
  */
-typedef struct _VAProbabilityDataBufferVP8
-{
+typedef struct _VAProbabilityDataBufferVP8 {
     uint8_t dct_coeff_probs[4][8][3][11];
 
     /** \brief Reserved bytes for future use, must be zero */
@@ -230,12 +226,11 @@
  * \brief VP8 Inverse Quantization Matrix Buffer Structure
  *
  * Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
- * uvac(5) for each segment (0-3). When segmentation is disabled, only  
+ * uvac(5) for each segment (0-3). When segmentation is disabled, only
  * quantization_index[0][] will be used. This structure is sent once per frame.
  */
-typedef struct _VAIQMatrixBufferVP8
-{
-    /* 
+typedef struct _VAIQMatrixBufferVP8 {
+    /*
      * array first dimensional is segment and 2nd dimensional is Q index
      * all Q indexs should be clipped to be range [0, 127]
      */
diff --git a/va/va_dec_vp9.h b/va/va_dec_vp9.h
index 490908f..17ab2a7 100644
--- a/va/va_dec_vp9.h
+++ b/va/va_dec_vp9.h
@@ -55,8 +55,7 @@
  * per frame.
  *
  */
-typedef struct  _VADecPictureParameterBufferVP9
-{
+typedef struct  _VADecPictureParameterBufferVP9 {
     /** \brief picture width
      *  Picture original resolution. The value may not be multiple of 8.
      */
@@ -76,10 +75,8 @@
      */
     VASurfaceID             reference_frames[8];
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             /** \brief flags for current picture
              *  same syntax and semantic as those in VP9 code
              */
@@ -204,12 +201,9 @@
  * and sent to API in a single buffer.
  *
  */
-typedef struct  _VASegmentParameterVP9
-{
-    union
-    {
-        struct
-        {
+typedef struct  _VASegmentParameterVP9 {
+    union {
+        struct {
             /** \brief Indicates if per segment reference frame indicator
              *  is enabled.
              *  Corresponding to variable feature_enabled when
@@ -282,8 +276,7 @@
  * (at least compressed header) to the end of frame.
  *
  */
-typedef struct _VASliceParameterBufferVP9
-{
+typedef struct _VASliceParameterBufferVP9 {
     /** \brief The byte count of current frame in the bitstream buffer,
      *  starting from first byte of the buffer.
      *  It uses the name slice_data_size to be consitent with other codec,
diff --git a/va/va_drmcommon.h b/va/va_drmcommon.h
index c4907c4..291c1cc 100644
--- a/va/va_drmcommon.h
+++ b/va/va_drmcommon.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -74,18 +74,18 @@
 };
 
 /** \brief Kernel DRM buffer memory type.  */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM		0x10000000
+#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM       0x10000000
 /** \brief DRM PRIME memory type (old version)
  *
  * This supports only single objects with restricted memory layout.
  * Used with VASurfaceAttribExternalBuffers.
  */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME		0x20000000
+#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME        0x20000000
 /** \brief DRM PRIME memory type
  *
  * Used with VADRMPRIMESurfaceDescriptor.
  */
-#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2		0x40000000
+#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2      0x40000000
 
 /**
  * \brief External buffer descriptor for a DRM PRIME surface.
@@ -165,10 +165,10 @@
  * DRM format modifiers are defined in drm_fourcc.h in the Linux kernel.
  */
 typedef struct _VADRMFormatModifierList {
-	/** Number of modifiers. */
-	uint32_t num_modifiers;
-	/** Array of modifiers. */
-	uint64_t *modifiers;
+    /** Number of modifiers. */
+    uint32_t num_modifiers;
+    /** Array of modifiers. */
+    uint64_t *modifiers;
 } VADRMFormatModifierList;
 
 
diff --git a/va/va_enc_h264.h b/va/va_enc_h264.h
index 656fd8b..46a6704 100644
--- a/va/va_enc_h264.h
+++ b/va/va_enc_h264.h
@@ -126,7 +126,7 @@
 } VAEncPackedHeaderTypeH264;
 
 /**
- * \brief Sequence parameter for H.264 encoding in baseline, main & high 
+ * \brief Sequence parameter for H.264 encoding in baseline, main & high
  * profiles.
  *
  * This structure holds information for \c seq_parameter_set_data() as
@@ -274,7 +274,7 @@
 } VAEncSequenceParameterBufferH264;
 
 /**
- * \brief Picture parameter for H.264 encoding in baseline, main & high 
+ * \brief Picture parameter for H.264 encoding in baseline, main & high
  * profiles.
  *
  * This structure holds information for \c pic_parameter_set_rbsp() as
@@ -554,7 +554,7 @@
 /**@}*/
 
 /**
- * \brief Macroblock parameter for H.264 encoding in baseline, main & high 
+ * \brief Macroblock parameter for H.264 encoding in baseline, main & high
  * profiles.
  *
  * This structure holds per-macroblock information. The buffer must be
@@ -623,8 +623,7 @@
  * Specifies MB partition modes that are disabled. Specifies Half-pel
  * mode and Quarter-pel mode searching
  */
-typedef struct _VAEncMiscParameterSubMbPartPelH264
-{
+typedef struct _VAEncMiscParameterSubMbPartPelH264 {
     uint32_t disable_inter_sub_mb_partition;
     union {
         struct {
@@ -637,7 +636,7 @@
             uint32_t disable_4x4_inter_mb_partition          : 1;
             uint32_t reserved                                : 1;
         } bits;
-         uint8_t value;
+        uint8_t value;
     } inter_sub_mb_partition_mask;
 
     /**
diff --git a/va/va_enc_hevc.h b/va/va_enc_hevc.h
index ed73b91..96b5ae5 100644
--- a/va/va_enc_hevc.h
+++ b/va/va_enc_hevc.h
@@ -678,7 +678,7 @@
             /** \brief Corresponds to HEVC syntax element of the same name. */
             uint32_t    transform_skip_enabled_flag                    : 1;
             /** \brief Corresponds to HEVC syntax element of the same name. */
-            uint32_t    cu_qp_delta_enabled_flag	               : 1;
+            uint32_t    cu_qp_delta_enabled_flag                   : 1;
             /** \brief Corresponds to HEVC syntax element of the same name. */
             uint32_t    weighted_pred_flag                             : 1;
             /** \brief Corresponds to HEVC syntax element of the same name. */
@@ -861,7 +861,7 @@
             /** \brief Corresponds to HEVC syntax element of the same name. */
             uint32_t    mvd_l1_zero_flag                               : 1;
             /** \brief Corresponds to HEVC syntax element of the same name. */
-            uint32_t    cabac_init_flag        	                    : 1;
+            uint32_t    cabac_init_flag                             : 1;
             /** \brief Corresponds to HEVC syntax element of the same name. */
             uint32_t    slice_deblocking_filter_disabled_flag          : 2;
             /** \brief Corresponds to HEVC syntax element of the same name. */
@@ -889,7 +889,7 @@
     */
     uint32_t                pred_weight_table_bit_length;
     /** \brief Reserved bytes for future use, must be zero */
-    uint32_t                va_reserved[VA_PADDING_MEDIUM-2];
+    uint32_t                va_reserved[VA_PADDING_MEDIUM - 2];
     /**@}*/
 } VAEncSliceParameterBufferHEVC;
 
@@ -905,8 +905,7 @@
  *
  * Matrix entries are in raster scan order which follows HEVC spec.
  */
-typedef struct _VAQMatrixBufferHEVC
-{
+typedef struct _VAQMatrixBufferHEVC {
     /**
      * \brief scaling lists,
      * corresponds to same HEVC spec syntax element
diff --git a/va/va_enc_jpeg.h b/va/va_enc_jpeg.h
index e8e69ad..ec02191 100644
--- a/va/va_enc_jpeg.h
+++ b/va/va_enc_jpeg.h
@@ -48,8 +48,7 @@
  * This structure conveys picture level parameters.
  *
  */
-typedef struct  _VAEncPictureParameterBufferJPEG
-{
+typedef struct  _VAEncPictureParameterBufferJPEG {
     /** \brief holds reconstructed picture. */
     VASurfaceID reconstructed_picture;
     /** \brief picture width. */
@@ -59,36 +58,36 @@
     /** \brief holds coded data. */
     VABufferID coded_buf;
 
-    /** 
+    /**
      * \brief pic_flags
      *
      */
     union {
         struct {
-            /** 
-             * \brief profile: 
+            /**
+             * \brief profile:
              * 0 - Baseline, 1 - Extended, 2 - Lossless, 3 - Hierarchical
-             */ 
+             */
             uint32_t profile     : 2;
-            /** 
-             * \brief progressive: 
+            /**
+             * \brief progressive:
              * 0 - sequential, 1 - extended, 2 - progressive
-             */ 
+             */
             uint32_t progressive : 1;
-            /** 
-             * \brief huffman: 
+            /**
+             * \brief huffman:
              * 0 - arithmetic, 1 - huffman
-             */ 
+             */
             uint32_t huffman     : 1;
-            /** 
-             * \brief interleaved: 
+            /**
+             * \brief interleaved:
              * 0 - non interleaved, 1 - interleaved
-             */ 
+             */
             uint32_t interleaved : 1;
-            /** 
-             * \brief differential: 
+            /**
+             * \brief differential:
              * 0 - non differential, 1 - differential
-             */ 
+             */
             uint32_t differential   : 1;
         } bits;
         uint32_t value;
@@ -113,7 +112,7 @@
 
 
 /**
- * \brief Slice parameter for JPEG encoding. 
+ * \brief Slice parameter for JPEG encoding.
  *
  * This structure conveys slice (scan) level parameters.
  *
@@ -140,8 +139,7 @@
  * \brief Quantization table for JPEG encoding.
  *
  */
-typedef struct _VAQMatrixBufferJPEG
-{
+typedef struct _VAQMatrixBufferJPEG {
     /** \brief load luma quantization table. */
     int32_t load_lum_quantiser_matrix;
     /** \brief load chroma quantization table. */
diff --git a/va/va_enc_mpeg2.h b/va/va_enc_mpeg2.h
index 43663bd..669df03 100644
--- a/va/va_enc_mpeg2.h
+++ b/va/va_enc_mpeg2.h
@@ -94,8 +94,8 @@
     uint32_t ip_period;
     /** \brief Picture width.
      *
-     * A 14bits unsigned inter, the lower 12bits 
-     * is horizontal_size_value, and the upper 
+     * A 14bits unsigned inter, the lower 12bits
+     * is horizontal_size_value, and the upper
      * 2bits is \c horizontal_size_extension
      *
      */
@@ -103,7 +103,7 @@
     /** \brief Picture height.
      *
      * A 14bits unsigned inter, the lower 12bits
-     * is vertical_size_value, and the upper 2bits is 
+     * is vertical_size_value, and the upper 2bits is
      * vertical_size_size_extension
      *
      */
@@ -122,8 +122,8 @@
     uint32_t bits_per_second;
     /**
      * \brief Frame rate
-     * 
-     * Derived from frame_rate_value, frame_rate_extension_n and 
+     *
+     * Derived from frame_rate_value, frame_rate_extension_n and
      * frame_rate_extension_d
      *
      */
@@ -173,7 +173,7 @@
 /**
  * \brief Picture parameter for MPEG-2 encoding
  *
- * This structure holds information for picture_header() and 
+ * This structure holds information for picture_header() and
  * picture_coding_extension()
  *
  * If packed picture headers mode is used, i.e. if the encoding
@@ -204,8 +204,8 @@
     /**
      * \brief Flag to indicate the picture is the last one or not.
      *
-     * This fields holds 0 if the picture to be encoded is not 
-     * the last one in the stream. Otherwise, it 
+     * This fields holds 0 if the picture to be encoded is not
+     * the last one in the stream. Otherwise, it
      * is \ref MPEG2_LAST_PICTURE_EOSTREAM.
      */
     uint8_t last_picture;
@@ -220,13 +220,13 @@
     union {
         struct {
             /** \brief Same as the element in Picture coding extension */
-            uint32_t intra_dc_precision             : 2; 
+            uint32_t intra_dc_precision             : 2;
             /** \brief Same as the element in Picture coding extension */
-            uint32_t picture_structure              : 2; 
+            uint32_t picture_structure              : 2;
             /** \brief Same as the element in Picture coding extension */
-            uint32_t top_field_first                : 1; 
+            uint32_t top_field_first                : 1;
             /** \brief Same as the element in Picture coding extension */
-            uint32_t frame_pred_frame_dct           : 1; 
+            uint32_t frame_pred_frame_dct           : 1;
             /** \brief Same as the element in Picture coding extension */
             uint32_t concealment_motion_vectors     : 1;
             /** \brief Same as the element in Picture coding extension */
@@ -251,7 +251,7 @@
      */
     union {
         struct {
-            /** \brief Same as the element in Picture coding extension */            
+            /** \brief Same as the element in Picture coding extension */
             uint32_t v_axis                         : 1;
             /** \brief Same as the element in Picture coding extension */
             uint32_t field_sequence                 : 3;
@@ -287,8 +287,7 @@
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSliceParameterBufferMPEG2;
 
-typedef struct _VAEncMiscParameterExtensionDataSeqDisplayMPEG2
-{
+typedef struct _VAEncMiscParameterExtensionDataSeqDisplayMPEG2 {
     /** should always be 0x02 to identify it is Sequence Display Extension ISO-13818 */
     uint8_t extension_start_code_identifier;
     /** these field should follow ISO-13818 6.3.6 */
diff --git a/va/va_enc_vp8.h b/va/va_enc_vp8.h
index 71cddf3..84ce05f 100644
--- a/va/va_enc_vp8.h
+++ b/va/va_enc_vp8.h
@@ -48,8 +48,7 @@
  * This structure conveys sequence level parameters.
  *
  */
-typedef struct  _VAEncSequenceParameterBufferVP8
-{
+typedef struct  _VAEncSequenceParameterBufferVP8 {
     /* frame width in pixels */
     uint32_t frame_width;
     /* frame height in pixels */
@@ -88,8 +87,8 @@
     uint32_t intra_period;
 
     /* reference and reconstructed frame buffers
-     * Used for driver auto reference management when configured through 
-     * VAConfigAttribEncAutoReference. 
+     * Used for driver auto reference management when configured through
+     * VAConfigAttribEncAutoReference.
      */
     VASurfaceID reference_frames[4];
 
@@ -104,14 +103,13 @@
  * This structure conveys picture level parameters.
  *
  */
-typedef struct  _VAEncPictureParameterBufferVP8
-{
+typedef struct  _VAEncPictureParameterBufferVP8 {
     /* surface to store reconstructed frame  */
     VASurfaceID reconstructed_frame;
 
-    /* 
+    /*
      * surfaces to store reference frames in non auto reference mode
-     * VA_INVALID_SURFACE can be used to denote an invalid reference frame. 
+     * VA_INVALID_SURFACE can be used to denote an invalid reference frame.
      */
     VASurfaceID ref_last_frame;
     VASurfaceID ref_gf_frame;
@@ -156,7 +154,7 @@
             uint32_t version                        : 3;
             /* show_frame */
             uint32_t show_frame                     : 1;
-            /* color_space */						   
+            /* color_space */
             uint32_t color_space                    : 1;
             /*  0: bicubic, 1: bilinear, other: none */
             uint32_t recon_filter_type              : 2;
@@ -167,36 +165,36 @@
             /* same as log2_nbr_of_dct_partitions in frame header syntax */
             uint32_t num_token_partitions           : 2;
 
-            /** 
-             * The following fields correspond to the same VP8 syntax elements 
+            /**
+             * The following fields correspond to the same VP8 syntax elements
              * in the frame header.
              */
-	    /**
-             * 0: clamping of reconstruction pixels is disabled,
-             * 1: clamping enabled.
-             */
+            /**
+                 * 0: clamping of reconstruction pixels is disabled,
+                 * 1: clamping enabled.
+                 */
             uint32_t clamping_type                  : 1;
             /* indicate segmentation is enabled for the current frame. */
             uint32_t segmentation_enabled           : 1;
             /**
-             * Determines if the MB segmentation map is updated in the current 
+             * Determines if the MB segmentation map is updated in the current
              * frame.
              */
             uint32_t update_mb_segmentation_map     : 1;
             /**
-             * Indicates if the segment feature data is updated in the current 
+             * Indicates if the segment feature data is updated in the current
              * frame.
              */
             uint32_t update_segment_feature_data    : 1;
             /**
-             * indicates if the MB level loop filter adjustment is enabled for 
-             * the current frame (0 off, 1 on).  
+             * indicates if the MB level loop filter adjustment is enabled for
+             * the current frame (0 off, 1 on).
              */
-	    uint32_t loop_filter_adj_enable         : 1;
+            uint32_t loop_filter_adj_enable         : 1;
             /**
-             * Determines whether updated token probabilities are used only for 
-             * this frame or until further update. 
-             * It may be used by application to enable error resilient mode. 
+             * Determines whether updated token probabilities are used only for
+             * this frame or until further update.
+             * It may be used by application to enable error resilient mode.
              * In this mode probability updates are allowed only at Key Frames.
              */
             uint32_t refresh_entropy_probs          : 1;
@@ -204,13 +202,13 @@
              * Determines if the current decoded frame refreshes the golden frame.
              */
             uint32_t refresh_golden_frame           : 1;
-            /** 
-             * Determines if the current decoded frame refreshes the alternate 
+            /**
+             * Determines if the current decoded frame refreshes the alternate
              * reference frame.
              */
             uint32_t refresh_alternate_frame        : 1;
             /**
-             * Determines if the current decoded frame refreshes the last frame 
+             * Determines if the current decoded frame refreshes the last frame
              * reference buffer.
              */
             uint32_t refresh_last                   : 1;
@@ -222,29 +220,29 @@
              * Determines if the alternate reference is replaced by another reference.
              */
             uint32_t copy_buffer_to_alternate       : 2;
-            /** 
-             * Controls the sign of motion vectors when the golden frame is referenced.  
+            /**
+             * Controls the sign of motion vectors when the golden frame is referenced.
              */
             uint32_t sign_bias_golden               : 1;
             /**
-             * Controls the sign of motion vectors when the alternate frame is 
-             * referenced. 
+             * Controls the sign of motion vectors when the alternate frame is
+             * referenced.
              */
-	    uint32_t sign_bias_alternate            : 1;
+            uint32_t sign_bias_alternate            : 1;
             /**
-             * Enables or disables the skipping of macroblocks containing no 
-             * non-zero coefficients. 
+             * Enables or disables the skipping of macroblocks containing no
+             * non-zero coefficients.
              */
-	    uint32_t mb_no_coeff_skip               : 1;
-            /** 
-             * Enforces unconditional per-MB loop filter delta update setting frame 
-             * header flags mode_ref_lf_delta_update, all mb_mode_delta_update_flag[4], 
-             * and all ref_frame_delta_update_flag[4] to 1. 
-	     * Since loop filter deltas are not automatically refreshed to default 
-             * values at key frames, dropped frame with delta update may prevent 
-             * correct decoding from the next key frame. 
-	     * Encoder application is advised to set this flag to 1 at key frames.
-	     */
+            uint32_t mb_no_coeff_skip               : 1;
+            /**
+             * Enforces unconditional per-MB loop filter delta update setting frame
+             * header flags mode_ref_lf_delta_update, all mb_mode_delta_update_flag[4],
+             * and all ref_frame_delta_update_flag[4] to 1.
+            * Since loop filter deltas are not automatically refreshed to default
+             * values at key frames, dropped frame with delta update may prevent
+             * correct decoding from the next key frame.
+            * Encoder application is advised to set this flag to 1 at key frames.
+            */
             uint32_t forced_lf_adjustment           : 1;
             uint32_t reserved                       : 2;
         } bits;
@@ -254,44 +252,44 @@
     /**
      * Contains a list of 4 loop filter level values (updated value if applicable)
      * controlling the deblocking filter strength. Each entry represents a segment.
-     * When segmentation is disabled, use entry 0. 
-     * When loop_filter_level is 0, loop filter shall be disabled. 
+     * When segmentation is disabled, use entry 0.
+     * When loop_filter_level is 0, loop filter shall be disabled.
      */
     int8_t loop_filter_level[4];
 
-    /** 
-     * Contains a list of 4 delta values for reference frame based MB-level 
-     * loop filter adjustment.  
+    /**
+     * Contains a list of 4 delta values for reference frame based MB-level
+     * loop filter adjustment.
      * If no update, then set to 0.
      */
     int8_t ref_lf_delta[4];
 
     /**
      * Contains a list of 4 delta values for coding mode based MB-level loop
-     * filter adjustment.  
-     * If no update, then set to 0. 
+     * filter adjustment.
+     * If no update, then set to 0.
      */
     int8_t mode_lf_delta[4];
-	
+
     /**
-     * Controls the deblocking filter sensitivity. 
+     * Controls the deblocking filter sensitivity.
      * Corresponds to the same VP8 syntax element in frame header.
      */
     uint8_t sharpness_level;
-	
-    /** 
-     * Application supplied maximum clamp value for Qindex used in quantization.  
-     * Qindex will not be allowed to exceed this value.  
-     * It has a valid range [0..127] inclusive.  
+
+    /**
+     * Application supplied maximum clamp value for Qindex used in quantization.
+     * Qindex will not be allowed to exceed this value.
+     * It has a valid range [0..127] inclusive.
      */
     uint8_t clamp_qindex_high;
-	
+
     /**
-     * Application supplied minimum clamp value for Qindex used in quantization.  
-     * Qindex will not be allowed to be lower than this value.  
-     * It has a valid range [0..127] inclusive.  
-     * Condition clamp_qindex_low <= clamp_qindex_high must be guaranteed, 
-     * otherwise they are ignored. 
+     * Application supplied minimum clamp value for Qindex used in quantization.
+     * Qindex will not be allowed to be lower than this value.
+     * It has a valid range [0..127] inclusive.
+     * Condition clamp_qindex_low <= clamp_qindex_high must be guaranteed,
+     * otherwise they are ignored.
      */
     uint8_t clamp_qindex_low;
 
@@ -303,15 +301,14 @@
 /**
  * \brief VP8 MB Segmentation ID Buffer
  *
- * application provides buffer containing the initial segmentation id for each 
+ * application provides buffer containing the initial segmentation id for each
  * MB, in raster scan order. Rate control may reassign it.
- * For an 640x480 video, the buffer has 1200 entries. 
+ * For an 640x480 video, the buffer has 1200 entries.
  * the value of each entry should be in the range [0..3], inclusive.
- * If segmentation is not enabled, application does not need to provide it. 
+ * If segmentation is not enabled, application does not need to provide it.
  */
-typedef struct _VAEncMBMapBufferVP8
-{
-    /** 
+typedef struct _VAEncMBMapBufferVP8 {
+    /**
      * number of MBs in the frame.
      * It is also the number of entries of mb_segment_id[];
      */
@@ -329,13 +326,12 @@
 /**
  * \brief VP8 Quantization Matrix Buffer Structure
  *
- * Contains quantization index for yac(0-3) for each segment and quantization 
- * index deltas, ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied 
- * to all segments.  When segmentation is disabled, only quantization_index[0] 
+ * Contains quantization index for yac(0-3) for each segment and quantization
+ * index deltas, ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied
+ * to all segments.  When segmentation is disabled, only quantization_index[0]
  * will be used. This structure is sent once per frame.
  */
-typedef struct _VAQMatrixBufferVP8
-{
+typedef struct _VAQMatrixBufferVP8 {
     uint16_t quantization_index[4];
     int16_t quantization_index_delta[5];
 
diff --git a/va/va_enc_vp9.h b/va/va_enc_vp9.h
index 0539f4d..107ab0c 100644
--- a/va/va_enc_vp9.h
+++ b/va/va_enc_vp9.h
@@ -55,20 +55,19 @@
  * buffer segment of status data.
  * Application accesses it by calling VAMapBuffer() with VAEncCodedBufferType.
  */
-typedef struct  _VACodedBufferVP9Status
-{
+typedef struct  _VACodedBufferVP9Status {
     /** Final quantization index used (yac), determined by BRC.
      *  Application is providing quantization index deltas
      *  ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied to all segments
      *  and segmentation qi deltas, they will not be changed by BRC.
      */
-    uint16_t 	base_qp_index;
+    uint16_t    base_qp_index;
 
     /** Final loopfilter levels for the frame, if segmentation is disabled only
      *  index 0 is used.
      *  If loop_filter_level is 0, it indicates loop filter is disabled.
      */
-    uint8_t 	loop_filter_level;
+    uint8_t     loop_filter_level;
 
     /**
      * Long term reference frame indication from BRC.  BRC recommends the
@@ -78,10 +77,10 @@
     uint8_t     long_term_indication;
 
     /* suggested next frame width */
-    uint16_t	next_frame_width;
+    uint16_t    next_frame_width;
 
     /* suggested next frame height */
-    uint16_t	next_frame_height;
+    uint16_t    next_frame_height;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
@@ -93,8 +92,7 @@
  * This structure conveys sequence level parameters.
  *
  */
-typedef struct  _VAEncSequenceParameterBufferVP9
-{
+typedef struct  _VAEncSequenceParameterBufferVP9 {
     /** \brief Frame size note:
      *  Picture resolution may change frame by frame.
      *  Application needs to allocate surfaces and frame buffers based on
@@ -149,8 +147,7 @@
  * This structure conveys picture level parameters.
  *
  */
-typedef struct  _VAEncPictureParameterBufferVP9
-{
+typedef struct  _VAEncPictureParameterBufferVP9 {
     /** VP9 encoder may support dynamic scaling function.
      *  If enabled (enable_dynamic_scaling is set), application may request
      *  GPU encodes picture with a different resolution from the raw source.
@@ -183,7 +180,7 @@
      */
     VASurfaceID reference_frames[8];
 
-	  /* buffer to store coded data */
+    /* buffer to store coded data */
     VABufferID  coded_buf;
 
     union {
@@ -252,7 +249,7 @@
 
             /** \brief show_frame
              *  0: current frame is not for display
-	           *  1: current frame is for display
+               *  1: current frame is for display
              */
             uint32_t    show_frame                     : 1;
 
@@ -326,9 +323,9 @@
             uint32_t    lossless_mode                  : 1;
 
             /** \brief MV prediction mode. Corresponds to VP9 variable with same name.
-             *  comp_prediction_mode = 0:		single prediction ony,
-             *  comp_prediction_mode = 1:		compound prediction,
-             *  comp_prediction_mode = 2:		hybrid prediction
+             *  comp_prediction_mode = 0:       single prediction ony,
+             *  comp_prediction_mode = 1:       compound prediction,
+             *  comp_prediction_mode = 2:       hybrid prediction
              *
              *  Not mandatory. App may suggest the setting based on power or
              *  performance. Kernal may use it as a guildline and decide the proper
@@ -518,8 +515,7 @@
 /**
  * \brief Per segment parameters
  */
-typedef struct _VAEncSegParamVP9
-{
+typedef struct _VAEncSegParamVP9 {
     union {
         struct {
             /** \brief Indicates if per segment reference frame indicator is enabled.
@@ -576,8 +572,7 @@
  *  The buffer is created with VABufferType VAQMatrixBufferType.
  *
  */
-typedef struct _VAEncMiscParameterTypeVP9PerSegmantParam
-{
+typedef struct _VAEncMiscParameterTypeVP9PerSegmantParam {
     /**
      *  Parameters for 8 segments.
      */
diff --git a/va/va_fei.h b/va/va_fei.h
index 921e896..5563cc9 100644
--- a/va/va_fei.h
+++ b/va/va_fei.h
@@ -83,8 +83,7 @@
     uint32_t value;
 } VAConfigAttribValStats;
 
-typedef struct _VAPictureStats
-{
+typedef struct _VAPictureStats {
     VASurfaceID picture_id;
     /*
      * see flags below.
@@ -105,8 +104,7 @@
 /** \brief Motion Vector and Statistics frame level controls.
  * common part VAStatsStatisticsParameterBufferType for a MB or CTB
  **/
-typedef struct _VAStatsStatisticsParameter
-{
+typedef struct _VAStatsStatisticsParameter {
     /** \brief Source surface ID.  */
     VAPictureStats  input;
 
diff --git a/va/va_fei_h264.h b/va/va_fei_h264.h
index 08c29c9..ddb8e8c 100644
--- a/va/va_fei_h264.h
+++ b/va/va_fei_h264.h
@@ -44,8 +44,7 @@
  */
 
 /** \brief FEI frame level control buffer for H.264 */
-typedef struct _VAEncMiscParameterFEIFrameControlH264
-{
+typedef struct _VAEncMiscParameterFEIFrameControlH264 {
     uint32_t      function; /* one of the VAConfigAttribFEIFunctionType values */
     /** \brief MB (16x16) control input buffer. It is valid only when (mb_input | mb_size_ctrl)
      * is set to 1. The data in this buffer correspond to the input source. 16x16 MB is in raster scan order,
@@ -100,7 +99,7 @@
      * and all locations within the same group must be either all are chosen or all are skipped.
      * These predefined groups are called search unit (SU).*/
     uint32_t      len_sp                    : 8;
-    uint32_t      reserved0	                : 16;
+    uint32_t      reserved0                 : 16;
     /** \brief defines the bit-mask for disabling sub-partition
      * The lower 4 bits are for the major partitions (sub-macroblock) and the higher 3 bits for minor partitions (with sub-partition for 4x(8x8) sub-macroblocks.
      * xxxxxx1 : 16x16 sub-macroblock disabled
@@ -132,7 +131,7 @@
     /** specifies distortion measure adjustments used for the inter motion search SAD comparison.
      * 00b: none
      * 10b: Haar transform adjusted*/
-    uint32_t      inter_sad 	            : 2;
+    uint32_t      inter_sad                 : 2;
     /** specifies distortion measure adjustments used for the intra motion search SAD comparison.
      * 00b: none
      * 10b: Haar transform adjusted*/
@@ -163,7 +162,7 @@
     /** when this flag is set, extra distortion between the current MB and co-located MB is provided.
      *  Extra distortion output has performance impact, set it only when it is needed.*/
     uint32_t      colocated_mb_distortion   : 1;
-    uint32_t      reserved1	                : 4;
+    uint32_t      reserved1                 : 4;
 
     /** \brief motion search window(ref_width * ref_height) */
     uint32_t      ref_width                 : 8;
@@ -193,8 +192,7 @@
 } VAEncMiscParameterFEIFrameControlH264;
 
 /** \brief FEI MB level control data structure */
-typedef struct _VAEncFEIMBControlH264
-{
+typedef struct _VAEncFEIMBControlH264 {
     /** \brief when set, correposndent MB is coded as intra */
     uint32_t force_to_intra                : 1;
     /** \brief when set, correposndent MB is coded as skip */
@@ -221,8 +219,7 @@
 /** \brief Application can use this definition as reference to allocate the buffer
  * based on MaxNumPredictor returned from attribute VAConfigAttribFEIMVPredictors query.
  **/
-typedef struct _VAEncFEIMVPredictorH264
-{
+typedef struct _VAEncFEIMVPredictorH264 {
     /** \brief Reference index corresponding to the entry of RefPicList0 & RefPicList1 in VAEncSliceParameterBufferH264.
      * Note that RefPicList0 & RefPicList1 needs to be the same for all slices.
      * ref_idx_l0_x : index to RefPicList0; ref_idx_l1_x : index to RefPicList1; x : 0 - MaxNumPredictor.
@@ -271,8 +268,7 @@
  * the exact layout of this buffer is needed for PAK input. App can reuse this buffer,
  * or copy to a different buffer as PAK input, reserved elements must not be modified when used as PAK input.
  **/
-typedef struct _VAEncFEIMBCodeH264
-{
+typedef struct _VAEncFEIMBCodeH264 {
     //DWORD  0~2
     uint32_t    reserved0[3];
 
@@ -284,7 +280,7 @@
     uint32_t    reserved2                : 1;
     uint32_t    field_mb_polarity_flag   : 1;
     uint32_t    mb_type                  : 5;
-    uint32_t    intra_mb_flag	         : 1;
+    uint32_t    intra_mb_flag            : 1;
     uint32_t    field_mb_flag            : 1;
     uint32_t    transform8x8_flag        : 1;
     uint32_t    reserved3                : 1;
@@ -311,11 +307,9 @@
     uint32_t    direct8x8_pattern        : 4;
 
     //DWORD 7 8 and 9
-    union
-    {
+    union {
         /* Intra MBs */
-        struct
-        {
+        struct {
             uint32_t   luma_intra_pred_modes0 : 16;
             uint32_t   luma_intra_pred_modes1 : 16;
 
@@ -329,8 +323,7 @@
         } intra_mb;
 
         /* Inter MBs */
-        struct
-        {
+        struct {
             uint32_t   sub_mb_shapes          : 8;
             uint32_t   sub_mb_pred_modes      : 8;
             uint32_t   reserved7              : 16;
@@ -378,9 +371,8 @@
 /** \brief Motion Vector and Statistics frame level controls.
  * VAStatsStatisticsParameterBufferType for H264 16x16 block
  **/
-typedef struct _VAStatsStatisticsParameterH264
-{
-   VAStatsStatisticsParameter stats_params;
+typedef struct _VAStatsStatisticsParameterH264 {
+    VAStatsStatisticsParameter stats_params;
 
     uint32_t    frame_qp                    : 8;
     /** \brief length of search path */
@@ -415,7 +407,7 @@
      * 11b: reserved
      **/
     uint32_t    intra_sad                   : 2;
-    uint32_t    adaptive_search	            : 1;
+    uint32_t    adaptive_search             : 1;
     /** \brief indicate if future or/and past MV in mv_predictor buffer is valid.
      * 0: MV predictor disabled
      * 1: MV predictor enabled for past reference
@@ -457,7 +449,7 @@
     uint32_t    reserved2                   : 12;
 
     /** \brief MVOutput. When set to 1, MV output is NOT provided */
-    uint32_t	disable_mv_output           : 1;
+    uint32_t    disable_mv_output           : 1;
     /** \brief StatisticsOutput. When set to 1, Statistics output is NOT provided. */
     uint32_t    disable_statistics_output   : 1;
     /** \brief block 8x8 data enabling in statistics output */
@@ -472,8 +464,7 @@
  * The 16x16 block is in raster scan order. The buffer size shall be greater than or equal to
  * the number of 16x16 blocks multiplied by sizeof(VAStatsStatisticsH264).
  **/
-typedef struct _VAStatsStatisticsH264
-{
+typedef struct _VAStatsStatisticsH264 {
     /** \brief past reference  */
     uint32_t    best_inter_distortion0 : 16;
     uint32_t    inter_mode0            : 16;
diff --git a/va/va_fei_hevc.h b/va/va_fei_hevc.h
index 4032ee7..6ba9047 100644
--- a/va/va_fei_hevc.h
+++ b/va/va_fei_hevc.h
@@ -45,10 +45,9 @@
  */
 
 /** \brief FEI frame level control buffer for HEVC */
-typedef struct _VAEncMiscParameterFEIFrameControlHEVC
-{
+typedef struct _VAEncMiscParameterFEIFrameControlHEVC {
     /* one of the VAConfigAttribFEIFunctionType values */
-    uint32_t      function; 
+    uint32_t      function;
     /** \brief CTB control input buffer. It is valid only when per_ctb_input
      * is set to 1. The data in this buffer correspond to the input source. CTB is in raster scan order,
      * each CTB control data structure is defined by VAEncFEICTBControlHEVC.
@@ -95,7 +94,7 @@
     /** \brief control parameters */
     uint32_t      search_path               : 8;
     uint32_t      len_sp                    : 8;
-    uint32_t      reserved0	                : 16;
+    uint32_t      reserved0                 : 16;
 
     /** \brief multi pred l0/1
      * 0000: no internal MV predictor will be used
@@ -125,7 +124,7 @@
     uint32_t      per_block_qp              : 1;
     /** \brief enables the per CTB input , if 1, need ctb_ctrl to be a real surface ID*/
     uint32_t      per_ctb_input             : 1;
-    /** when this flag is set, extra distortion between current CTB and co-located CTB is provided. 
+    /** when this flag is set, extra distortion between current CTB and co-located CTB is provided.
      * Extra distortion output has performance impact, set it only when it is needed */
     uint32_t      colocated_ctb_distortion  : 1;
     /** brief specifies whether this CTB should be forced to split to remove Inter big LCU: do not check Inter 32x32
@@ -139,19 +138,19 @@
     /** \brief enables CU64x64 asymmetric motion partition check */
     uint32_t      enable_cu64_amp_check     : 1;
     /** \brief specifies if check the 64x64 merge candidate
-     * 0: after skip check, 
-     * 1: only skip check for 64x64 
+     * 0: after skip check,
+     * 1: only skip check for 64x64
      Default: 0. This field is used by LCU64 bi-directional.
      **/
     uint32_t      cu64_skip_check_only      : 1;
-    uint32_t      reserved1	            : 11;
+    uint32_t      reserved1             : 11;
     /** specifies the search region width in pixels.
      *  When bidirectional search is enabled, this applies to both search regions */
     uint32_t      ref_width                 : 8;
-    /** specifies the reference region height in pixels. When bidirectional search is enabled, 
+    /** specifies the reference region height in pixels. When bidirectional search is enabled,
      * this applies to both search regions. */
     uint32_t      ref_height                : 8;
-    /** \brief search window similar for AVC 
+    /** \brief search window similar for AVC
      *  defines predefined search windows. If it is selected, RefWidth, RefHeight, LenSP and SearchPath are ignored.
      *  0 : not use predefined search window
      *  1 : Tiny – (4 SUs) 24x24 window diamond search
@@ -192,14 +191,13 @@
  * based on MaxNumPredictor returned from attribute VAConfigAttribFEIMVPredictors query.
  * this buffer allocation is always based on 16x16 block even block size is indicated as 32x32 or 64x64, and buffer
  * layout is always in 32x32 block raster scan order even block size is 16x16 or 64x64. If 32x32 block size is set,
- * only the data in the first 16x16 block (block 0) is used for 32x32 block. If 64x64 block size is set 
+ * only the data in the first 16x16 block (block 0) is used for 32x32 block. If 64x64 block size is set
  * MV layout is still in 32x32 raster scan order, the same as 32x32 and the first 16x16
  * block within each 32x32 block needs to have intended MV data (four 32x32 blocks will have the same MV data in the
  * correspondent first 16x16 block). Data structure for each 16x16 block is defined as below (same as AVC except
  * BlockSize/Reserved bits).
  **/
-typedef struct _VAEncFEIMVPredictorHEVC
-{
+typedef struct _VAEncFEIMVPredictorHEVC {
     /** \brief Feference index corresponding to the entry of RefPicList0 & RefPicList1 in slice header (final reference
      * list). Note that RefPicList0 & RefPicList1 needs to be the same for all slices.
      * Ref0xIndex – RefPicList0; Ref1xIndex – RefPicList1; x – 0 ~ MaxNumPredictor */
@@ -219,8 +217,7 @@
 } VAEncFEIMVPredictorHEVC;    //40 bytes
 
 /** \brief FEI CTB level control data structure */
-typedef struct _VAEncFEICTBControlHEVC
-{
+typedef struct _VAEncFEICTBControlHEVC {
     // DWORD 0
     uint32_t    force_to_intra      : 1;
     uint32_t    force_to_inter      : 1;
@@ -240,13 +237,12 @@
  * It is output buffer of ENC and ENC_PAK modes, The CTB block is in raster scan order.
  * Buffer size shall not be less than the number of CTB blocks multiple by sizeof(VAEncFEIDistortionHevc).
  **/
-typedef struct _VAEncFEIDistortionHevc
-{
+typedef struct _VAEncFEIDistortionHevc {
     /** best CTB distortion */
     uint32_t    best_distortion;
     /** only when colocated_ctb_distortion in VAEncMiscParameterFEIFrameControlHEVC is set */
     uint32_t    colocated_ctb_distortion;
-} VAEncFEIDistortionHevc;  
+} VAEncFEIDistortionHevc;
 #ifdef __cplusplus
 }
 #endif
diff --git a/va/va_fool.c b/va/va_fool.c
index e2729cc..fc2e1e9 100644
--- a/va/va_fool.c
+++ b/va/va_fool.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -78,7 +78,7 @@
     char *segbuf_jpg; /* the segment buffer of coded buffer, load frome fn_jpg */
 
     VAEntrypoint entrypoint; /* current entrypoint */
-    
+
     /* all buffers with same type share one malloc-ed memory
      * bufferID = (buffer numbers with the same type << 8) || type
      * the malloc-ed memory can be find by fool_buf[bufferID & 0xff]
@@ -109,15 +109,15 @@
     char env_value[1024];
 
     struct fool_context *fool_ctx = calloc(sizeof(struct fool_context), 1);
-    
+
     if (fool_ctx == NULL)
         return;
-    
+
     if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) {
         va_fool_postp = 1;
         va_infoMessage(dpy, "LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n");
     }
-    
+
     if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) {
         va_fool_codec  |= VA_FOOL_FLAG_DECODE;
         va_infoMessage(dpy, "LIBVA_FOOL_DECODE is on, dummy decode\n");
@@ -134,7 +134,7 @@
         va_infoMessage(dpy, "LIBVA_FOOL_JPEG is on, load encode data from file with patten %s\n",
                        fool_ctx->fn_jpg);
     }
-    
+
     ((VADisplayContextP)dpy)->vafool = fool_ctx;
 }
 
@@ -159,23 +159,23 @@
 
     free(fool_ctx);
     ((VADisplayContextP)dpy)->vafool = NULL;
-    
+
     return 0;
 }
 
 int va_FoolCreateConfig(
-        VADisplay dpy,
-        VAProfile profile, 
-        VAEntrypoint entrypoint, 
-        VAConfigAttrib *attrib_list,
-        int num_attribs,
-        VAConfigID *config_id /* out */
+    VADisplay dpy,
+    VAProfile profile,
+    VAEntrypoint entrypoint,
+    VAConfigAttrib *attrib_list,
+    int num_attribs,
+    VAConfigID *config_id /* out */
 )
 {
     DPY2FOOLCTX(dpy);
 
     fool_ctx->entrypoint = entrypoint;
-    
+
     /*
      * check va_fool_codec to align with current context
      * e.g. va_fool_codec = decode then for encode, the
@@ -203,19 +203,19 @@
     else
         va_infoMessage(dpy, "FOOL is not enabled for this context\n");
 
-    
+
     return 0; /* continue */
 }
 
 
 VAStatus va_FoolCreateBuffer(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferType type,		/* in */
-    unsigned int size,		/* in */
-    unsigned int num_elements,	/* in */
-    void *data,			/* in */
-    VABufferID *buf_id		/* out */
+    VAContextID context,    /* in */
+    VABufferType type,      /* in */
+    unsigned int size,      /* in */
+    unsigned int num_elements,  /* in */
+    void *data,         /* in */
+    VABufferID *buf_id      /* out */
 )
 {
     unsigned int new_size = size * num_elements;
@@ -226,11 +226,11 @@
 
     if (old_size < new_size)
         fool_ctx->fool_buf[type] = realloc(fool_ctx->fool_buf[type], new_size);
-    
+
     fool_ctx->fool_buf_size[type] = size;
     fool_ctx->fool_buf_element[type] = num_elements;
     fool_ctx->fool_buf_count[type]++;
-    /* because we ignore the vaRenderPicture, 
+    /* because we ignore the vaRenderPicture,
      * all buffers with same type share same real memory
      * bufferID = (magic number) | type
      */
@@ -248,17 +248,17 @@
 )
 {
     unsigned int magic;
-    
+
     DPY2FOOLCTX_CHK(dpy);
 
     magic = buf_id & FOOL_BUFID_MASK;
     if (magic != FOOL_BUFID_MAGIC)
         return 0; /* could be VAImageBufferType from vaDeriveImage */
-    
+
     *type = buf_id & 0xff;
     *size = fool_ctx->fool_buf_size[*type];
     *num_elements = fool_ctx->fool_buf_element[*type];;
-    
+
     return 1; /* fool is valid */
 }
 
@@ -271,7 +271,7 @@
     ssize_t ret;
 
     /* try file_name.file_count, if fail, try file_name.file_count-- */
-    for (i=0; i<=1; i++) {
+    for (i = 0; i <= 1; i++) {
         snprintf(file_name, 1024, "%s.%d",
                  fool_ctx->fn_enc,
                  fool_ctx->file_count);
@@ -348,15 +348,15 @@
         va_FoolFillCodedBufEnc(dpy, fool_ctx);
     else if (fool_ctx->entrypoint == VAEntrypointEncPicture)
         va_FoolFillCodedBufJPG(dpy, fool_ctx);
-        
+
     return 0;
 }
 
 
 VAStatus va_FoolMapBuffer(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
-    void **pbuf 	/* out */
+    VABufferID buf_id,  /* in */
+    void **pbuf     /* out */
 )
 {
     unsigned int magic, buftype;
@@ -365,14 +365,14 @@
     magic = buf_id & FOOL_BUFID_MASK;
     if (magic != FOOL_BUFID_MAGIC)
         return 0; /* could be VAImageBufferType from vaDeriveImage */
-    
+
     buftype = buf_id & 0xff;
     *pbuf = fool_ctx->fool_buf[buftype];
 
     /* it is coded buffer, fill coded segment from file */
     if (*pbuf && (buftype == VAEncCodedBufferType))
         va_FoolFillCodedBuf(dpy, fool_ctx);
-    
+
     return 1; /* fool is valid */
 }
 
diff --git a/va/va_fool.h b/va/va_fool.h
index 23b0fc0..2c33f08 100644
--- a/va/va_fool.h
+++ b/va/va_fool.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -44,44 +44,44 @@
         if (fool_func(__VA_ARGS__))            \
             return VA_STATUS_SUCCESS;          \
     }
-    
+
 void va_FoolInit(VADisplay dpy);
 int va_FoolEnd(VADisplay dpy);
 
 int va_FoolCreateConfig(
-        VADisplay dpy,
-        VAProfile profile, 
-        VAEntrypoint entrypoint, 
-        VAConfigAttrib *attrib_list,
-        int num_attribs,
-        VAConfigID *config_id /* out */
+    VADisplay dpy,
+    VAProfile profile,
+    VAEntrypoint entrypoint,
+    VAConfigAttrib *attrib_list,
+    int num_attribs,
+    VAConfigID *config_id /* out */
 );
 
 
 VAStatus va_FoolCreateBuffer(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferType type,		/* in */
-    unsigned int size,		/* in */
-    unsigned int num_elements,	/* in */
-    void *data,			/* in */
-    VABufferID *buf_id		/* out */
+    VAContextID context,    /* in */
+    VABufferType type,      /* in */
+    unsigned int size,      /* in */
+    unsigned int num_elements,  /* in */
+    void *data,         /* in */
+    VABufferID *buf_id      /* out */
 );
 
-VAStatus va_FoolMapBuffer (
+VAStatus va_FoolMapBuffer(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
-    void **pbuf 	/* out */
+    VABufferID buf_id,  /* in */
+    void **pbuf     /* out */
 );
 
-VAStatus va_FoolBufferInfo (
+VAStatus va_FoolBufferInfo(
     VADisplay dpy,
     VABufferID buf_id,  /* in */
     VABufferType *type, /* out */
     unsigned int *size,         /* out */
     unsigned int *num_elements /* out */
 );
-    
+
 VAStatus va_FoolCheckContinuity(VADisplay dpy);
 
 #ifdef __cplusplus
diff --git a/va/va_prot.h b/va/va_prot.h
index ae915a6..5c59bb0 100644
--- a/va/va_prot.h
+++ b/va/va_prot.h
@@ -403,45 +403,45 @@
 
 /** \brief TEE Execucte Function ID. */
 typedef enum _VA_TEE_EXEC_FUNCTION_ID {
-  VA_TEE_EXECUTE_FUNCTION_ID_PASS_THROUGH = 0x00000001,
-  VA_TEE_EXECUTE_FUNCTION_ID_GET_FIRMWARE_VERSION = 0x00000002,
+    VA_TEE_EXECUTE_FUNCTION_ID_PASS_THROUGH = 0x00000001,
+    VA_TEE_EXECUTE_FUNCTION_ID_GET_FIRMWARE_VERSION = 0x00000002,
 
 } VA_TEE_EXECUTE_FUNCTION_ID;
 
 /** \brief Input/Output buffer of VAProtectedSessionExecuteBuffer */
 typedef struct _VAProtectedSessionBuffer {
-  /*
-   * This is used when this buffer refer to output buffer. The maximum size of
-   * data that the driver can return in the output buffer. It is not used for
-   * input buffer.
-   */
-  uint32_t max_data_size;
-  /*
-   * If it is used for input buffer, it is the size of the input data. If it is
-   * used for output buffer, it is the returns size of the output data written
-   * by the driver.
-   */
-  uint32_t data_size;
-  /*
-   * data pointer of this buffer
-   */
-  void *data;
-  uint32_t va_reserved[VA_PADDING_LOW];
+    /*
+     * This is used when this buffer refer to output buffer. The maximum size of
+     * data that the driver can return in the output buffer. It is not used for
+     * input buffer.
+     */
+    uint32_t max_data_size;
+    /*
+     * If it is used for input buffer, it is the size of the input data. If it is
+     * used for output buffer, it is the returns size of the output data written
+     * by the driver.
+     */
+    uint32_t data_size;
+    /*
+     * data pointer of this buffer
+     */
+    void *data;
+    uint32_t va_reserved[VA_PADDING_LOW];
 } VAProtectedSessionBuffer;
 
 /** \brief Buffer for vaProtectedSessionExecute() */
 typedef struct _VAProtectedSessionExecuteBuffer {
-  /** \brief Specify the function to execute. It is IHV's implementation
-   * specific */
-  uint32_t function_id;
-  /** \brief Input buffer */
-  VAProtectedSessionBuffer input;
-  /** \brief Output buffer */
-  VAProtectedSessionBuffer output;
-  /** \brief Return the result of this function. The status result is IHV's
-   * implementation specific */
-  uint32_t status;
-  uint32_t va_reserved[VA_PADDING_LOW];
+    /** \brief Specify the function to execute. It is IHV's implementation
+     * specific */
+    uint32_t function_id;
+    /** \brief Input buffer */
+    VAProtectedSessionBuffer input;
+    /** \brief Output buffer */
+    VAProtectedSessionBuffer output;
+    /** \brief Return the result of this function. The status result is IHV's
+     * implementation specific */
+    uint32_t status;
+    uint32_t va_reserved[VA_PADDING_LOW];
 } VAProtectedSessionExecuteBuffer;
 
 /**
diff --git a/va/va_str.c b/va/va_str.c
index 8884965..475fc8f 100644
--- a/va/va_str.c
+++ b/va/va_str.c
@@ -29,43 +29,44 @@
 const char *vaProfileStr(VAProfile profile)
 {
     switch (profile) {
-    TOSTR(VAProfileNone);
-    TOSTR(VAProfileMPEG2Simple);
-    TOSTR(VAProfileMPEG2Main);
-    TOSTR(VAProfileMPEG4Simple);
-    TOSTR(VAProfileMPEG4AdvancedSimple);
-    TOSTR(VAProfileMPEG4Main);
-    TOSTR(VAProfileH264Main);
-    TOSTR(VAProfileH264High);
-    TOSTR(VAProfileVC1Simple);
-    TOSTR(VAProfileVC1Main);
-    TOSTR(VAProfileVC1Advanced);
-    TOSTR(VAProfileH263Baseline);
-    TOSTR(VAProfileH264ConstrainedBaseline);
-    TOSTR(VAProfileJPEGBaseline);
-    TOSTR(VAProfileVP8Version0_3);
-    TOSTR(VAProfileH264MultiviewHigh);
-    TOSTR(VAProfileH264StereoHigh);
-    TOSTR(VAProfileHEVCMain);
-    TOSTR(VAProfileHEVCMain10);
-    TOSTR(VAProfileVP9Profile0);
-    TOSTR(VAProfileVP9Profile1);
-    TOSTR(VAProfileVP9Profile2);
-    TOSTR(VAProfileVP9Profile3);
-    TOSTR(VAProfileHEVCMain12);
-    TOSTR(VAProfileHEVCMain422_10);
-    TOSTR(VAProfileHEVCMain422_12);
-    TOSTR(VAProfileHEVCMain444);
-    TOSTR(VAProfileHEVCMain444_10);
-    TOSTR(VAProfileHEVCMain444_12);
-    TOSTR(VAProfileHEVCSccMain);
-    TOSTR(VAProfileHEVCSccMain10);
-    TOSTR(VAProfileHEVCSccMain444);
-    TOSTR(VAProfileAV1Profile0);
-    TOSTR(VAProfileAV1Profile1);
-    TOSTR(VAProfileHEVCSccMain444_10);
-    TOSTR(VAProfileProtected);
-    default: break;
+        TOSTR(VAProfileNone);
+        TOSTR(VAProfileMPEG2Simple);
+        TOSTR(VAProfileMPEG2Main);
+        TOSTR(VAProfileMPEG4Simple);
+        TOSTR(VAProfileMPEG4AdvancedSimple);
+        TOSTR(VAProfileMPEG4Main);
+        TOSTR(VAProfileH264Main);
+        TOSTR(VAProfileH264High);
+        TOSTR(VAProfileVC1Simple);
+        TOSTR(VAProfileVC1Main);
+        TOSTR(VAProfileVC1Advanced);
+        TOSTR(VAProfileH263Baseline);
+        TOSTR(VAProfileH264ConstrainedBaseline);
+        TOSTR(VAProfileJPEGBaseline);
+        TOSTR(VAProfileVP8Version0_3);
+        TOSTR(VAProfileH264MultiviewHigh);
+        TOSTR(VAProfileH264StereoHigh);
+        TOSTR(VAProfileHEVCMain);
+        TOSTR(VAProfileHEVCMain10);
+        TOSTR(VAProfileVP9Profile0);
+        TOSTR(VAProfileVP9Profile1);
+        TOSTR(VAProfileVP9Profile2);
+        TOSTR(VAProfileVP9Profile3);
+        TOSTR(VAProfileHEVCMain12);
+        TOSTR(VAProfileHEVCMain422_10);
+        TOSTR(VAProfileHEVCMain422_12);
+        TOSTR(VAProfileHEVCMain444);
+        TOSTR(VAProfileHEVCMain444_10);
+        TOSTR(VAProfileHEVCMain444_12);
+        TOSTR(VAProfileHEVCSccMain);
+        TOSTR(VAProfileHEVCSccMain10);
+        TOSTR(VAProfileHEVCSccMain444);
+        TOSTR(VAProfileAV1Profile0);
+        TOSTR(VAProfileAV1Profile1);
+        TOSTR(VAProfileHEVCSccMain444_10);
+        TOSTR(VAProfileProtected);
+    default:
+        break;
     }
     return "<unknown profile>";
 }
@@ -74,19 +75,19 @@
 const char *vaEntrypointStr(VAEntrypoint entrypoint)
 {
     switch (entrypoint) {
-    TOSTR(VAEntrypointVLD);
-    TOSTR(VAEntrypointIZZ);
-    TOSTR(VAEntrypointIDCT);
-    TOSTR(VAEntrypointMoComp);
-    TOSTR(VAEntrypointDeblocking);
-    TOSTR(VAEntrypointEncSlice);
-    TOSTR(VAEntrypointEncPicture);
-    TOSTR(VAEntrypointEncSliceLP);
-    TOSTR(VAEntrypointVideoProc);
-    TOSTR(VAEntrypointFEI);
-    TOSTR(VAEntrypointStats);
-    TOSTR(VAEntrypointProtectedTEEComm);
-    TOSTR(VAEntrypointProtectedContent);
+        TOSTR(VAEntrypointVLD);
+        TOSTR(VAEntrypointIZZ);
+        TOSTR(VAEntrypointIDCT);
+        TOSTR(VAEntrypointMoComp);
+        TOSTR(VAEntrypointDeblocking);
+        TOSTR(VAEntrypointEncSlice);
+        TOSTR(VAEntrypointEncPicture);
+        TOSTR(VAEntrypointEncSliceLP);
+        TOSTR(VAEntrypointVideoProc);
+        TOSTR(VAEntrypointFEI);
+        TOSTR(VAEntrypointStats);
+        TOSTR(VAEntrypointProtectedTEEComm);
+        TOSTR(VAEntrypointProtectedContent);
     }
     return "<unknown entrypoint>";
 }
@@ -94,56 +95,57 @@
 const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
 {
     switch (configAttribType) {
-    TOSTR(VAConfigAttribRTFormat);
-    TOSTR(VAConfigAttribSpatialResidual);
-    TOSTR(VAConfigAttribSpatialClipping);
-    TOSTR(VAConfigAttribIntraResidual);
-    TOSTR(VAConfigAttribEncryption);
-    TOSTR(VAConfigAttribRateControl);
-    TOSTR(VAConfigAttribDecSliceMode);
-    TOSTR(VAConfigAttribEncPackedHeaders);
-    TOSTR(VAConfigAttribEncInterlaced);
-    TOSTR(VAConfigAttribEncMaxRefFrames);
-    TOSTR(VAConfigAttribEncMaxSlices);
-    TOSTR(VAConfigAttribEncSliceStructure);
-    TOSTR(VAConfigAttribEncMacroblockInfo);
-    TOSTR(VAConfigAttribEncJPEG);
-    TOSTR(VAConfigAttribEncQualityRange);
-    TOSTR(VAConfigAttribEncSkipFrame);
-    TOSTR(VAConfigAttribEncROI);
-    TOSTR(VAConfigAttribEncRateControlExt);
-    TOSTR(VAConfigAttribFEIFunctionType);
-    TOSTR(VAConfigAttribFEIMVPredictors);
-    TOSTR(VAConfigAttribDecJPEG);
-    TOSTR(VAConfigAttribMaxPictureWidth);
-    TOSTR(VAConfigAttribMaxPictureHeight);
-    TOSTR(VAConfigAttribEncQuantization);
-    TOSTR(VAConfigAttribEncIntraRefresh);
-    TOSTR(VAConfigAttribProcessingRate);
-    TOSTR(VAConfigAttribEncDirtyRect);
-    TOSTR(VAConfigAttribEncParallelRateControl);
-    TOSTR(VAConfigAttribEncDynamicScaling);
-    TOSTR(VAConfigAttribDecProcessing);
-    TOSTR(VAConfigAttribFrameSizeToleranceSupport);
-    TOSTR(VAConfigAttribEncTileSupport);
-    TOSTR(VAConfigAttribCustomRoundingControl);
-    TOSTR(VAConfigAttribQPBlockSize);
-    TOSTR(VAConfigAttribStats);
-    TOSTR(VAConfigAttribMaxFrameSize);
-    TOSTR(VAConfigAttribPredictionDirection);
-    TOSTR(VAConfigAttribMultipleFrame);
-    TOSTR(VAConfigAttribContextPriority);
-    TOSTR(VAConfigAttribDecAV1Features);
-    TOSTR(VAConfigAttribTEEType);
-    TOSTR(VAConfigAttribTEETypeClient);
-    TOSTR(VAConfigAttribProtectedContentCipherAlgorithm);
-    TOSTR(VAConfigAttribProtectedContentCipherBlockSize);
-    TOSTR(VAConfigAttribProtectedContentCipherMode);
-    TOSTR(VAConfigAttribProtectedContentCipherSampleType);
-    TOSTR(VAConfigAttribProtectedContentUsage);
-    TOSTR(VAConfigAttribEncHEVCFeatures);
-    TOSTR(VAConfigAttribEncHEVCBlockSizes);
-    case VAConfigAttribTypeMax: break;
+        TOSTR(VAConfigAttribRTFormat);
+        TOSTR(VAConfigAttribSpatialResidual);
+        TOSTR(VAConfigAttribSpatialClipping);
+        TOSTR(VAConfigAttribIntraResidual);
+        TOSTR(VAConfigAttribEncryption);
+        TOSTR(VAConfigAttribRateControl);
+        TOSTR(VAConfigAttribDecSliceMode);
+        TOSTR(VAConfigAttribEncPackedHeaders);
+        TOSTR(VAConfigAttribEncInterlaced);
+        TOSTR(VAConfigAttribEncMaxRefFrames);
+        TOSTR(VAConfigAttribEncMaxSlices);
+        TOSTR(VAConfigAttribEncSliceStructure);
+        TOSTR(VAConfigAttribEncMacroblockInfo);
+        TOSTR(VAConfigAttribEncJPEG);
+        TOSTR(VAConfigAttribEncQualityRange);
+        TOSTR(VAConfigAttribEncSkipFrame);
+        TOSTR(VAConfigAttribEncROI);
+        TOSTR(VAConfigAttribEncRateControlExt);
+        TOSTR(VAConfigAttribFEIFunctionType);
+        TOSTR(VAConfigAttribFEIMVPredictors);
+        TOSTR(VAConfigAttribDecJPEG);
+        TOSTR(VAConfigAttribMaxPictureWidth);
+        TOSTR(VAConfigAttribMaxPictureHeight);
+        TOSTR(VAConfigAttribEncQuantization);
+        TOSTR(VAConfigAttribEncIntraRefresh);
+        TOSTR(VAConfigAttribProcessingRate);
+        TOSTR(VAConfigAttribEncDirtyRect);
+        TOSTR(VAConfigAttribEncParallelRateControl);
+        TOSTR(VAConfigAttribEncDynamicScaling);
+        TOSTR(VAConfigAttribDecProcessing);
+        TOSTR(VAConfigAttribFrameSizeToleranceSupport);
+        TOSTR(VAConfigAttribEncTileSupport);
+        TOSTR(VAConfigAttribCustomRoundingControl);
+        TOSTR(VAConfigAttribQPBlockSize);
+        TOSTR(VAConfigAttribStats);
+        TOSTR(VAConfigAttribMaxFrameSize);
+        TOSTR(VAConfigAttribPredictionDirection);
+        TOSTR(VAConfigAttribMultipleFrame);
+        TOSTR(VAConfigAttribContextPriority);
+        TOSTR(VAConfigAttribDecAV1Features);
+        TOSTR(VAConfigAttribTEEType);
+        TOSTR(VAConfigAttribTEETypeClient);
+        TOSTR(VAConfigAttribProtectedContentCipherAlgorithm);
+        TOSTR(VAConfigAttribProtectedContentCipherBlockSize);
+        TOSTR(VAConfigAttribProtectedContentCipherMode);
+        TOSTR(VAConfigAttribProtectedContentCipherSampleType);
+        TOSTR(VAConfigAttribProtectedContentUsage);
+        TOSTR(VAConfigAttribEncHEVCFeatures);
+        TOSTR(VAConfigAttribEncHEVCBlockSizes);
+    case VAConfigAttribTypeMax:
+        break;
     }
     return "<unknown config attribute type>";
 }
@@ -151,58 +153,59 @@
 const char *vaBufferTypeStr(VABufferType bufferType)
 {
     switch (bufferType) {
-    TOSTR(VAPictureParameterBufferType);
-    TOSTR(VAIQMatrixBufferType);
-    TOSTR(VABitPlaneBufferType);
-    TOSTR(VASliceGroupMapBufferType);
-    TOSTR(VASliceParameterBufferType);
-    TOSTR(VASliceDataBufferType);
-    TOSTR(VAMacroblockParameterBufferType);
-    TOSTR(VAResidualDataBufferType);
-    TOSTR(VADeblockingParameterBufferType);
-    TOSTR(VAImageBufferType);
-    TOSTR(VAProtectedSliceDataBufferType);
-    TOSTR(VAQMatrixBufferType);
-    TOSTR(VAHuffmanTableBufferType);
-    TOSTR(VAProbabilityBufferType);
-    TOSTR(VAEncCodedBufferType);
-    TOSTR(VAEncSequenceParameterBufferType);
-    TOSTR(VAEncPictureParameterBufferType);
-    TOSTR(VAEncSliceParameterBufferType);
-    TOSTR(VAEncPackedHeaderParameterBufferType);
-    TOSTR(VAEncPackedHeaderDataBufferType);
-    TOSTR(VAEncMiscParameterBufferType);
-    TOSTR(VAEncMacroblockParameterBufferType);
-    TOSTR(VAEncMacroblockMapBufferType);
-    TOSTR(VAProcPipelineParameterBufferType);
-    TOSTR(VAProcFilterParameterBufferType);
-    TOSTR(VAEncQPBufferType);
-    TOSTR(VAEncFEIMVBufferType);
-    TOSTR(VAEncFEIMBCodeBufferType);
-    TOSTR(VAEncFEIDistortionBufferType);
-    TOSTR(VAEncFEIMBControlBufferType);
-    TOSTR(VAEncFEIMVPredictorBufferType);
-    TOSTR(VAEncMacroblockDisableSkipMapBufferType);
-    TOSTR(VADecodeStreamoutBufferType);
-    TOSTR(VAStatsStatisticsParameterBufferType);
-    TOSTR(VAStatsStatisticsBufferType);
-    TOSTR(VAStatsStatisticsBottomFieldBufferType);
-    TOSTR(VAStatsMVBufferType);
-    TOSTR(VAStatsMVPredictorBufferType);
-    TOSTR(VAEncFEICTBCmdBufferType);
-    TOSTR(VAEncFEICURecordBufferType);
-    TOSTR(VASubsetsParameterBufferType);
-    TOSTR(VAContextParameterUpdateBufferType);
-    TOSTR(VAProtectedSessionExecuteBufferType);
-    TOSTR(VAEncryptionParameterBufferType);
-    case VABufferTypeMax: break;
+        TOSTR(VAPictureParameterBufferType);
+        TOSTR(VAIQMatrixBufferType);
+        TOSTR(VABitPlaneBufferType);
+        TOSTR(VASliceGroupMapBufferType);
+        TOSTR(VASliceParameterBufferType);
+        TOSTR(VASliceDataBufferType);
+        TOSTR(VAMacroblockParameterBufferType);
+        TOSTR(VAResidualDataBufferType);
+        TOSTR(VADeblockingParameterBufferType);
+        TOSTR(VAImageBufferType);
+        TOSTR(VAProtectedSliceDataBufferType);
+        TOSTR(VAQMatrixBufferType);
+        TOSTR(VAHuffmanTableBufferType);
+        TOSTR(VAProbabilityBufferType);
+        TOSTR(VAEncCodedBufferType);
+        TOSTR(VAEncSequenceParameterBufferType);
+        TOSTR(VAEncPictureParameterBufferType);
+        TOSTR(VAEncSliceParameterBufferType);
+        TOSTR(VAEncPackedHeaderParameterBufferType);
+        TOSTR(VAEncPackedHeaderDataBufferType);
+        TOSTR(VAEncMiscParameterBufferType);
+        TOSTR(VAEncMacroblockParameterBufferType);
+        TOSTR(VAEncMacroblockMapBufferType);
+        TOSTR(VAProcPipelineParameterBufferType);
+        TOSTR(VAProcFilterParameterBufferType);
+        TOSTR(VAEncQPBufferType);
+        TOSTR(VAEncFEIMVBufferType);
+        TOSTR(VAEncFEIMBCodeBufferType);
+        TOSTR(VAEncFEIDistortionBufferType);
+        TOSTR(VAEncFEIMBControlBufferType);
+        TOSTR(VAEncFEIMVPredictorBufferType);
+        TOSTR(VAEncMacroblockDisableSkipMapBufferType);
+        TOSTR(VADecodeStreamoutBufferType);
+        TOSTR(VAStatsStatisticsParameterBufferType);
+        TOSTR(VAStatsStatisticsBufferType);
+        TOSTR(VAStatsStatisticsBottomFieldBufferType);
+        TOSTR(VAStatsMVBufferType);
+        TOSTR(VAStatsMVPredictorBufferType);
+        TOSTR(VAEncFEICTBCmdBufferType);
+        TOSTR(VAEncFEICURecordBufferType);
+        TOSTR(VASubsetsParameterBufferType);
+        TOSTR(VAContextParameterUpdateBufferType);
+        TOSTR(VAProtectedSessionExecuteBufferType);
+        TOSTR(VAEncryptionParameterBufferType);
+    case VABufferTypeMax:
+        break;
     }
     return "<unknown buffer type>";
 }
 
 const char *vaStatusStr(VAStatus status)
 {
-    switch(status){
+    switch (status) {
         TOSTR(VA_STATUS_SUCCESS);
         TOSTR(VA_STATUS_ERROR_OPERATION_FAILED);
         TOSTR(VA_STATUS_ERROR_ALLOCATION_FAILED);
@@ -235,7 +238,8 @@
         TOSTR(VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE);
         TOSTR(VA_STATUS_ERROR_NOT_ENOUGH_BUFFER);
         TOSTR(VA_STATUS_ERROR_UNKNOWN);
-        default: break;
+    default:
+        break;
     }
     return "unknown return value";
 }
diff --git a/va/va_tpi.h b/va/va_tpi.h
index 12e0379..fb165ad 100644
--- a/va/va_tpi.h
+++ b/va/va_tpi.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/va_trace.c b/va/va_trace.c
index 8a84499..da62221 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -67,18 +67,18 @@
 static pid_t va_gettid()
 {
 #if defined(__linux__)
-  return syscall(__NR_gettid);
+    return syscall(__NR_gettid);
 #elif defined(__DragonFly__) || defined(__FreeBSD__)
-  return pthread_getthreadid_np();
+    return pthread_getthreadid_np();
 #elif defined(__NetBSD__)
-  return _lwp_self();
+    return _lwp_self();
 #elif defined(__OpenBSD__)
-  return getthrid();
+    return getthrid();
 #elif defined(__sun)
-  return thr_self();
+    return thr_self();
 #else
 #warning "Cannot get kernel thread identifier on this platform."
-  return (intptr_t)pthread_self();
+    return (intptr_t)pthread_self();
 #endif
 }
 
@@ -270,7 +270,7 @@
     VABufferType *type,         /* out */
     unsigned int *size,         /* out */
     unsigned int *num_elements  /* out */
-    );
+);
 
 VAStatus vaLockSurface(VADisplay dpy,
                        VASurfaceID surface,
@@ -283,11 +283,11 @@
                        unsigned int *chroma_v_offset,
                        unsigned int *buffer_name,
                        void **buffer
-                       );
+                      );
 
 VAStatus vaUnlockSurface(VADisplay dpy,
                          VASurfaceID surface
-                         );
+                        );
 
 static int get_valid_config_idx(
     struct va_trace *pva_trace,
@@ -297,7 +297,7 @@
 
     LOCK_RESOURCE(pva_trace);
 
-    for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++) {
+    for (idx = 0; idx < MAX_TRACE_CTX_NUM; idx++) {
         if (pva_trace->config_info[idx].valid &&
             pva_trace->config_info[idx].config_id == config_id)
             break;
@@ -320,7 +320,7 @@
 
     LOCK_RESOURCE(pva_trace);
 
-    for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++) {
+    for (idx = 0; idx < MAX_TRACE_CTX_NUM; idx++) {
         if (!pva_trace->config_info[idx].valid ||
             pva_trace->config_info[idx].config_id == config_id)
             break;
@@ -348,7 +348,7 @@
 
     LOCK_RESOURCE(pva_trace);
 
-    for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++) {
+    for (idx = 0; idx < MAX_TRACE_CTX_NUM; idx++) {
         if (pva_trace->config_info[idx].valid &&
             pva_trace->config_info[idx].config_id == config_id)
             break;
@@ -376,12 +376,12 @@
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0; i < MAX_TRACE_BUF_INFO_HASH_LEVEL; i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info)
+        if (!pbuf_info)
             break;
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id == buf_id) {
             context = pbuf_info[idx].ctx_id;
             break;
@@ -405,19 +405,19 @@
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0; i < MAX_TRACE_BUF_INFO_HASH_LEVEL; i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info) {
+        if (!pbuf_info) {
             pbuf_info = (struct trace_buf_info *)calloc(
-                sizeof(struct trace_buf_info) * MAX_TRACE_BUF_INFO_HASH_SIZE,
-                1);
-            if(!pbuf_info)
+                            sizeof(struct trace_buf_info) * MAX_TRACE_BUF_INFO_HASH_SIZE,
+                            1);
+            if (!pbuf_info)
                 break;
 
             pbuf_mgr->pbuf_info[i] = pbuf_info;
         }
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id != buf_id)
             continue;
 
@@ -427,7 +427,7 @@
         break;
     }
 
-    if(i >= MAX_TRACE_BUF_INFO_HASH_LEVEL)
+    if (i >= MAX_TRACE_BUF_INFO_HASH_LEVEL)
         va_errorMessage(pva_trace->dpy, "Add buf info failed\n");
 
     UNLOCK_RESOURCE(pva_trace);
@@ -444,12 +444,12 @@
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0; i < MAX_TRACE_BUF_INFO_HASH_LEVEL; i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info)
+        if (!pbuf_info)
             break;
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id == buf_id) {
             pbuf_info[idx].valid = 0;
             break;
@@ -493,7 +493,7 @@
 
     LOCK_RESOURCE(pva_trace);
 
-    for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++)
+    for (idx = 0; idx < MAX_TRACE_CTX_NUM; idx++)
         if (!pva_trace->ptra_ctx[idx] ||
             pva_trace->ptra_ctx[idx]->trace_context == context)
             break;
@@ -511,7 +511,7 @@
 
     LOCK_RESOURCE(pva_trace);
 
-    for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++)
+    for (idx = 0; idx < MAX_TRACE_CTX_NUM; idx++)
         if (pva_trace->ptra_ctx[idx] &&
             pva_trace->ptra_ctx[idx]->trace_context == context)
             break;
@@ -535,32 +535,32 @@
     if (suffix_str)
         size = strlen(suffix_str);
 
-    if(left < (size + 8 + 10))
+    if (left < (size + 8 + 10))
         return;
 
-    if(gettimeofday(&tv, NULL) == 0) {
+    if (gettimeofday(&tv, NULL) == 0) {
         sprintf(env_value + tmp,
-            ".%02d%02d%02d.",
-            (unsigned int)(tv.tv_sec/3600)%24,
-            (unsigned int)(tv.tv_sec/60)%60,
-            (unsigned int)tv.tv_sec%60);
+                ".%02d%02d%02d.",
+                (unsigned int)(tv.tv_sec / 3600) % 24,
+                (unsigned int)(tv.tv_sec / 60) % 60,
+                (unsigned int)tv.tv_sec % 60);
 
         tmp += 8;
         left -= 8;
     }
 
-    if(suffix_str) {
+    if (suffix_str) {
         strcat(env_value + tmp,
-            suffix_str);
+               suffix_str);
 
         tmp += size;
         left -= size;
     }
 
-    if(suffix_handle) {
+    if (suffix_handle) {
         sprintf(env_value + tmp,
-            "0x%08x",
-            suffix_handle);
+                "0x%08x",
+                suffix_handle);
     }
 }
 
@@ -570,37 +570,36 @@
     int type) // 0: codedbuf, 1: surface
 {
     char *fn_env = type == 0 ?
-        pva_trace->fn_codedbuf_env : pva_trace->fn_surface_env;
+                   pva_trace->fn_codedbuf_env : pva_trace->fn_surface_env;
     char env_value[1024];
     FILE *fp = NULL;
 
     strncpy(env_value, fn_env, 1024);
     env_value[1023] = '\0';
     FILE_NAME_SUFFIX(env_value, 1024,
-        "ctx-", (unsigned int)ptra_ctx->trace_context);
+                     "ctx-", (unsigned int)ptra_ctx->trace_context);
 
     fn_env = strdup(env_value);
-    if(!fn_env)
+    if (!fn_env)
         return -1;
 
     fp = fopen(fn_env, "w");
-    if(!fp) {
+    if (!fp) {
         free(fn_env);
 
         return -1;
     }
 
-    if(type == 0) {
+    if (type == 0) {
         ptra_ctx->trace_codedbuf_fn = fn_env;
         ptra_ctx->trace_fp_codedbuf = fp;
         va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
-            fn_env);
-    }
-    else {
+                       fn_env);
+    } else {
         ptra_ctx->trace_surface_fn = fn_env;
         ptra_ctx->trace_fp_surface = fp;
         va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_SURFACE is on, save surface into %s\n",
-            fn_env);
+                       fn_env);
     }
 
     return 0;
@@ -614,42 +613,42 @@
     FILE *pfp = NULL;
     int new_fn_flag = 0;
 
-    if(plog_file->used && plog_file->thread_id != thd_id) {
+    if (plog_file->used && plog_file->thread_id != thd_id) {
         va_errorMessage(pva_trace->dpy, "Try to open a busy log file occupied by other thread\n");
 
         return -1;
     }
 
-    if(plog_file->thread_id != thd_id) {
+    if (plog_file->thread_id != thd_id) {
         char env_value[1024];
 
         strncpy(env_value, pva_trace->fn_log_env, 1024);
         env_value[1023] = '\0';
         FILE_NAME_SUFFIX(env_value, 1024,
-            "thd-", (unsigned int)thd_id);
+                         "thd-", (unsigned int)thd_id);
 
-        if(plog_file->fn_log)
+        if (plog_file->fn_log)
             free(plog_file->fn_log);
 
         plog_file->fn_log = strdup(env_value);
-        if(!plog_file->fn_log)
+        if (!plog_file->fn_log)
             goto FAIL;
 
         new_fn_flag = 1;
     }
 
-    if(!plog_file->used) {
-        if(new_fn_flag)
+    if (!plog_file->used) {
+        if (new_fn_flag)
             pfp = fopen(plog_file->fn_log, "w");
         else
             pfp = fopen(plog_file->fn_log, "a");
 
-        if(!pfp)
+        if (!pfp)
             goto FAIL;
 
         va_infoMessage(pva_trace->dpy, "%s %s for the thread 0x%08x\n",
-            new_fn_flag ? "Open new log file" : "Append to log file",
-            plog_file->fn_log, thd_id);
+                       new_fn_flag ? "Open new log file" : "Append to log file",
+                       plog_file->fn_log, thd_id);
 
         plog_file->fp_log = pfp;
         plog_file->thread_id = thd_id;
@@ -659,7 +658,7 @@
     return 0;
 
 FAIL:
-    if(plog_file->fn_log) {
+    if (plog_file->fn_log) {
         free(plog_file->fn_log);
         plog_file->fn_log = NULL;
     }
@@ -675,15 +674,15 @@
     int first_free_idx = MAX_TRACE_THREAD_NUM;
     int i = 0;
 
-    for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
-        if(plog_file[i].thread_id == thd_id)
+    for (i = 0; i < MAX_TRACE_THREAD_NUM; i++) {
+        if (plog_file[i].thread_id == thd_id)
             break;
-        else if(!plog_file[i].used &&
-            first_free_idx >= MAX_TRACE_THREAD_NUM)
+        else if (!plog_file[i].used &&
+                 first_free_idx >= MAX_TRACE_THREAD_NUM)
             first_free_idx = i;
     }
 
-    if(i >= MAX_TRACE_THREAD_NUM)
+    if (i >= MAX_TRACE_THREAD_NUM)
         i = first_free_idx;
 
     return i;
@@ -701,9 +700,9 @@
 
     plog_files_mgr = &pva_trace->log_files_manager;
     i = get_log_file_idx_by_thd(plog_files_mgr, thd_id);
-    if(i < MAX_TRACE_THREAD_NUM) {
+    if (i < MAX_TRACE_THREAD_NUM) {
         plog_file = &plog_files_mgr->log_file[i];
-        if(open_tracing_log_file(pva_trace, plog_file, thd_id) < 0) {
+        if (open_tracing_log_file(pva_trace, plog_file, thd_id) < 0) {
             plog_file = NULL;
         }
     }
@@ -718,8 +717,8 @@
 {
     LOCK_RESOURCE(pva_trace);
 
-    if(--plog_file->used <= 0) {
-        if(plog_file->fp_log) {
+    if (--plog_file->used <= 0) {
+        if (plog_file->fp_log) {
             fclose(plog_file->fp_log);
             plog_file->fp_log = NULL;
         }
@@ -737,23 +736,22 @@
     int i = 0;
 
     plog_file = ptra_ctx->plog_file;
-    if(plog_file && plog_file->thread_id != thd_id) {
+    if (plog_file && plog_file->thread_id != thd_id) {
         plog_file = start_tracing2log_file(pva_trace);
-        if(plog_file) {
+        if (plog_file) {
             int first_free_idx = -1;
 
             ptra_ctx->plog_file = plog_file;
 
-            for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
-                if(!ptra_ctx->plog_file_list[i]){
-                    if(first_free_idx < 0)
+            for (i = 0; i < MAX_TRACE_THREAD_NUM; i++) {
+                if (!ptra_ctx->plog_file_list[i]) {
+                    if (first_free_idx < 0)
                         first_free_idx = i;
-                }
-                else if(ptra_ctx->plog_file_list[i]->thread_id == thd_id)
+                } else if (ptra_ctx->plog_file_list[i]->thread_id == thd_id)
                     break;
             }
 
-            if(i > MAX_TRACE_THREAD_NUM
+            if (i > MAX_TRACE_THREAD_NUM
                 && first_free_idx >= 0)
                 ptra_ctx->plog_file_list[first_free_idx] = plog_file;
         }
@@ -781,14 +779,13 @@
     if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
         pva_trace->fn_log_env = strdup(env_value);
         trace_ctx->plog_file = start_tracing2log_file(pva_trace);
-        if(trace_ctx->plog_file) {
+        if (trace_ctx->plog_file) {
             trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
             va_trace_flag = VA_TRACE_FLAG_LOG;
 
             va_infoMessage(dpy, "LIBVA_TRACE is on, save log into %s\n",
-                trace_ctx->plog_file->fn_log);
-        }
-        else
+                           trace_ctx->plog_file->fn_log);
+        } else
             va_errorMessage(dpy, "Open file %s failed (%s)\n", env_value, strerror(errno));
     }
 
@@ -825,11 +822,11 @@
             char *p = env_value, *q;
 
             trace_ctx->trace_surface_width = strtod(p, &q);
-            p = q+1; /* skip "x" */
+            p = q + 1; /* skip "x" */
             trace_ctx->trace_surface_height = strtod(p, &q);
-            p = q+1; /* skip "+" */
+            p = q + 1; /* skip "+" */
             trace_ctx->trace_surface_xoff = strtod(p, &q);
-            p = q+1; /* skip "+" */
+            p = q + 1; /* skip "+" */
             trace_ctx->trace_surface_yoff = strtod(p, &q);
 
             va_infoMessage(dpy, "LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
@@ -845,7 +842,7 @@
 
     ((VADisplayContextP)dpy)->vatrace = (void *)pva_trace;
 
-    if(!va_trace_flag)
+    if (!va_trace_flag)
         va_TraceEnd(dpy);
 }
 
@@ -855,53 +852,53 @@
     int i = 0;
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
-    if(!pva_trace)
+    if (!pva_trace)
         return;
 
-    if(pva_trace->fn_log_env)
+    if (pva_trace->fn_log_env)
         free(pva_trace->fn_log_env);
 
-    if(pva_trace->fn_codedbuf_env)
+    if (pva_trace->fn_codedbuf_env)
         free(pva_trace->fn_codedbuf_env);
 
-    if(pva_trace->fn_surface_env)
+    if (pva_trace->fn_surface_env)
         free(pva_trace->fn_surface_env);
 
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++)
-        if(pva_trace->buf_manager.pbuf_info[i])
+    for (i = 0; i < MAX_TRACE_BUF_INFO_HASH_LEVEL; i++)
+        if (pva_trace->buf_manager.pbuf_info[i])
             free(pva_trace->buf_manager.pbuf_info[i]);
 
-    for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
+    for (i = 0; i < MAX_TRACE_THREAD_NUM; i++) {
         struct trace_log_file *plog_file = NULL;
 
         plog_file = &pva_trace->log_files_manager.log_file[i];
-        if(plog_file) {
-            if(plog_file->fn_log)
+        if (plog_file) {
+            if (plog_file->fn_log)
                 free(plog_file->fn_log);
 
-            if(plog_file->fp_log)
+            if (plog_file->fp_log)
                 fclose(plog_file->fp_log);
         }
     }
 
-    for(i = 0;i < MAX_TRACE_CTX_NUM;i++) {
+    for (i = 0; i < MAX_TRACE_CTX_NUM; i++) {
         struct trace_context *trace_ctx = NULL;
 
-        if(pva_trace->context_num <= 0)
+        if (pva_trace->context_num <= 0)
             break;
 
         trace_ctx = pva_trace->ptra_ctx[i];
-        if(trace_ctx) {
-            if(trace_ctx->trace_codedbuf_fn)
+        if (trace_ctx) {
+            if (trace_ctx->trace_codedbuf_fn)
                 free(trace_ctx->trace_codedbuf_fn);
 
-            if(trace_ctx->trace_fp_codedbuf)
+            if (trace_ctx->trace_fp_codedbuf)
                 fclose(trace_ctx->trace_fp_codedbuf);
 
-            if(trace_ctx->trace_surface_fn)
+            if (trace_ctx->trace_surface_fn)
                 free(trace_ctx->trace_surface_fn);
 
-            if(trace_ctx->trace_fp_surface)
+            if (trace_ctx->trace_fp_surface)
                 fclose(trace_ctx->trace_fp_surface);
 
             free(pva_trace->ptra_ctx[i]);
@@ -950,11 +947,11 @@
 
     if (gettimeofday(&tv, NULL) == 0)
         va_TracePrint(trace_ctx, "[%04d.%06d]",
-            (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
+                      (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
 
-    if(trace_ctx->trace_context != VA_INVALID_ID)
+    if (trace_ctx->trace_context != VA_INVALID_ID)
         va_TracePrint(trace_ctx,
-            "[ctx 0x%08x]", trace_ctx->trace_context);
+                      "[ctx 0x%08x]", trace_ctx->trace_context);
     else
         va_TracePrint(trace_ctx, "[ctx       none]");
 
@@ -988,12 +985,12 @@
     va_TraceMsg(trace_ctx, NULL);
 
     va_status = vaLockSurface(
-        dpy,
-        trace_ctx->trace_rendertarget,
-        &fourcc,
-        &luma_stride, &chroma_u_stride, &chroma_v_stride,
-        &luma_offset, &chroma_u_offset, &chroma_v_offset,
-        &buffer_name, &buffer);
+                    dpy,
+                    trace_ctx->trace_rendertarget,
+                    &fourcc,
+                    &luma_stride, &chroma_u_stride, &chroma_v_stride,
+                    &luma_offset, &chroma_u_offset, &chroma_v_offset,
+                    &buffer_name, &buffer);
 
     if (va_status != VA_STATUS_SUCCESS) {
         va_TraceMsg(trace_ctx, "Error:vaLockSurface failed\n");
@@ -1030,7 +1027,7 @@
 
     tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff;
 
-    for (i=0; i<trace_ctx->trace_surface_height; i++) {
+    for (i = 0; i < trace_ctx->trace_surface_height; i++) {
         fwrite(tmp + trace_ctx->trace_surface_xoff,
                trace_ctx->trace_surface_width,
                pixel_byte, trace_ctx->trace_fp_surface);
@@ -1040,7 +1037,7 @@
 
     tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2;
     if (fourcc == VA_FOURCC_NV12 || fourcc == VA_FOURCC_P010) {
-        for (i=0; i<trace_ctx->trace_surface_height/2; i++) {
+        for (i = 0; i < trace_ctx->trace_surface_height / 2; i++) {
             fwrite(tmp + trace_ctx->trace_surface_xoff,
                    trace_ctx->trace_surface_width,
                    pixel_byte, trace_ctx->trace_fp_surface);
@@ -1057,7 +1054,7 @@
 }
 
 
-void va_TraceInitialize (
+void va_TraceInitialize(
     VADisplay dpy,
     int *major_version,     /* out */
     int *minor_version      /* out */
@@ -1068,7 +1065,7 @@
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
-void va_TraceTerminate (
+void va_TraceTerminate(
     VADisplay dpy
 )
 {
@@ -1110,7 +1107,7 @@
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
-void va_TraceDestroyConfig (
+void va_TraceDestroyConfig(
     VADisplay dpy,
     VAConfigID config_id
 )
@@ -1144,7 +1141,7 @@
     if (num > VASurfaceAttribCount)
         num = VASurfaceAttribCount;
 
-    for (i=0; i<num; i++) {
+    for (i = 0; i < num; i++) {
         int type = p->value.type;
 
         va_TraceMsg(trace_ctx, "\tattrib_list[%i] =\n", i);
@@ -1249,7 +1246,7 @@
 }
 
 
-static void internal_TraceUpdateContext (
+static void internal_TraceUpdateContext(
     struct va_trace *pva_trace,
     int tra_ctx_idx,
     struct trace_context *new_trace_ctx,
@@ -1261,25 +1258,24 @@
     int i = 0, delete = 1;
     pid_t thd_id = va_gettid();
 
-    if(tra_ctx_idx >= MAX_TRACE_CTX_NUM)
+    if (tra_ctx_idx >= MAX_TRACE_CTX_NUM)
         return;
 
     LOCK_RESOURCE(pva_trace);
 
     trace_ctx = pva_trace->ptra_ctx[tra_ctx_idx];
-    if(trace_ctx) {
-        if(!new_trace_ctx &&
+    if (trace_ctx) {
+        if (!new_trace_ctx &&
             trace_ctx->created_thd_id != thd_id
             && !destroy_flag) {
             delete = 0;
-        }
-        else {
+        } else {
             pva_trace->context_num--;
             pva_trace->ptra_ctx[tra_ctx_idx] = NULL;
         }
     }
 
-    if(new_trace_ctx) {
+    if (new_trace_ctx) {
         new_trace_ctx->created_thd_id = thd_id;
         pva_trace->ptra_ctx[tra_ctx_idx] = new_trace_ctx;
         pva_trace->context_num++;
@@ -1287,21 +1283,21 @@
 
     UNLOCK_RESOURCE(pva_trace);
 
-    if(trace_ctx && delete) {
-        for(i = 0;i < MAX_TRACE_THREAD_NUM;i++)
-            if(trace_ctx->plog_file_list[i])
+    if (trace_ctx && delete) {
+        for (i = 0; i < MAX_TRACE_THREAD_NUM; i++)
+            if (trace_ctx->plog_file_list[i])
                 stop_tracing2log_file(pva_trace, trace_ctx->plog_file_list[i]);
 
-        if(trace_ctx->trace_codedbuf_fn)
+        if (trace_ctx->trace_codedbuf_fn)
             free(trace_ctx->trace_codedbuf_fn);
 
-        if(trace_ctx->trace_fp_codedbuf)
+        if (trace_ctx->trace_fp_codedbuf)
             fclose(trace_ctx->trace_fp_codedbuf);
 
-        if(trace_ctx->trace_surface_fn)
+        if (trace_ctx->trace_surface_fn)
             free(trace_ctx->trace_surface_fn);
 
-        if(trace_ctx->trace_fp_surface)
+        if (trace_ctx->trace_fp_surface)
             fclose(trace_ctx->trace_fp_surface);
 
         //delete_trace_all_context_buf(pva_trace, context);
@@ -1328,53 +1324,52 @@
     int i;
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
-    if(!context
+    if (!context
         || *context == VA_INVALID_ID
         || !pva_trace) {
         va_errorMessage(dpy, "Invalid context id 0x%08x\n",
-                context == NULL ? 0 : (int)*context);
+                        context == NULL ? 0 : (int)*context);
         return;
     }
 
     LOCK_CONTEXT(pva_trace);
 
     tra_ctx_id = get_free_ctx_idx(pva_trace, *context);
-    if(tra_ctx_id >= MAX_TRACE_CTX_NUM) {
+    if (tra_ctx_id >= MAX_TRACE_CTX_NUM) {
         va_errorMessage(dpy, "Can't get trace context for ctx 0x%08x\n",
-                *context);
+                        *context);
 
         goto FAIL;
     }
 
     trace_ctx = calloc(sizeof(struct trace_context), 1);
-    if(trace_ctx == NULL) {
+    if (trace_ctx == NULL) {
         va_errorMessage(dpy, "Allocate trace context failed for ctx 0x%08x\n",
-                *context);
+                        *context);
 
         goto FAIL;
     }
 
     i = get_valid_config_idx(pva_trace, config_id);
-    if(i >= MAX_TRACE_CTX_NUM) {
+    if (i >= MAX_TRACE_CTX_NUM) {
         va_errorMessage(dpy, "Can't get trace config id for ctx 0x%08x cfg %x\n",
-                *context, config_id);
+                        *context, config_id);
 
         goto FAIL;
     }
     trace_ctx->trace_profile = pva_trace->config_info[i].trace_profile;
     trace_ctx->trace_entrypoint = pva_trace->config_info[i].trace_entrypoint;
 
-    if(va_trace_flag & VA_TRACE_FLAG_LOG) {
+    if (va_trace_flag & VA_TRACE_FLAG_LOG) {
         trace_ctx->plog_file = start_tracing2log_file(pva_trace);
-        if(!trace_ctx->plog_file) {
+        if (!trace_ctx->plog_file) {
             va_errorMessage(dpy, "Can't get trace log file for ctx 0x%08x\n",
-                    *context);
+                            *context);
 
             goto FAIL;
-        }
-        else
+        } else
             va_infoMessage(dpy, "Save context 0x%08x into log file %s\n", *context,
-                trace_ctx->plog_file->fn_log);
+                           trace_ctx->plog_file->fn_log);
 
         trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
     }
@@ -1383,14 +1378,14 @@
     TRACE_FUNCNAME(idx);
     va_TraceMsg(trace_ctx, "\tcontext = 0x%08x va_trace_flag 0x%x\n", *context, va_trace_flag);
     va_TraceMsg(trace_ctx, "\tprofile = %d entrypoint = %d\n", trace_ctx->trace_profile,
-        trace_ctx->trace_entrypoint);
+                trace_ctx->trace_entrypoint);
     va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id);
     va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width);
     va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height);
     va_TraceMsg(trace_ctx, "\tflag = 0x%08x\n", flag);
     va_TraceMsg(trace_ctx, "\tnum_render_targets = %d\n", num_render_targets);
     if (render_targets) {
-        for (i=0; i<num_render_targets; i++)
+        for (i = 0; i < num_render_targets; i++)
             va_TraceMsg(trace_ctx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
     }
 
@@ -1412,7 +1407,7 @@
     if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
         (decode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
         (jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
-        if(open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
+        if (open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
             va_errorMessage(dpy, "Open surface fail failed for ctx 0x%08x\n", *context);
 
             va_trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
@@ -1420,7 +1415,7 @@
     }
 
     if (encode && (va_trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
-        if(open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) {
+        if (open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) {
             va_errorMessage(dpy, "Open codedbuf fail failed for ctx 0x%08x\n", *context);
 
             va_trace_flag &= ~(VA_TRACE_FLAG_CODEDBUF);
@@ -1437,11 +1432,11 @@
 
     UNLOCK_CONTEXT(pva_trace);
 
-    if(trace_ctx)
+    if (trace_ctx)
         free(trace_ctx);
 }
 
-void va_TraceDestroyContext (
+void va_TraceDestroyContext(
     VADisplay dpy,
     VAContextID context
 )
@@ -1452,28 +1447,28 @@
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
 
-    if(!pva_trace)
+    if (!pva_trace)
         return;
 
     LOCK_CONTEXT(pva_trace);
 
     ctx_id = get_valid_ctx_idx(pva_trace, context);
-    if(ctx_id < MAX_TRACE_CTX_NUM) {
+    if (ctx_id < MAX_TRACE_CTX_NUM) {
         trace_ctx = pva_trace->ptra_ctx[ctx_id];
 
-        if(trace_ctx) {
+        if (trace_ctx) {
             refresh_log_file(pva_trace, trace_ctx);
 
             internal_TraceUpdateContext(pva_trace,
-                get_valid_ctx_idx(pva_trace, context),
-                NULL, context, 0);
+                                        get_valid_ctx_idx(pva_trace, context),
+                                        NULL, context, 0);
         }
     }
 
     UNLOCK_CONTEXT(pva_trace);
 }
 
-void va_TraceCreateMFContext (
+void va_TraceCreateMFContext(
     VADisplay dpy,
     VAMFContextID *mf_context    /* out */
 )
@@ -1487,7 +1482,7 @@
         trace_ctx->trace_context = VA_INVALID_ID;
 }
 
-void va_TraceMFAddContext (
+void va_TraceMFAddContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
@@ -1500,7 +1495,7 @@
     va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
 }
 
-void va_TraceMFReleaseContext (
+void va_TraceMFReleaseContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
@@ -1513,7 +1508,7 @@
     va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
 }
 
-void va_TraceMFSubmit (
+void va_TraceMFSubmit(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID *contexts,
@@ -1527,19 +1522,19 @@
     TRACE_FUNCNAME(idx);
     va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context);
 
-    for(i = 0; i < num_contexts; i++){
+    for (i = 0; i < num_contexts; i++) {
         va_TraceMsg(trace_ctx, "\t\tcontext[%d] = 0x%08x\n", i, contexts[i]);
     }
 }
 
-void va_TraceCreateBuffer (
+void va_TraceCreateBuffer(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferType type,		/* in */
-    unsigned int size,		/* in */
-    unsigned int num_elements,	/* in */
-    void *data,			/* in */
-    VABufferID *buf_id		/* out */
+    VAContextID context,    /* in */
+    VABufferType type,      /* in */
+    unsigned int size,      /* in */
+    unsigned int num_elements,  /* in */
+    void *data,         /* in */
+    VABufferID *buf_id      /* out */
 )
 {
     if (!buf_id || *buf_id == VA_INVALID_ID)
@@ -1563,7 +1558,7 @@
     va_TraceMsg(trace_ctx, NULL);
 }
 
-void va_TraceDestroyBuffer (
+void va_TraceDestroyBuffer(
     VADisplay dpy,
     VABufferID buf_id    /* in */
 )
@@ -1598,15 +1593,15 @@
 static void mem_put_le16(char *mem, unsigned int val)
 {
     mem[0] = val;
-    mem[1] = val>>8;
+    mem[1] = val >> 8;
 }
 
 static void mem_put_le32(char *mem, unsigned int val)
 {
     mem[0] = val;
-    mem[1] = val>>8;
-    mem[2] = val>>16;
-    mem[3] = val>>24;
+    mem[1] = val >> 8;
+    mem[2] = val >> 16;
+    mem[3] = val >> 24;
 }
 
 static void va_TraceCodedBufferIVFHeader(struct trace_context *trace_ctx, void **pbuf)
@@ -1622,16 +1617,16 @@
         header[1] = 'K';
         header[2] = 'I';
         header[3] = 'F';
-        mem_put_le16(header+4,  0);                     /* version */
-        mem_put_le16(header+6,  32);                    /* headersize */
-        mem_put_le32(header+8,  0x30385056);            /* headersize */
+        mem_put_le16(header + 4,  0);                   /* version */
+        mem_put_le16(header + 6,  32);                  /* headersize */
+        mem_put_le32(header + 8,  0x30385056);          /* headersize */
         /* write width and height of the first rc_param to IVF file header */
-        mem_put_le16(header+12, trace_ctx->trace_frame_width);  /* width */
-        mem_put_le16(header+14, trace_ctx->trace_frame_height); /* height */
-        mem_put_le32(header+16, 30);            /* rate */
-        mem_put_le32(header+20, 1);                     /* scale */
-        mem_put_le32(header+24, 0xffffffff);            /* length */
-        mem_put_le32(header+28, 0);                     /* unused */
+        mem_put_le16(header + 12, trace_ctx->trace_frame_width); /* width */
+        mem_put_le16(header + 14, trace_ctx->trace_frame_height); /* height */
+        mem_put_le32(header + 16, 30);          /* rate */
+        mem_put_le32(header + 20, 1);                   /* scale */
+        mem_put_le32(header + 24, 0xffffffff);          /* length */
+        mem_put_le32(header + 28, 0);                   /* unused */
         fwrite(header, 1, 32, trace_ctx->trace_fp_codedbuf);
     }
 
@@ -1641,15 +1636,15 @@
         buf_list = (VACodedBufferSegment *) buf_list->next;
     }
     mem_put_le32(header, frame_length);
-    mem_put_le32(header+4, trace_ctx->pts&0xFFFFFFFF);
-    mem_put_le32(header+8, 0);
+    mem_put_le32(header + 4, trace_ctx->pts & 0xFFFFFFFF);
+    mem_put_le32(header + 8, 0);
     fwrite(header, 1, 12, trace_ctx->trace_fp_codedbuf);
     trace_ctx->pts++;
 
     fflush(trace_ctx->trace_fp_codedbuf);
 }
 
-void va_TraceMapBuffer (
+void va_TraceMapBuffer(
     VADisplay dpy,
     VABufferID buf_id,    /* in */
     void **pbuf           /* out */
@@ -1721,16 +1716,16 @@
 
     va_TracePrint(trace_ctx, "--%s\n", vaBufferTypeStr(type));
 
-    if(trace_ctx->plog_file)
+    if (trace_ctx->plog_file)
         fp = trace_ctx->plog_file->fp_log;
 
     if ((va_trace_flag & VA_TRACE_FLAG_BUFDATA) && fp) {
-        for (i=0; i<size; i++) {
+        for (i = 0; i < size; i++) {
             unsigned char value =  p[i];
 
-            if (i==0)
+            if (i == 0)
                 fprintf(fp, "\t\t0x%04x:", i);
-            else if ((i%16) == 0)
+            else if ((i % 16) == 0)
                 fprintf(fp, "\n\t\t0x%04x:", i);
 
             fprintf(fp, " %02x", value);
@@ -1753,30 +1748,30 @@
     unsigned int num_elements,
     void *data)
 {
-    VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
+    VAPictureParameterBufferMPEG2 *p = (VAPictureParameterBufferMPEG2 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    va_TraceMsg(trace_ctx,"VAPictureParameterBufferMPEG2\n");
+    va_TraceMsg(trace_ctx, "VAPictureParameterBufferMPEG2\n");
 
-    va_TraceMsg(trace_ctx,"\thorizontal size= %d\n", p->horizontal_size);
-    va_TraceMsg(trace_ctx,"\tvertical size= %d\n", p->vertical_size);
-    va_TraceMsg(trace_ctx,"\tforward reference picture= %d\n", p->forward_reference_picture);
-    va_TraceMsg(trace_ctx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
-    va_TraceMsg(trace_ctx,"\tpicture coding type= %d\n", p->picture_coding_type);
-    va_TraceMsg(trace_ctx,"\tf mode= %d\n", p->f_code);
+    va_TraceMsg(trace_ctx, "\thorizontal size= %d\n", p->horizontal_size);
+    va_TraceMsg(trace_ctx, "\tvertical size= %d\n", p->vertical_size);
+    va_TraceMsg(trace_ctx, "\tforward reference picture= %d\n", p->forward_reference_picture);
+    va_TraceMsg(trace_ctx, "\tbackward reference picture= %d\n", p->backward_reference_picture);
+    va_TraceMsg(trace_ctx, "\tpicture coding type= %d\n", p->picture_coding_type);
+    va_TraceMsg(trace_ctx, "\tf mode= %d\n", p->f_code);
 
-    va_TraceMsg(trace_ctx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
-    va_TraceMsg(trace_ctx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
-    va_TraceMsg(trace_ctx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
-    va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
-    va_TraceMsg(trace_ctx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
-    va_TraceMsg(trace_ctx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
-    va_TraceMsg(trace_ctx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
-    va_TraceMsg(trace_ctx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
-    va_TraceMsg(trace_ctx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
-    va_TraceMsg(trace_ctx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
-    va_TraceMsg(trace_ctx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
-    va_TraceMsg(trace_ctx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
+    va_TraceMsg(trace_ctx, "\tpicture coding extension = %d\n", p->picture_coding_extension.value);
+    va_TraceMsg(trace_ctx, "\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
+    va_TraceMsg(trace_ctx, "\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
+    va_TraceMsg(trace_ctx, "\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
+    va_TraceMsg(trace_ctx, "\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
+    va_TraceMsg(trace_ctx, "\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
+    va_TraceMsg(trace_ctx, "\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
+    va_TraceMsg(trace_ctx, "\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
+    va_TraceMsg(trace_ctx, "\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
+    va_TraceMsg(trace_ctx, "\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
+    va_TraceMsg(trace_ctx, "\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
+    va_TraceMsg(trace_ctx, "\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
     va_TraceMsg(trace_ctx, NULL);
 
     return;
@@ -1792,65 +1787,65 @@
     unsigned int num_elements,
     void *data)
 {
-    VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
+    VAIQMatrixBufferMPEG2 *p = (VAIQMatrixBufferMPEG2 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
     int i;
 
-    va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG2\n");
+    va_TraceMsg(trace_ctx, "VAIQMatrixBufferMPEG2\n");
 
-    va_TraceMsg(trace_ctx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
-    va_TraceMsg(trace_ctx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
-    va_TraceMsg(trace_ctx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
-    va_TraceMsg(trace_ctx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
-    va_TraceMsg (trace_ctx, "\tintra_quantiser_matrix[] = {\n");
+    va_TraceMsg(trace_ctx, "\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
+    va_TraceMsg(trace_ctx, "\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
+    va_TraceMsg(trace_ctx, "\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
+    va_TraceMsg(trace_ctx, "\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
+    va_TraceMsg(trace_ctx, "\tintra_quantiser_matrix[] = {\n");
     for (i = 0; i < 64; i++) {
-      if (i % 8 == 0) {
-        if (i)
-          va_TracePrint (trace_ctx, "\n");
-        va_TraceMsg (trace_ctx, "\t %3d", p->intra_quantiser_matrix[i]);
-      } else {
-        va_TracePrint (trace_ctx, " %3d", p->intra_quantiser_matrix[i]);
-      }
+        if (i % 8 == 0) {
+            if (i)
+                va_TracePrint(trace_ctx, "\n");
+            va_TraceMsg(trace_ctx, "\t %3d", p->intra_quantiser_matrix[i]);
+        } else {
+            va_TracePrint(trace_ctx, " %3d", p->intra_quantiser_matrix[i]);
+        }
     }
-    va_TracePrint (trace_ctx, "}\n");
+    va_TracePrint(trace_ctx, "}\n");
 
-    va_TraceMsg (trace_ctx, "\tnon_intra_quantiser_matrix[] = {\n");
+    va_TraceMsg(trace_ctx, "\tnon_intra_quantiser_matrix[] = {\n");
     for (i = 0; i < 64; i++) {
-      if (i % 8 == 0) {
-        if (i)
-          va_TracePrint (trace_ctx, "\n");
-        va_TraceMsg (trace_ctx, "\t %3d", p->non_intra_quantiser_matrix[i]);
-      } else {
-        va_TracePrint (trace_ctx, " %3d", p->non_intra_quantiser_matrix[i]);
-      }
+        if (i % 8 == 0) {
+            if (i)
+                va_TracePrint(trace_ctx, "\n");
+            va_TraceMsg(trace_ctx, "\t %3d", p->non_intra_quantiser_matrix[i]);
+        } else {
+            va_TracePrint(trace_ctx, " %3d", p->non_intra_quantiser_matrix[i]);
+        }
     }
-    va_TracePrint (trace_ctx, "}\n");
+    va_TracePrint(trace_ctx, "}\n");
 
-    va_TraceMsg (trace_ctx, "\tchroma_intra_quantiser_matrix[] = {\n");
+    va_TraceMsg(trace_ctx, "\tchroma_intra_quantiser_matrix[] = {\n");
     for (i = 0; i < 64; i++) {
-      if (i % 8 == 0) {
-        if (i)
-          va_TracePrint (trace_ctx, "\n");
-        va_TraceMsg (trace_ctx, "\t %3d", p->chroma_intra_quantiser_matrix[i]);
-      } else {
-        va_TracePrint (trace_ctx, " %3d", p->chroma_intra_quantiser_matrix[i]);
-      }
+        if (i % 8 == 0) {
+            if (i)
+                va_TracePrint(trace_ctx, "\n");
+            va_TraceMsg(trace_ctx, "\t %3d", p->chroma_intra_quantiser_matrix[i]);
+        } else {
+            va_TracePrint(trace_ctx, " %3d", p->chroma_intra_quantiser_matrix[i]);
+        }
     }
-    va_TracePrint (trace_ctx, "}\n");
+    va_TracePrint(trace_ctx, "}\n");
 
-    va_TraceMsg (trace_ctx, "\tchroma_non_intra_quantiser_matrix[] = {\n");
+    va_TraceMsg(trace_ctx, "\tchroma_non_intra_quantiser_matrix[] = {\n");
     for (i = 0; i < 64; i++) {
-      if (i % 8 == 0) {
-        if (i)
-          va_TracePrint (trace_ctx, "\n");
-        va_TraceMsg (
-            trace_ctx, "\t %3d", p->chroma_non_intra_quantiser_matrix[i]);
-      } else {
-        va_TracePrint (
-            trace_ctx, " %3d", p->chroma_non_intra_quantiser_matrix[i]);
-      }
+        if (i % 8 == 0) {
+            if (i)
+                va_TracePrint(trace_ctx, "\n");
+            va_TraceMsg(
+                trace_ctx, "\t %3d", p->chroma_non_intra_quantiser_matrix[i]);
+        } else {
+            va_TracePrint(
+                trace_ctx, " %3d", p->chroma_non_intra_quantiser_matrix[i]);
+        }
     }
-    va_TracePrint (trace_ctx, "}\n");
+    va_TracePrint(trace_ctx, "}\n");
 
     return;
 }
@@ -1865,7 +1860,7 @@
     unsigned int num_elements,
     void *data)
 {
-    VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)data;
+    VASliceParameterBufferMPEG2 *p = (VASliceParameterBufferMPEG2 *)data;
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
@@ -1873,16 +1868,16 @@
 
     trace_ctx->trace_slice_size = p->slice_data_size;
 
-    va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG2\n");
+    va_TraceMsg(trace_ctx, "VASliceParameterBufferMPEG2\n");
 
-    va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
-    va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
-    va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
-    va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
-    va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
-    va_TraceMsg(trace_ctx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
-    va_TraceMsg(trace_ctx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
-    va_TraceMsg(trace_ctx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
+    va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
+    va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
+    va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
+    va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
+    va_TraceMsg(trace_ctx, "\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
+    va_TraceMsg(trace_ctx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
+    va_TraceMsg(trace_ctx, "\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
+    va_TraceMsg(trace_ctx, "\tintra_slice_flag = %d\n", p->intra_slice_flag);
     va_TraceMsg(trace_ctx, NULL);
 
     return;
@@ -1898,18 +1893,18 @@
     void *data)
 {
     int i;
-    VAPictureParameterBufferJPEGBaseline *p=(VAPictureParameterBufferJPEGBaseline *)data;
+    VAPictureParameterBufferJPEGBaseline *p = (VAPictureParameterBufferJPEGBaseline *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    va_TraceMsg(trace_ctx,"*VAPictureParameterBufferJPEG\n");
-    va_TraceMsg(trace_ctx,"\tpicture_width = %u\n", p->picture_width);
-    va_TraceMsg(trace_ctx,"\tpicture_height = %u\n", p->picture_height);
-    va_TraceMsg(trace_ctx,"\tcomponents = \n");
+    va_TraceMsg(trace_ctx, "*VAPictureParameterBufferJPEG\n");
+    va_TraceMsg(trace_ctx, "\tpicture_width = %u\n", p->picture_width);
+    va_TraceMsg(trace_ctx, "\tpicture_height = %u\n", p->picture_height);
+    va_TraceMsg(trace_ctx, "\tcomponents = \n");
     for (i = 0; i < p->num_components && i < 255; ++i) {
-        va_TraceMsg(trace_ctx,"\t\t[%d] component_id = %u\n", i, p->components[i].component_id);
-        va_TraceMsg(trace_ctx,"\t\t[%d] h_sampling_factor = %u\n", i, p->components[i].h_sampling_factor);
-        va_TraceMsg(trace_ctx,"\t\t[%d] v_sampling_factor = %u\n", i, p->components[i].v_sampling_factor);
-        va_TraceMsg(trace_ctx,"\t\t[%d] quantiser_table_selector = %u\n", i, p->components[i].quantiser_table_selector);
+        va_TraceMsg(trace_ctx, "\t\t[%d] component_id = %u\n", i, p->components[i].component_id);
+        va_TraceMsg(trace_ctx, "\t\t[%d] h_sampling_factor = %u\n", i, p->components[i].h_sampling_factor);
+        va_TraceMsg(trace_ctx, "\t\t[%d] v_sampling_factor = %u\n", i, p->components[i].v_sampling_factor);
+        va_TraceMsg(trace_ctx, "\t\t[%d] quantiser_table_selector = %u\n", i, p->components[i].quantiser_table_selector);
     }
 }
 
@@ -1924,20 +1919,20 @@
 {
     int i, j;
     static char tmp[1024];
-    VAIQMatrixBufferJPEGBaseline *p=(VAIQMatrixBufferJPEGBaseline *)data;
+    VAIQMatrixBufferJPEGBaseline *p = (VAIQMatrixBufferJPEGBaseline *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    va_TraceMsg(trace_ctx,"*VAIQMatrixParameterBufferJPEG\n");
-    va_TraceMsg(trace_ctx,"\tload_quantiser_table =\n");
+    va_TraceMsg(trace_ctx, "*VAIQMatrixParameterBufferJPEG\n");
+    va_TraceMsg(trace_ctx, "\tload_quantiser_table =\n");
     for (i = 0; i < 4; ++i) {
-        va_TraceMsg(trace_ctx,"\t\t[%d] = %u\n", i, p->load_quantiser_table[i]);
+        va_TraceMsg(trace_ctx, "\t\t[%d] = %u\n", i, p->load_quantiser_table[i]);
     }
-    va_TraceMsg(trace_ctx,"\tquantiser_table =\n");
+    va_TraceMsg(trace_ctx, "\tquantiser_table =\n");
     for (i = 0; i < 4; ++i) {
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 64; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->quantiser_table[i][j]);
         }
-        va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
+        va_TraceMsg(trace_ctx, "\t\t[%d] = %s\n", i, tmp);
     }
 }
 
@@ -1951,22 +1946,22 @@
     void *data)
 {
     int i;
-    VASliceParameterBufferJPEGBaseline *p=(VASliceParameterBufferJPEGBaseline *)data;
+    VASliceParameterBufferJPEGBaseline *p = (VASliceParameterBufferJPEGBaseline *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    va_TraceMsg(trace_ctx,"*VASliceParameterBufferJPEG\n");
-    va_TraceMsg(trace_ctx,"\tslice_data_size = %u\n", p->slice_data_size);
-    va_TraceMsg(trace_ctx,"\tslice_data_offset = %u\n", p->slice_data_offset);
-    va_TraceMsg(trace_ctx,"\tslice_data_flag = %u\n", p->slice_data_flag);
-    va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %u\n", p->slice_horizontal_position);
-    va_TraceMsg(trace_ctx,"\tslice_vertical_position = %u\n", p->slice_vertical_position);
-    va_TraceMsg(trace_ctx,"\tcomponents = \n");
+    va_TraceMsg(trace_ctx, "*VASliceParameterBufferJPEG\n");
+    va_TraceMsg(trace_ctx, "\tslice_data_size = %u\n", p->slice_data_size);
+    va_TraceMsg(trace_ctx, "\tslice_data_offset = %u\n", p->slice_data_offset);
+    va_TraceMsg(trace_ctx, "\tslice_data_flag = %u\n", p->slice_data_flag);
+    va_TraceMsg(trace_ctx, "\tslice_horizontal_position = %u\n", p->slice_horizontal_position);
+    va_TraceMsg(trace_ctx, "\tslice_vertical_position = %u\n", p->slice_vertical_position);
+    va_TraceMsg(trace_ctx, "\tcomponents = \n");
     for (i = 0; i < p->num_components && i < 4; ++i) {
-        va_TraceMsg(trace_ctx,"\t\t[%d] component_selector = %u\n", i, p->components[i].component_selector);
-        va_TraceMsg(trace_ctx,"\t\t[%d] dc_table_selector = %u\n", i, p->components[i].dc_table_selector);
-        va_TraceMsg(trace_ctx,"\t\t[%d] ac_table_selector = %u\n", i, p->components[i].ac_table_selector);
+        va_TraceMsg(trace_ctx, "\t\t[%d] component_selector = %u\n", i, p->components[i].component_selector);
+        va_TraceMsg(trace_ctx, "\t\t[%d] dc_table_selector = %u\n", i, p->components[i].dc_table_selector);
+        va_TraceMsg(trace_ctx, "\t\t[%d] ac_table_selector = %u\n", i, p->components[i].ac_table_selector);
     }
-    va_TraceMsg(trace_ctx,"\trestart_interval = %u\n", p->restart_interval);
-    va_TraceMsg(trace_ctx,"\tnum_mcus = %u\n", p->num_mcus);
+    va_TraceMsg(trace_ctx, "\trestart_interval = %u\n", p->restart_interval);
+    va_TraceMsg(trace_ctx, "\tnum_mcus = %u\n", p->num_mcus);
 }
 
 static void va_TraceVAHuffmanTableBufferJPEG(
@@ -1980,38 +1975,38 @@
 {
     int i, j;
     static char tmp[1024];
-    VAHuffmanTableBufferJPEGBaseline *p=(VAHuffmanTableBufferJPEGBaseline *)data;
+    VAHuffmanTableBufferJPEGBaseline *p = (VAHuffmanTableBufferJPEGBaseline *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    va_TraceMsg(trace_ctx,"*VAHuffmanTableBufferJPEG\n");
+    va_TraceMsg(trace_ctx, "*VAHuffmanTableBufferJPEG\n");
 
     for (i = 0; i < 2; ++i) {
-        va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[i]);
-        va_TraceMsg(trace_ctx,"\thuffman_table[%d] =\n", i);
+        va_TraceMsg(trace_ctx, "\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[i]);
+        va_TraceMsg(trace_ctx, "\thuffman_table[%d] =\n", i);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 16; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_dc_codes[j]);
         }
-        va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
+        va_TraceMsg(trace_ctx, "\t\tnum_dc_codes =%s\n", tmp);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 12; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].dc_values[j]);
         }
-        va_TraceMsg(trace_ctx,"\t\tdc_values =%s\n", tmp);
+        va_TraceMsg(trace_ctx, "\t\tdc_values =%s\n", tmp);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 16; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_ac_codes[j]);
         }
-        va_TraceMsg(trace_ctx,"\t\tnum_ac_codes =%s\n", tmp);
+        va_TraceMsg(trace_ctx, "\t\tnum_ac_codes =%s\n", tmp);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 162; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].ac_values[j]);
         }
-        va_TraceMsg(trace_ctx,"\t\tac_values =%s\n", tmp);
+        va_TraceMsg(trace_ctx, "\t\tac_values =%s\n", tmp);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 2; ++j) {
             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].pad[j]);
         }
-        va_TraceMsg(trace_ctx,"\t\tpad =%s\n", tmp);
+        va_TraceMsg(trace_ctx, "\t\tpad =%s\n", tmp);
     }
 }
 
@@ -2025,50 +2020,50 @@
     void *data)
 {
     int i;
-    VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
+    VAPictureParameterBufferMPEG4 *p = (VAPictureParameterBufferMPEG4 *)data;
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    va_TraceMsg(trace_ctx,"*VAPictureParameterBufferMPEG4\n");
-    va_TraceMsg(trace_ctx,"\tvop_width = %d\n", p->vop_width);
-    va_TraceMsg(trace_ctx,"\tvop_height = %d\n", p->vop_height);
-    va_TraceMsg(trace_ctx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
-    va_TraceMsg(trace_ctx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
-    va_TraceMsg(trace_ctx,"\tvol_fields value = %d\n", p->vol_fields.value);
-    va_TraceMsg(trace_ctx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
-    va_TraceMsg(trace_ctx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
-    va_TraceMsg(trace_ctx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
-    va_TraceMsg(trace_ctx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
-    va_TraceMsg(trace_ctx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
-    va_TraceMsg(trace_ctx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
-    va_TraceMsg(trace_ctx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
-    va_TraceMsg(trace_ctx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
-    va_TraceMsg(trace_ctx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
-    va_TraceMsg(trace_ctx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
-    va_TraceMsg(trace_ctx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
-    va_TraceMsg(trace_ctx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
-    va_TraceMsg(trace_ctx,"\tsprite_trajectory_du =");
-    for(i=0;i<3;i++)
-        va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_du[i]);
+    va_TraceMsg(trace_ctx, "*VAPictureParameterBufferMPEG4\n");
+    va_TraceMsg(trace_ctx, "\tvop_width = %d\n", p->vop_width);
+    va_TraceMsg(trace_ctx, "\tvop_height = %d\n", p->vop_height);
+    va_TraceMsg(trace_ctx, "\tforward_reference_picture = %d\n", p->forward_reference_picture);
+    va_TraceMsg(trace_ctx, "\tbackward_reference_picture = %d\n", p->backward_reference_picture);
+    va_TraceMsg(trace_ctx, "\tvol_fields value = %d\n", p->vol_fields.value);
+    va_TraceMsg(trace_ctx, "\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
+    va_TraceMsg(trace_ctx, "\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
+    va_TraceMsg(trace_ctx, "\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
+    va_TraceMsg(trace_ctx, "\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
+    va_TraceMsg(trace_ctx, "\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
+    va_TraceMsg(trace_ctx, "\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
+    va_TraceMsg(trace_ctx, "\tquant_type= %d\n", p->vol_fields.bits.quant_type);
+    va_TraceMsg(trace_ctx, "\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
+    va_TraceMsg(trace_ctx, "\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
+    va_TraceMsg(trace_ctx, "\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
+    va_TraceMsg(trace_ctx, "\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
+    va_TraceMsg(trace_ctx, "\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
+    va_TraceMsg(trace_ctx, "\tsprite_trajectory_du =");
+    for (i = 0; i < 3; i++)
+        va_TraceMsg(trace_ctx, "\t%d", p->sprite_trajectory_du[i]);
 
-    va_TraceMsg(trace_ctx,"\n");
-    va_TraceMsg(trace_ctx,"\tsprite_trajectory_dv =");
-    for(i=0;i<3;i++)
-        va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_dv[i]);
-    va_TraceMsg(trace_ctx,"\n");
-    va_TraceMsg(trace_ctx,"\tvop_fields value = %d\n", p->vop_fields.value);
-    va_TraceMsg(trace_ctx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
-    va_TraceMsg(trace_ctx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
-    va_TraceMsg(trace_ctx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
-    va_TraceMsg(trace_ctx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
-    va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
-    va_TraceMsg(trace_ctx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
-    va_TraceMsg(trace_ctx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
-    va_TraceMsg(trace_ctx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
-    va_TraceMsg(trace_ctx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
-    va_TraceMsg(trace_ctx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
-    va_TraceMsg(trace_ctx,"\tTRB = %d\n", p->TRB);
-    va_TraceMsg(trace_ctx,"\tTRD = %d\n", p->TRD);
+    va_TraceMsg(trace_ctx, "\n");
+    va_TraceMsg(trace_ctx, "\tsprite_trajectory_dv =");
+    for (i = 0; i < 3; i++)
+        va_TraceMsg(trace_ctx, "\t%d", p->sprite_trajectory_dv[i]);
+    va_TraceMsg(trace_ctx, "\n");
+    va_TraceMsg(trace_ctx, "\tvop_fields value = %d\n", p->vop_fields.value);
+    va_TraceMsg(trace_ctx, "\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
+    va_TraceMsg(trace_ctx, "\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
+    va_TraceMsg(trace_ctx, "\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
+    va_TraceMsg(trace_ctx, "\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
+    va_TraceMsg(trace_ctx, "\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
+    va_TraceMsg(trace_ctx, "\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
+    va_TraceMsg(trace_ctx, "\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
+    va_TraceMsg(trace_ctx, "\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
+    va_TraceMsg(trace_ctx, "\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
+    va_TraceMsg(trace_ctx, "\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
+    va_TraceMsg(trace_ctx, "\tTRB = %d\n", p->TRB);
+    va_TraceMsg(trace_ctx, "\tTRD = %d\n", p->TRD);
     va_TraceMsg(trace_ctx, NULL);
 
     return;
@@ -2085,20 +2080,20 @@
     void *data)
 {
     int i;
-    VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
+    VAIQMatrixBufferMPEG4 *p = (VAIQMatrixBufferMPEG4 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG4\n");
+    va_TraceMsg(trace_ctx, "VAIQMatrixBufferMPEG4\n");
 
-    va_TraceMsg(trace_ctx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
-    va_TraceMsg(trace_ctx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
-    va_TraceMsg(trace_ctx,"\tintra_quant_mat =\n");
-    for(i=0;i<64;i++)
-        va_TraceMsg(trace_ctx,"\t\t%d\n", p->intra_quant_mat[i]);
+    va_TraceMsg(trace_ctx, "\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
+    va_TraceMsg(trace_ctx, "\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
+    va_TraceMsg(trace_ctx, "\tintra_quant_mat =\n");
+    for (i = 0; i < 64; i++)
+        va_TraceMsg(trace_ctx, "\t\t%d\n", p->intra_quant_mat[i]);
 
-    va_TraceMsg(trace_ctx,"\tnon_intra_quant_mat =\n");
-    for(i=0;i<64;i++)
-        va_TraceMsg(trace_ctx,"\t\t%d\n", p->non_intra_quant_mat[i]);
+    va_TraceMsg(trace_ctx, "\tnon_intra_quant_mat =\n");
+    for (i = 0; i < 64; i++)
+        va_TraceMsg(trace_ctx, "\t\t%d\n", p->non_intra_quant_mat[i]);
     va_TraceMsg(trace_ctx, NULL);
 
     return;
@@ -2193,7 +2188,7 @@
     unsigned int num_elements,
     void *data)
 {
-    VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)data;
+    VASliceParameterBufferMPEG4 *p = (VASliceParameterBufferMPEG4 *)data;
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
@@ -2201,14 +2196,14 @@
 
     trace_ctx->trace_slice_size = p->slice_data_size;
 
-    va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG4\n");
+    va_TraceMsg(trace_ctx, "VASliceParameterBufferMPEG4\n");
 
-    va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
-    va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
-    va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
-    va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
-    va_TraceMsg(trace_ctx,"\tmacroblock_number = %d\n", p->macroblock_number);
-    va_TraceMsg(trace_ctx,"\tquant_scale = %d\n", p->quant_scale);
+    va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
+    va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
+    va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
+    va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
+    va_TraceMsg(trace_ctx, "\tmacroblock_number = %d\n", p->macroblock_number);
+    va_TraceMsg(trace_ctx, "\tquant_scale = %d\n", p->quant_scale);
     va_TraceMsg(trace_ctx, NULL);
 
     return;
@@ -2301,8 +2296,7 @@
     va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
 
     va_TraceMsg(trace_ctx, "\tReferenceFrames (picture_id-pic_order_cnt-flags):\n");
-    for (i = 0; i < 15; i++)
-    {
+    for (i = 0; i < 15; i++) {
         if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
             ((p->ReferenceFrames[i].flags & VA_PICTURE_HEVC_INVALID) == 0)) {
             va_TraceMsg(trace_ctx, "\t\t0x%08x-%08d-0x%08x\n",
@@ -2482,7 +2476,7 @@
     unsigned int num_elements,
     void *data)
 {
-    int i,j;
+    int i, j;
     bool isRext = false;
     VASliceParameterBufferHEVC* p = NULL;
     VASliceParameterBufferHEVCRext *pRext = NULL;
@@ -2633,7 +2627,7 @@
 )
 {
     int i, j;
-    VAIQMatrixBufferHEVC* p = (VAIQMatrixBufferHEVC* )data;
+    VAIQMatrixBufferHEVC* p = (VAIQMatrixBufferHEVC*)data;
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
@@ -2708,7 +2702,7 @@
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncSequenceParameterBufferHEVC\n");
@@ -2783,7 +2777,7 @@
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncPictureParameterBufferHEVC\n");
@@ -2792,8 +2786,7 @@
     va_TraceMsg(trace_ctx, "\tdecoded_curr_pic.pic_order_cnt = %d\n", p->decoded_curr_pic.pic_order_cnt);
     va_TraceMsg(trace_ctx, "\tdecoded_curr_pic.flags = %d\n", p->decoded_curr_pic.flags);
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\treference_frames[%d].picture_id = 0x%08x\n", i, p->reference_frames[i].picture_id);
         va_TraceMsg(trace_ctx, "\treference_frames[%d].pic_order_cnt = %d\n", i, p->reference_frames[i].pic_order_cnt);
         va_TraceMsg(trace_ctx, "\treference_frames[%d].flags = %d\n", i, p->reference_frames[i].flags);
@@ -2809,13 +2802,11 @@
     va_TraceMsg(trace_ctx, "\tnum_tile_columns_minus1 = %d\n", p->num_tile_columns_minus1);
     va_TraceMsg(trace_ctx, "\tnum_tile_rows_minus1 = %d\n", p->num_tile_rows_minus1);
 
-    for(i = 0; i < 19; i ++)
-    {
+    for (i = 0; i < 19; i ++) {
         va_TraceMsg(trace_ctx, "\tcolumn_width_minus1[%d] = %d\n", i, p->column_width_minus1[i]);
     }
 
-    for(i = 0; i < 21; i ++)
-    {
+    for (i = 0; i < 21; i ++) {
         va_TraceMsg(trace_ctx, "\trow_height_minus1[%d] = %d\n", i, p->row_height_minus1[i]);
     }
 
@@ -2867,7 +2858,7 @@
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncSliceParameterBufferHEVC\n");
@@ -2879,8 +2870,7 @@
     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\tref_pic_list0[%d].picture_id = 0x%08x\n", i, p->ref_pic_list0[i].picture_id);
         va_TraceMsg(trace_ctx, "\tref_pic_list0[%d].pic_order_cnt = %d\n", i, p->ref_pic_list0[i].pic_order_cnt);
         va_TraceMsg(trace_ctx, "\tref_pic_list0[%d].flags = %d\n", i, p->ref_pic_list0[i].flags);
@@ -2892,28 +2882,24 @@
     va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
     va_TraceMsg(trace_ctx, "\tdelta_chroma_log2_weight_denom = %d\n", p->delta_chroma_log2_weight_denom);
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\tdelta_luma_weight_l0[%d] = %d\n", i, p->delta_luma_weight_l0[i]);
         va_TraceMsg(trace_ctx, "\tdelta_luma_weight_l1[%d] = %d\n", i, p->delta_luma_weight_l1[i]);
     }
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\tluma_offset_l0[%d] = %d\n", i, p->luma_offset_l0[i]);
         va_TraceMsg(trace_ctx, "\tluma_offset_l1[%d] = %d\n", i, p->luma_offset_l1[i]);
     }
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l0[%d][0] = %d\n", i, p->delta_chroma_weight_l0[i][0]);
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l0[%d][1] = %d\n", i, p->delta_chroma_weight_l0[i][1]);
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l1[%d][0] = %d\n", i, p->delta_chroma_weight_l1[i][0]);
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l1[%d][1] = %d\n", i, p->delta_chroma_weight_l1[i][1]);
     }
 
-    for(i = 0; i < 15; i ++)
-    {
+    for (i = 0; i < 15; i ++) {
         va_TraceMsg(trace_ctx, "\tchroma_offset_l0[%d][0] = %d\n", i, p->chroma_offset_l0[i][0]);
         va_TraceMsg(trace_ctx, "\tchroma_offset_l0[%d][1] = %d\n", i, p->chroma_offset_l0[i][1]);
         va_TraceMsg(trace_ctx, "\tchroma_offset_l1[%d][0] = %d\n", i, p->chroma_offset_l1[i][0]);
@@ -2965,8 +2951,7 @@
     va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
 
     va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
-    for (i = 0; i < 16; i++)
-    {
+    for (i = 0; i < 16; i++) {
         if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
             ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08u-0x%08x\n",
@@ -3047,7 +3032,7 @@
     for (i = 0; i < 32; i++) {
         if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
             ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
-        va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx,  p->RefPicList0[i].flags);
+            va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx,  p->RefPicList0[i].flags);
         else
             break;
     }
@@ -3064,41 +3049,41 @@
     va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
     va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
 
-    for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
+    for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i < 32); i++) {
         va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
-            p->luma_weight_l0[i],
-            p->luma_offset_l0[i]);
+                    p->luma_weight_l0[i],
+                    p->luma_offset_l0[i]);
     }
 
 
     va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
 
-    for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
+    for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i < 32); i++) {
         va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
-            p->chroma_weight_l0[i][0],
-            p->chroma_offset_l0[i][0],
-            p->chroma_weight_l0[i][1],
-            p->chroma_offset_l0[i][1]);
+                    p->chroma_weight_l0[i][0],
+                    p->chroma_offset_l0[i][0],
+                    p->chroma_weight_l0[i][1],
+                    p->chroma_offset_l0[i][1]);
     }
 
 
     va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
 
-    for (i = 0; (i <=  p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
+    for (i = 0; (i <=  p->num_ref_idx_l1_active_minus1) && (i < 32); i++) {
         va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
-            p->luma_weight_l1[i],
-            p->luma_offset_l1[i]);
+                    p->luma_weight_l1[i],
+                    p->luma_offset_l1[i]);
     }
 
 
     va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
 
-    for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
+    for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i < 32); i++) {
         va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
-            p->chroma_weight_l1[i][0],
-            p->chroma_offset_l1[i][0],
-            p->chroma_weight_l1[i][1],
-            p->chroma_offset_l1[i][1]);
+                    p->chroma_weight_l1[i][0],
+                    p->chroma_offset_l1[i][0],
+                    p->chroma_weight_l1[i][1],
+                    p->chroma_offset_l1[i][1]);
 
     }
     va_TraceMsg(trace_ctx, NULL);
@@ -3115,12 +3100,12 @@
 )
 {
     int i, j;
-    VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
+    VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264*)data;
     FILE *fp = NULL;
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(trace_ctx->plog_file)
+    if (trace_ctx->plog_file)
         fp = trace_ctx->plog_file->fp_log;
 
     va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferH264\n");
@@ -3140,7 +3125,7 @@
     for (i = 0; i < 2; i++) {
         for (j = 0; j < 64; j++) {
             if (fp) {
-                fprintf(fp,"\t%d", p->ScalingList8x8[i][j]);
+                fprintf(fp, "\t%d", p->ScalingList8x8[i][j]);
                 if ((j + 1) % 8 == 0)
                     fprintf(fp, "\n");
             }
@@ -3190,7 +3175,7 @@
     va_TraceMsg(trace_ctx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
     va_TraceMsg(trace_ctx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
     va_TraceMsg(trace_ctx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
-    for(i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
+    for (i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
         va_TraceMsg(trace_ctx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
     va_TraceMsg(trace_ctx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
     va_TraceMsg(trace_ctx, "\tframe_crop_left_offset = %u\n", p->frame_crop_left_offset);
@@ -3236,8 +3221,7 @@
     va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
     va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
     va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
-    for (i = 0; i < 16; i++)
-    {
+    for (i = 0; i < 16; i++) {
         if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
             ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08u-0x%08x\n",
@@ -3246,7 +3230,7 @@
                         p->ReferenceFrames[i].picture_id,
                         p->ReferenceFrames[i].frame_idx,
                         p->ReferenceFrames[i].flags
-                        );
+                       );
         } else
             break;
     }
@@ -3361,7 +3345,7 @@
                         p->RefPicList1[i].picture_id,
                         p->RefPicList1[i].frame_idx,
                         p->RefPicList1[i].flags
-                        );
+                       );
         else
             break;
     }
@@ -3370,7 +3354,7 @@
     va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
     va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
     if (p->luma_weight_l0_flag) {
-        for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
+        for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i < 32); i++) {
             va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
                         p->luma_weight_l0[i],
                         p->luma_offset_l0[i]);
@@ -3379,7 +3363,7 @@
 
     va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
     if (p->chroma_weight_l0_flag) {
-        for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
+        for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i < 32); i++) {
             va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
                         p->chroma_weight_l0[i][0],
                         p->chroma_offset_l0[i][0],
@@ -3390,7 +3374,7 @@
 
     va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
     if (p->luma_weight_l1_flag) {
-        for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
+        for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i < 32); i++) {
             va_TraceMsg(trace_ctx, "\t\t%d\t\t%d\n",
                         p->luma_weight_l1[i],
                         p->luma_offset_l1[i]);
@@ -3399,7 +3383,7 @@
 
     va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
     if (p->chroma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
-        for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
+        for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i < 32); i++) {
             va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
                         p->chroma_weight_l1[i][0],
                         p->chroma_offset_l1[i][0],
@@ -3456,16 +3440,14 @@
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
     switch (tmp->type) {
-    case VAEncMiscParameterTypeFrameRate:
-    {
+    case VAEncMiscParameterTypeFrameRate: {
         VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterFrameRate\n");
         va_TraceMsg(trace_ctx, "\tframerate = %d\n", p->framerate);
         va_TraceMsg(trace_ctx, "\tframerate_flags.temporal_id = %d\n", p->framerate_flags.bits.temporal_id);
         break;
     }
-    case VAEncMiscParameterTypeRateControl:
-    {
+    case VAEncMiscParameterTypeRateControl: {
         VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterRateControl\n");
@@ -3488,16 +3470,14 @@
         va_TraceMsg(trace_ctx, "\tmax_qp = %d\n", p->max_qp);
         break;
     }
-    case VAEncMiscParameterTypeMaxSliceSize:
-    {
+    case VAEncMiscParameterTypeMaxSliceSize: {
         VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxSliceSize\n");
         va_TraceMsg(trace_ctx, "\tmax_slice_size = %d\n", p->max_slice_size);
         break;
     }
-    case VAEncMiscParameterTypeAIR:
-    {
+    case VAEncMiscParameterTypeAIR: {
         VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterAIR\n");
@@ -3506,8 +3486,7 @@
         va_TraceMsg(trace_ctx, "\tair_auto = %d\n", p->air_auto);
         break;
     }
-    case VAEncMiscParameterTypeHRD:
-    {
+    case VAEncMiscParameterTypeHRD: {
         VAEncMiscParameterHRD *p = (VAEncMiscParameterHRD *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterHRD\n");
@@ -3515,36 +3494,32 @@
         va_TraceMsg(trace_ctx, "\tbuffer_size = %d\n", p->buffer_size);
         break;
     }
-    case VAEncMiscParameterTypeMaxFrameSize:
-    {
+    case VAEncMiscParameterTypeMaxFrameSize: {
         VAEncMiscParameterBufferMaxFrameSize *p = (VAEncMiscParameterBufferMaxFrameSize *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxFrameSize\n");
         va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
         break;
     }
-    case VAEncMiscParameterTypeMultiPassFrameSize:
-    {
+    case VAEncMiscParameterTypeMultiPassFrameSize: {
         int i;
         VAEncMiscParameterBufferMultiPassFrameSize *p = (VAEncMiscParameterBufferMultiPassFrameSize *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMultiPassFrameSize\n");
         va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
         va_TraceMsg(trace_ctx, "\tnum_passes = %d\n", p->num_passes);
-        for(i = 0; i<p->num_passes; ++i)
+        for (i = 0; i < p->num_passes; ++i)
             va_TraceMsg(trace_ctx, "\tdelta_qp[%d] = %d\n", i, p->delta_qp[i]);
         break;
     }
-    case VAEncMiscParameterTypeQualityLevel:
-    {
+    case VAEncMiscParameterTypeQualityLevel: {
         VAEncMiscParameterBufferQualityLevel *p = (VAEncMiscParameterBufferQualityLevel *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterBufferQualityLevel\n");
         va_TraceMsg(trace_ctx, "\tquality_level = %d\n", p->quality_level);
         break;
     }
-    case VAEncMiscParameterTypeROI:
-    {
+    case VAEncMiscParameterTypeROI: {
         int i;
         VAEncMiscParameterBufferROI *p = (VAEncMiscParameterBufferROI *)tmp->data;
 
@@ -3562,8 +3537,7 @@
         }
         break;
     }
-    case VAEncMiscParameterTypeRIR:
-    {
+    case VAEncMiscParameterTypeRIR: {
         VAEncMiscParameterRIR *p = (VAEncMiscParameterRIR *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterRIR\n");
@@ -3574,27 +3548,26 @@
         va_TraceMsg(trace_ctx, "\tqp_delta_for_inserted_intra = %d\n", p->qp_delta_for_inserted_intra);
         break;
     }
-    case VAEncMiscParameterTypeEncQuality:
-    {
+    case VAEncMiscParameterTypeEncQuality: {
         int i;
         VAEncMiscParameterEncQuality *p = (VAEncMiscParameterEncQuality *)tmp->data;
 
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterEncQuality\n");
-        va_TraceMsg(trace_ctx, "\tuseRawPicForRef = %d\n",p->useRawPicForRef);
-        va_TraceMsg(trace_ctx, "\tskipCheckDisable = %d\n",p->skipCheckDisable);
-        va_TraceMsg(trace_ctx, "\tFTQOverride = %d\n",p->FTQOverride);
-        va_TraceMsg(trace_ctx, "\tFTQEnable = %d\n",p->FTQEnable);
-        va_TraceMsg(trace_ctx, "\tFTQSkipThresholdLUTInput = %d\n",p->FTQSkipThresholdLUTInput);
-        va_TraceMsg(trace_ctx, "\tNonFTQSkipThresholdLUTInput = %d\n",p->NonFTQSkipThresholdLUTInput);
-        va_TraceMsg(trace_ctx, "\tReservedBit = %d\n",p->ReservedBit);
-        va_TraceMsg(trace_ctx, "\tdirectBiasAdjustmentEnable = %d\n",p->directBiasAdjustmentEnable);
-        va_TraceMsg(trace_ctx, "\tglobalMotionBiasAdjustmentEnable = %d\n",p->globalMotionBiasAdjustmentEnable);
-        va_TraceMsg(trace_ctx, "\tHMEMVCostScalingFactor = %d\n",p->HMEMVCostScalingFactor);
-        va_TraceMsg(trace_ctx, "\tHMEDisable = %d\n",p->HMEDisable);
-        va_TraceMsg(trace_ctx, "\tSuperHMEDisable = %d\n",p->SuperHMEDisable);
-        va_TraceMsg(trace_ctx, "\tUltraHMEDisable = %d\n",p->UltraHMEDisable);
-        va_TraceMsg(trace_ctx, "\tPanicModeDisable = %d\n",p->PanicModeDisable);
-        va_TraceMsg(trace_ctx, "\tForceRepartitionCheck = %d\n",p->ForceRepartitionCheck);
+        va_TraceMsg(trace_ctx, "\tuseRawPicForRef = %d\n", p->useRawPicForRef);
+        va_TraceMsg(trace_ctx, "\tskipCheckDisable = %d\n", p->skipCheckDisable);
+        va_TraceMsg(trace_ctx, "\tFTQOverride = %d\n", p->FTQOverride);
+        va_TraceMsg(trace_ctx, "\tFTQEnable = %d\n", p->FTQEnable);
+        va_TraceMsg(trace_ctx, "\tFTQSkipThresholdLUTInput = %d\n", p->FTQSkipThresholdLUTInput);
+        va_TraceMsg(trace_ctx, "\tNonFTQSkipThresholdLUTInput = %d\n", p->NonFTQSkipThresholdLUTInput);
+        va_TraceMsg(trace_ctx, "\tReservedBit = %d\n", p->ReservedBit);
+        va_TraceMsg(trace_ctx, "\tdirectBiasAdjustmentEnable = %d\n", p->directBiasAdjustmentEnable);
+        va_TraceMsg(trace_ctx, "\tglobalMotionBiasAdjustmentEnable = %d\n", p->globalMotionBiasAdjustmentEnable);
+        va_TraceMsg(trace_ctx, "\tHMEMVCostScalingFactor = %d\n", p->HMEMVCostScalingFactor);
+        va_TraceMsg(trace_ctx, "\tHMEDisable = %d\n", p->HMEDisable);
+        va_TraceMsg(trace_ctx, "\tSuperHMEDisable = %d\n", p->SuperHMEDisable);
+        va_TraceMsg(trace_ctx, "\tUltraHMEDisable = %d\n", p->UltraHMEDisable);
+        va_TraceMsg(trace_ctx, "\tPanicModeDisable = %d\n", p->PanicModeDisable);
+        va_TraceMsg(trace_ctx, "\tForceRepartitionCheck = %d\n", p->ForceRepartitionCheck);
         if (p->FTQSkipThresholdLUTInput) {
             va_TraceMsg(trace_ctx, "\tFTQSkipThresholdLUT[52]=\n");
             for (i = 0; i < 52; i++) {
@@ -3615,8 +3588,7 @@
         }
         break;
     }
-    case VAEncMiscParameterTypeSkipFrame:
-    {
+    case VAEncMiscParameterTypeSkipFrame: {
         VAEncMiscParameterSkipFrame *p = (VAEncMiscParameterSkipFrame *)tmp->data;
         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterSkipFrame\n");
         va_TraceMsg(trace_ctx, "\tskip_frame_flag = %d\n", p->skip_frame_flag);
@@ -3777,7 +3749,7 @@
     char tmp[1024];
     VAPictureParameterBufferVP8 *p = (VAPictureParameterBufferVP8 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    int i,j;
+    int i, j;
 
     va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVP8\n");
 
@@ -3803,16 +3775,16 @@
     va_TraceMsg(trace_ctx, "\tloop_filter_disable = %d\n", p->pic_fields.bits.loop_filter_disable);
 
     va_TraceMsg(trace_ctx, "\tmb_segment_tree_probs: 0x%2x, 0x%2x, 0x%2x\n",
-        p->mb_segment_tree_probs[0], p->mb_segment_tree_probs[1], p->mb_segment_tree_probs[2]);
+                p->mb_segment_tree_probs[0], p->mb_segment_tree_probs[1], p->mb_segment_tree_probs[2]);
 
     va_TraceMsg(trace_ctx, "\tloop_filter_level: %d, %d, %d, %d\n",
-        p->loop_filter_level[0], p->loop_filter_level[1], p->loop_filter_level[2], p->loop_filter_level[3]);
+                p->loop_filter_level[0], p->loop_filter_level[1], p->loop_filter_level[2], p->loop_filter_level[3]);
 
     va_TraceMsg(trace_ctx, "\tloop_filter_deltas_ref_frame: %d, %d, %d, %d\n",
-        p->loop_filter_deltas_ref_frame[0], p->loop_filter_deltas_ref_frame[1], p->loop_filter_deltas_ref_frame[2], p->loop_filter_deltas_ref_frame[3]);
+                p->loop_filter_deltas_ref_frame[0], p->loop_filter_deltas_ref_frame[1], p->loop_filter_deltas_ref_frame[2], p->loop_filter_deltas_ref_frame[3]);
 
     va_TraceMsg(trace_ctx, "\tloop_filter_deltas_mode: %d, %d, %d, %d\n",
-        p->loop_filter_deltas_mode[0], p->loop_filter_deltas_mode[1], p->loop_filter_deltas_mode[2], p->loop_filter_deltas_mode[3]);
+                p->loop_filter_deltas_mode[0], p->loop_filter_deltas_mode[1], p->loop_filter_deltas_mode[2], p->loop_filter_deltas_mode[3]);
 
     va_TraceMsg(trace_ctx, "\tprob_skip_false = %2x\n", p->prob_skip_false);
     va_TraceMsg(trace_ctx, "\tprob_intra = %2x\n", p->prob_intra);
@@ -3820,21 +3792,21 @@
     va_TraceMsg(trace_ctx, "\tprob_gf = %2x\n", p->prob_gf);
 
     va_TraceMsg(trace_ctx, "\ty_mode_probs: 0x%2x, 0x%2x, 0x%2x, 0x%2x\n",
-        p->y_mode_probs[0], p->y_mode_probs[1], p->y_mode_probs[2], p->y_mode_probs[3]);
+                p->y_mode_probs[0], p->y_mode_probs[1], p->y_mode_probs[2], p->y_mode_probs[3]);
 
     va_TraceMsg(trace_ctx, "\tuv_mode_probs: 0x%2x, 0x%2x, 0x%2x\n",
-        p->uv_mode_probs[0], p->uv_mode_probs[1], p->uv_mode_probs[2]);
+                p->uv_mode_probs[0], p->uv_mode_probs[1], p->uv_mode_probs[2]);
 
     va_TraceMsg(trace_ctx, "\tmv_probs[2][19]:\n");
-    for(i = 0; i<2; ++i) {
+    for (i = 0; i < 2; ++i) {
         memset(tmp, 0, sizeof tmp);
-        for (j=0; j<19; j++)
+        for (j = 0; j < 19; j++)
             sprintf(tmp + strlen(tmp), "%2x ", p->mv_probs[i][j]);
-        va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
+        va_TraceMsg(trace_ctx, "\t\t[%d] = %s\n", i, tmp);
     }
 
     va_TraceMsg(trace_ctx, "\tbool_coder_ctx: range = %02x, value = %02x, count = %d\n",
-        p->bool_coder_ctx.range, p->bool_coder_ctx.value, p->bool_coder_ctx.count);
+                p->bool_coder_ctx.range, p->bool_coder_ctx.value, p->bool_coder_ctx.count);
 
     va_TraceMsg(trace_ctx, NULL);
 
@@ -3862,7 +3834,7 @@
     va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
     va_TraceMsg(trace_ctx, "\tnum_of_partitions = %d\n", p->num_of_partitions);
 
-    for(i = 0; i<9; ++i)
+    for (i = 0; i < 9; ++i)
         va_TraceMsg(trace_ctx, "\tpartition_size[%d] = %d\n", i, p->partition_size[i]);
 
     va_TraceMsg(trace_ctx, NULL);
@@ -3882,7 +3854,7 @@
     char tmp[1024];
     VAIQMatrixBufferVP8 *p = (VAIQMatrixBufferVP8 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    int i,j;
+    int i, j;
 
     va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferVP8\n");
 
@@ -3891,7 +3863,7 @@
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 6; j++)
             sprintf(tmp + strlen(tmp), "%4x, ", p->quantization_index[i][j]);
-        va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
+        va_TraceMsg(trace_ctx, "\t\t[%d] = %s\n", i, tmp);
     }
 
     va_TraceMsg(trace_ctx, NULL);
@@ -3910,17 +3882,17 @@
     char tmp[1024];
     VAProbabilityDataBufferVP8 *p = (VAProbabilityDataBufferVP8 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    int i,j,k,l;
+    int i, j, k, l;
 
     va_TraceMsg(trace_ctx, "\t--VAProbabilityDataBufferVP8\n");
 
     for (i = 0; i < 4; i++)
         for (j = 0; j < 8; j++) {
             memset(tmp, 0, sizeof tmp);
-            for (k=0; k<3; k++)
-                for (l=0; l<11; l++)
+            for (k = 0; k < 3; k++)
+                for (l = 0; l < 11; l++)
                     sprintf(tmp + strlen(tmp), "%2x, ", p->dct_coeff_probs[i][j][k][l]);
-            va_TraceMsg(trace_ctx,"\t\t[%d, %d] = %s\n", i, j, tmp);
+            va_TraceMsg(trace_ctx, "\t\t[%d, %d] = %s\n", i, j, tmp);
         }
 
     va_TraceMsg(trace_ctx, NULL);
@@ -3954,7 +3926,7 @@
     va_TraceMsg(trace_ctx, "\tkf_min_dist = %d\n", p->kf_min_dist);
     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
 
-    for(i = 0; i<4; ++i)
+    for (i = 0; i < 4; ++i)
         va_TraceMsg(trace_ctx, "\treference_frames[%d] = 0x%08x\n", i, p->reference_frames[i]);
 
     va_TraceMsg(trace_ctx, NULL);
@@ -4096,7 +4068,7 @@
     va_TraceMsg(trace_ctx, "\tcurrent_display_picture = %X\n", p->current_display_picture);
 
     va_TraceMsg(trace_ctx, "\tanchor_frames_num = %d\n", p->anchor_frames_num);
-    for (i=0;i<p->anchor_frames_num;i++)
+    for (i = 0; i < p->anchor_frames_num; i++)
         va_TraceMsg(trace_ctx, "\t\tanchor_frames_list[%d] = %X\n", i, p->anchor_frames_list[i]);
 
     va_TraceMsg(trace_ctx, "\tframe_width_minus_1 = %d\n", p->frame_width_minus1);
@@ -4104,9 +4076,9 @@
     va_TraceMsg(trace_ctx, "\toutput_frame_width_in_tiles_minus_1 = %d\n", p->output_frame_width_in_tiles_minus_1);
     va_TraceMsg(trace_ctx, "\toutput_frame_height_in_tiles_minus_1 = %d\n", p->output_frame_height_in_tiles_minus_1);
 
-    for (i=0;i<8;i++)
+    for (i = 0; i < 8; i++)
         va_TraceMsg(trace_ctx, "\tref_frame_map[%d] = %X\n", i, p->ref_frame_map[i]);
-    for (i=0;i<7;i++)
+    for (i = 0; i < 7; i++)
         va_TraceMsg(trace_ctx, "\tref_frame_idx[%d] = %d\n", i, p->ref_frame_idx[i]);
     va_TraceMsg(trace_ctx, "\tprimary_ref_frame = %d\n", p->primary_ref_frame);
 
@@ -4118,11 +4090,11 @@
     va_TraceMsg(trace_ctx, "\t\t\tseg_info.segment_info_fields.bits.update_map = %d\n", p->seg_info.segment_info_fields.bits.update_map);
     va_TraceMsg(trace_ctx, "\t\t\tseg_info.segment_info_fields.bits.temporal_update = %d\n", p->seg_info.segment_info_fields.bits.temporal_update);
     va_TraceMsg(trace_ctx, "\t\t\tseg_info.segment_info_fields.bits.update_data = %d\n", p->seg_info.segment_info_fields.bits.update_data);
-    for (i=0;i<8;i++)
-      for (j=0;j<8;j++)
-        va_TraceMsg(trace_ctx, "\t\tseg_info.feature_data[%d][%d] = %d\n", i, j, p->seg_info.feature_data[i][j]);
-    for (i=0;i<8;i++)
-      va_TraceMsg(trace_ctx, "\t\tseg_info.feature_mask[%d] = %d\n", i, p->seg_info.feature_mask[i]);
+    for (i = 0; i < 8; i++)
+        for (j = 0; j < 8; j++)
+            va_TraceMsg(trace_ctx, "\t\tseg_info.feature_data[%d][%d] = %d\n", i, j, p->seg_info.feature_data[i][j]);
+    for (i = 0; i < 8; i++)
+        va_TraceMsg(trace_ctx, "\t\tseg_info.feature_mask[%d] = %d\n", i, p->seg_info.feature_mask[i]);
 
     va_TraceMsg(trace_ctx, "\tfilm_grain_info:\n");
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.film_grain_info_fields = %d\n", p->film_grain_info.film_grain_info_fields.value);
@@ -4136,26 +4108,26 @@
     va_TraceMsg(trace_ctx, "\t\t\tfilm_grain_info.film_grain_info_fields.clip_to_restricted_range = %d\n", p->film_grain_info.film_grain_info_fields.bits.clip_to_restricted_range);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.grain_seed = %d\n", p->film_grain_info.grain_seed);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.num_y_points = %d\n", p->film_grain_info.num_y_points);
-    for (i=0;i<14;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_y_value[%d] = %d\n", i, p->film_grain_info.point_y_value[i]);
-    for (i=0;i<14;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_y_scaling[%d] = %d\n", i, p->film_grain_info.point_y_scaling[i]);
+    for (i = 0; i < 14; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_y_value[%d] = %d\n", i, p->film_grain_info.point_y_value[i]);
+    for (i = 0; i < 14; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_y_scaling[%d] = %d\n", i, p->film_grain_info.point_y_scaling[i]);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.num_cb_points = %d\n", p->film_grain_info.num_cb_points);
-    for (i=0;i<10;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cb_value[%d] = %d\n", i, p->film_grain_info.point_cb_value[i]);
-    for (i=0;i<10;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cb_scaling[%d] = %d\n", i, p->film_grain_info.point_cb_scaling[i]);
+    for (i = 0; i < 10; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cb_value[%d] = %d\n", i, p->film_grain_info.point_cb_value[i]);
+    for (i = 0; i < 10; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cb_scaling[%d] = %d\n", i, p->film_grain_info.point_cb_scaling[i]);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.num_cr_points = %d\n", p->film_grain_info.num_cr_points);
-    for (i=0;i<10;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cr_value[%d] = %d\n", i, p->film_grain_info.point_cr_value[i]);
-    for (i=0;i<10;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cr_scaling[%d] = %d\n", i, p->film_grain_info.point_cr_scaling[i]);
-    for (i=0;i<24;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_y[%d] = %d\n", i, p->film_grain_info.ar_coeffs_y[i]);
-    for (i=0;i<25;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_cb[%d] = %d\n", i, p->film_grain_info.ar_coeffs_cb[i]);
-    for (i=0;i<25;i++)
-      va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_cr[%d] = %d\n", i, p->film_grain_info.ar_coeffs_cr[i]);
+    for (i = 0; i < 10; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cr_value[%d] = %d\n", i, p->film_grain_info.point_cr_value[i]);
+    for (i = 0; i < 10; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.point_cr_scaling[%d] = %d\n", i, p->film_grain_info.point_cr_scaling[i]);
+    for (i = 0; i < 24; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_y[%d] = %d\n", i, p->film_grain_info.ar_coeffs_y[i]);
+    for (i = 0; i < 25; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_cb[%d] = %d\n", i, p->film_grain_info.ar_coeffs_cb[i]);
+    for (i = 0; i < 25; i++)
+        va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.ar_coeffs_cr[%d] = %d\n", i, p->film_grain_info.ar_coeffs_cr[i]);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.cb_mult = %d\n", p->film_grain_info.cb_mult);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.cb_luma_mult = %d\n", p->film_grain_info.cb_luma_mult);
     va_TraceMsg(trace_ctx, "\t\tfilm_grain_info.cb_offset = %d\n", p->film_grain_info.cb_offset);
@@ -4165,10 +4137,10 @@
 
     va_TraceMsg(trace_ctx, "\ttile_cols = %d\n", p->tile_cols);
     va_TraceMsg(trace_ctx, "\ttile_rows = %d\n", p->tile_rows);
-    for (i=0;i<63;i++)
-      va_TraceMsg(trace_ctx, "\twidth_in_sbs_minus_1[%d] = %d\n", i, p->width_in_sbs_minus_1[i]);
-    for (i=0;i<63;i++)
-      va_TraceMsg(trace_ctx, "\theight_in_sbs_minus_1[%d] = %d\n", i, p->height_in_sbs_minus_1[i]);
+    for (i = 0; i < 63; i++)
+        va_TraceMsg(trace_ctx, "\twidth_in_sbs_minus_1[%d] = %d\n", i, p->width_in_sbs_minus_1[i]);
+    for (i = 0; i < 63; i++)
+        va_TraceMsg(trace_ctx, "\theight_in_sbs_minus_1[%d] = %d\n", i, p->height_in_sbs_minus_1[i]);
     va_TraceMsg(trace_ctx, "\ttile_count_minus_1 = %d\n", p->tile_count_minus_1);
     va_TraceMsg(trace_ctx, "\tcontext_update_tile_id = %d\n", p->context_update_tile_id);
 
@@ -4203,10 +4175,10 @@
     va_TraceMsg(trace_ctx, "\t\tloop_filter_info_fields.bits.mode_ref_delta_enabled = %d\n", p->loop_filter_info_fields.bits.mode_ref_delta_enabled);
     va_TraceMsg(trace_ctx, "\t\tloop_filter_info_fields.bits.mode_ref_delta_update = %d\n", p->loop_filter_info_fields.bits.mode_ref_delta_update);
 
-    for (i=0;i<8;i++)
-      va_TraceMsg(trace_ctx, "\tref_deltas[%d] = %d\n", i, p->ref_deltas[i]);
-    for (i=0;i<2;i++)
-      va_TraceMsg(trace_ctx, "\tmode_deltas[%d] = %d\n", i, p->mode_deltas[i]);
+    for (i = 0; i < 8; i++)
+        va_TraceMsg(trace_ctx, "\tref_deltas[%d] = %d\n", i, p->ref_deltas[i]);
+    for (i = 0; i < 2; i++)
+        va_TraceMsg(trace_ctx, "\tmode_deltas[%d] = %d\n", i, p->mode_deltas[i]);
 
     va_TraceMsg(trace_ctx, "\tbase_qindex = %d\n", p->base_qindex);
     va_TraceMsg(trace_ctx, "\ty_dc_delta_q = %d\n", p->y_dc_delta_q);
@@ -4234,10 +4206,10 @@
 
     va_TraceMsg(trace_ctx, "\tcdef_damping_minus_3 = %X\n", p->cdef_damping_minus_3);
     va_TraceMsg(trace_ctx, "\tcdef_bits = %X\n", p->cdef_bits);
-    for (i=0;i<8;i++)
-      va_TraceMsg(trace_ctx, "\tcdef_y_strengths[%d] = %d\n", i, p->cdef_y_strengths[i]);
-    for (i=0;i<8;i++)
-      va_TraceMsg(trace_ctx, "\tcdef_uv_strengths[%d] = %d\n", i, p->cdef_uv_strengths[i]);
+    for (i = 0; i < 8; i++)
+        va_TraceMsg(trace_ctx, "\tcdef_y_strengths[%d] = %d\n", i, p->cdef_y_strengths[i]);
+    for (i = 0; i < 8; i++)
+        va_TraceMsg(trace_ctx, "\tcdef_uv_strengths[%d] = %d\n", i, p->cdef_uv_strengths[i]);
 
     va_TraceMsg(trace_ctx, "\tloop_restoration_fields = %X\n", p->loop_restoration_fields.value);
     va_TraceMsg(trace_ctx, "\t\tloop_restoration_fields.bits.yframe_restoration_type = %d\n", p->loop_restoration_fields.bits.yframe_restoration_type);
@@ -4246,12 +4218,12 @@
     va_TraceMsg(trace_ctx, "\t\tloop_restoration_fields.bits.lr_unit_shift = %d\n", p->loop_restoration_fields.bits.lr_unit_shift);
     va_TraceMsg(trace_ctx, "\t\tloop_restoration_fields.bits.lr_uv_shift = %d\n", p->loop_restoration_fields.bits.lr_uv_shift);
 
-    for (i=0;i<7;i++) {
-      va_TraceMsg(trace_ctx, "\twm[%d]:\n", i);
-      va_TraceMsg(trace_ctx, "\t\twm[%d].wmtype = %d:\n", i, p->wm[i].wmtype);
-      for (j=0;j<8;j++)
-        va_TraceMsg(trace_ctx, "\t\twm[%d].wmmat[%d] = %d:\n", i, j, p->wm[i].wmmat[j]);
-      va_TraceMsg(trace_ctx, "\t\twm[%d].invalid = %d:\n", i, p->wm[i].invalid);
+    for (i = 0; i < 7; i++) {
+        va_TraceMsg(trace_ctx, "\twm[%d]:\n", i);
+        va_TraceMsg(trace_ctx, "\t\twm[%d].wmtype = %d:\n", i, p->wm[i].wmtype);
+        for (j = 0; j < 8; j++)
+            va_TraceMsg(trace_ctx, "\t\twm[%d].wmmat[%d] = %d:\n", i, j, p->wm[i].wmmat[j]);
+        va_TraceMsg(trace_ctx, "\t\twm[%d].invalid = %d:\n", i, p->wm[i].invalid);
     }
 
     va_TraceMsg(trace_ctx, NULL);
@@ -4311,12 +4283,12 @@
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.forced_lf_adjustment = %d\n", p->pic_flags.bits.forced_lf_adjustment);
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.reserved = %d\n", p->pic_flags.bits.reserved);
 
-    for(i=0;i<4;i++)
-       va_TraceMsg(trace_ctx, "\tloop_filter_level[%d] = %d\n", i, p->loop_filter_level[i]);
-    for(i=0;i<4;i++)
-       va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
-    for(i=0;i<4;i++)
-       va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
+    for (i = 0; i < 4; i++)
+        va_TraceMsg(trace_ctx, "\tloop_filter_level[%d] = %d\n", i, p->loop_filter_level[i]);
+    for (i = 0; i < 4; i++)
+        va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
+    for (i = 0; i < 4; i++)
+        va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
 
     va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->sharpness_level);
     va_TraceMsg(trace_ctx, "\tclamp_qindex_high = %d\n", p->clamp_qindex_high);
@@ -4347,8 +4319,8 @@
     va_TraceMsg(trace_ctx, "\tframe_height_dst = %d\n", p->frame_height_dst);
     va_TraceMsg(trace_ctx, "\treconstructed_frame = 0x%08x\n", p->reconstructed_frame);
 
-    for(i=0;i<8;i++)
-       va_TraceMsg(trace_ctx, "\treference_frames[%d] = 0x%08x\n", i, p->reference_frames[i]);
+    for (i = 0; i < 8; i++)
+        va_TraceMsg(trace_ctx, "\treference_frames[%d] = 0x%08x\n", i, p->reference_frames[i]);
 
     va_TraceMsg(trace_ctx, "\tcoded_buf = 0x%x\n", p->coded_buf);
 
@@ -4392,10 +4364,10 @@
     va_TraceMsg(trace_ctx, "\tfilter_level = %d\n", p->filter_level);
     va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->sharpness_level);
 
-    for(i=0;i<4;i++)
-       va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
-    for(i=0;i<2;i++)
-       va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
+    for (i = 0; i < 4; i++)
+        va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
+    for (i = 0; i < 2; i++)
+        va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
 
 
     va_TraceMsg(trace_ctx, "\tbit_offset_ref_lf_delta = %d\n", p->bit_offset_ref_lf_delta);
@@ -4644,7 +4616,7 @@
     va_TraceMsg(trace_ctx, "\tsample_bit_depth = %d\n", p->sample_bit_depth);
     va_TraceMsg(trace_ctx, "\tnum_scan = %d\n", p->num_scan);
     va_TraceMsg(trace_ctx, "\tnum_components = %d\n", p->num_components);
-    for (i=0; i<p->num_components; i++)
+    for (i = 0; i < p->num_components; i++)
         va_TraceMsg(trace_ctx, "\tcomponent_id[%d] = %d\n", i, p->component_id[i]);
 
     if (p->quality > 0)
@@ -4718,7 +4690,7 @@
     va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBufferJPEG\n");
     va_TraceMsg(trace_ctx, "\trestart_interval = 0x%04x\n", p->restart_interval);
     va_TraceMsg(trace_ctx, "\tnum_components = 0x%08x\n", p->num_components);
-    for (i=0; i<4; i++) {
+    for (i = 0; i < 4; i++) {
         va_TraceMsg(trace_ctx, "\tcomponents[%i] =\n ", i);
         va_TraceMsg(trace_ctx, "\t\tcomponent_selector = %d\n", p->components[i].component_selector);
         va_TraceMsg(trace_ctx, "\t\tdc_table_selector = %d\n", p->components[i].dc_table_selector);
@@ -4916,30 +4888,30 @@
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
     switch (type) {
-        case VAPictureParameterBufferType:
-            va_TraceVAPictureParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VASliceParameterBufferType:
-            va_TraceVASliceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VAIQMatrixBufferType:
-            va_TraceVAIQMatrixBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VAEncSequenceParameterBufferType:
-            va_TraceVAEncSequenceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VAEncPictureParameterBufferType:
-            va_TraceVAEncPictureParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VAEncSliceParameterBufferType:
-            va_TraceVAEncSliceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        case VAEncMiscParameterBufferType:
-            va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
-        default:
-            va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
-            break;
+    case VAPictureParameterBufferType:
+        va_TraceVAPictureParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VASliceParameterBufferType:
+        va_TraceVASliceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VAIQMatrixBufferType:
+        va_TraceVAIQMatrixBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VAEncSequenceParameterBufferType:
+        va_TraceVAEncSequenceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VAEncPictureParameterBufferType:
+        va_TraceVAEncPictureParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VAEncSliceParameterBufferType:
+        va_TraceVAEncSliceParameterBufferHEVC(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    case VAEncMiscParameterBufferType:
+        va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
+    default:
+        va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
+        break;
     }
 }
 
@@ -5288,13 +5260,13 @@
         switch (base_filter->type) {
         case VAProcFilterDeinterlacing:
             va_TraceProcFilterParameterBufferDeinterlacing(dpy,
-                                                           context,
-                                                           base_filter);
+                    context,
+                    base_filter);
             break;
         case VAProcFilterColorBalance:
             va_TraceProcFilterParameterBufferColorBalance(dpy,
-                                                          context,
-                                                          base_filter);
+                    context,
+                    base_filter);
             break;
         default:
             va_TraceProcFilterParameterBufferBase(dpy,
@@ -5458,65 +5430,65 @@
         switch (trace_ctx->trace_profile) {
         case VAProfileMPEG2Simple:
         case VAProfileMPEG2Main:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
-                va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileMPEG4Simple:
         case VAProfileMPEG4AdvancedSimple:
         case VAProfileMPEG4Main:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
-                va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileH264Main:
         case VAProfileH264High:
         case VAProfileH264ConstrainedBaseline:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileVC1Simple:
         case VAProfileVC1Main:
         case VAProfileVC1Advanced:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileH263Baseline:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileJPEGBaseline:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceJPEGBuf (dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceJPEGBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
 
         case VAProfileNone:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
 
         case VAProfileVP8Version0_3:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
-                va_TraceVP8Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceVP8Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
 
@@ -5532,28 +5504,28 @@
         case VAProfileHEVCSccMain10:
         case VAProfileHEVCSccMain444:
         case VAProfileHEVCSccMain444_10:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] = ", j);
 
-                va_TraceHEVCBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceHEVCBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileVP9Profile0:
         case VAProfileVP9Profile1:
         case VAProfileVP9Profile2:
         case VAProfileVP9Profile3:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] = \n", j);
 
-                va_TraceVP9Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceVP9Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         case VAProfileAV1Profile0:
         case VAProfileAV1Profile1:
-            for (j=0; j<num_elements; j++) {
+            for (j = 0; j < num_elements; j++) {
                 va_TraceMsg(trace_ctx, "\telement[%d] = \n", j);
 
-                va_TraceAV1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
+                va_TraceAV1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
             }
             break;
         default:
@@ -5595,7 +5567,7 @@
     jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
 
     /* trace encode source surface, can do it before HW completes rendering */
-    if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))||
+    if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
         (jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
         va_TraceSurface(dpy, context);
 
@@ -5604,7 +5576,7 @@
         vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
         va_TraceSurface(dpy, context);
     }
- }
+}
 
 
 void va_TraceSyncSurface(
@@ -5720,7 +5692,7 @@
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
-void va_TraceMaxNumDisplayAttributes (
+void va_TraceMaxNumDisplayAttributes(
     VADisplay dpy,
     int number
 )
@@ -5735,7 +5707,7 @@
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
-void va_TraceQueryDisplayAttributes (
+void va_TraceQueryDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,    /* out */
     int *num_attributes               /* out */
@@ -5751,7 +5723,7 @@
     TRACE_FUNCNAME(idx);
     va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", *num_attributes);
 
-    for (i=0; i<*num_attributes; i++) {
+    for (i = 0; i < *num_attributes; i++) {
         va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n", i);
         va_TraceMsg(trace_ctx, "\t  type = 0x%08x\n", attr_list[i].type);
         va_TraceMsg(trace_ctx, "\t  min_value = %d\n", attr_list[i].min_value);
@@ -5765,7 +5737,7 @@
 }
 
 
-static void va_TraceDisplayAttributes (
+static void va_TraceDisplayAttributes(
     struct trace_context *trace_ctx,
     VADisplayAttribute *attr_list,
     int num_attributes
@@ -5778,7 +5750,7 @@
 
     va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", num_attributes);
 
-    for (i=0; i<num_attributes; i++) {
+    for (i = 0; i < num_attributes; i++) {
         va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n", i);
         va_TraceMsg(trace_ctx, "\t  type = 0x%08x\n", attr_list[i].type);
         va_TraceMsg(trace_ctx, "\t  min_value = %d\n", attr_list[i].min_value);
@@ -5790,7 +5762,7 @@
 }
 
 
-void va_TraceGetDisplayAttributes (
+void va_TraceGetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
@@ -5800,12 +5772,12 @@
 
     TRACE_FUNCNAME(idx);
 
-    va_TraceDisplayAttributes (trace_ctx, attr_list, num_attributes);
+    va_TraceDisplayAttributes(trace_ctx, attr_list, num_attributes);
 
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
-void va_TraceSetDisplayAttributes (
+void va_TraceSetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
@@ -5815,13 +5787,13 @@
 
     TRACE_FUNCNAME(idx);
 
-    va_TraceDisplayAttributes (trace_ctx, attr_list, num_attributes);
+    va_TraceDisplayAttributes(trace_ctx, attr_list, num_attributes);
 
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
 
 
-void va_TracePutSurface (
+void va_TracePutSurface(
     VADisplay dpy,
     VASurfaceID surface,
     void *draw, /* the target Drawable */
@@ -5864,6 +5836,6 @@
 {
     DPY2TRACE_VIRCTX(dpy);
 
-    va_TraceMsg(trace_ctx, "=========%s ret = %s, %s \n",funcName, vaStatusStr(status), vaErrorStr(status));
+    va_TraceMsg(trace_ctx, "=========%s ret = %s, %s \n", funcName, vaStatusStr(status), vaErrorStr(status));
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
diff --git a/va/va_trace.h b/va/va_trace.h
index 5360443..87bcf28 100644
--- a/va/va_trace.h
+++ b/va/va_trace.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -60,29 +60,29 @@
 void va_TraceEnd(VADisplay dpy);
 
 DLL_HIDDEN
-void va_TraceInitialize (
+void va_TraceInitialize(
     VADisplay dpy,
-    int *major_version,	 /* out */
-    int *minor_version 	 /* out */
+    int *major_version,  /* out */
+    int *minor_version   /* out */
 );
 
 DLL_HIDDEN
-void va_TraceTerminate (
+void va_TraceTerminate(
     VADisplay dpy
 );
 
 DLL_HIDDEN
 void va_TraceCreateConfig(
     VADisplay dpy,
-    VAProfile profile, 
-    VAEntrypoint entrypoint, 
+    VAProfile profile,
+    VAEntrypoint entrypoint,
     VAConfigAttrib *attrib_list,
     int num_attribs,
     VAConfigID *config_id /* out */
 );
 
 DLL_HIDDEN
-void va_TraceDestroyConfig (
+void va_TraceDestroyConfig(
     VADisplay dpy,
     VAConfigID config_id
 );
@@ -94,7 +94,7 @@
     int height,
     int format,
     int num_surfaces,
-    VASurfaceID *surfaces,	/* out */
+    VASurfaceID *surfaces,  /* out */
     VASurfaceAttrib    *attrib_list,
     unsigned int        num_attribs
 );
@@ -115,37 +115,37 @@
     int flag,
     VASurfaceID *render_targets,
     int num_render_targets,
-    VAContextID *context		/* out */
+    VAContextID *context        /* out */
 );
 
 DLL_HIDDEN
-void va_TraceDestroyContext (
+void va_TraceDestroyContext(
     VADisplay dpy,
     VAContextID context
 );
 
 DLL_HIDDEN
-void va_TraceCreateMFContext (
+void va_TraceCreateMFContext(
     VADisplay dpy,
-    VAContextID *mf_context	/* out */
+    VAContextID *mf_context /* out */
 );
 
 DLL_HIDDEN
-void va_TraceMFAddContext (
+void va_TraceMFAddContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
 );
 
 DLL_HIDDEN
-void va_TraceMFReleaseContext (
+void va_TraceMFReleaseContext(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID context
 );
 
 DLL_HIDDEN
-void va_TraceMFSubmit (
+void va_TraceMFSubmit(
     VADisplay dpy,
     VAMFContextID mf_context,
     VAContextID *contexts,
@@ -153,27 +153,27 @@
 );
 
 DLL_HIDDEN
-void va_TraceCreateBuffer (
+void va_TraceCreateBuffer(
     VADisplay dpy,
-    VAContextID context,	/* in */
-    VABufferType type,		/* in */
-    unsigned int size,		/* in */
-    unsigned int num_elements,	/* in */
-    void *data,			/* in */
-    VABufferID *buf_id		/* out */
+    VAContextID context,    /* in */
+    VABufferType type,      /* in */
+    unsigned int size,      /* in */
+    unsigned int num_elements,  /* in */
+    void *data,         /* in */
+    VABufferID *buf_id      /* out */
 );
 
 DLL_HIDDEN
-void va_TraceDestroyBuffer (
+void va_TraceDestroyBuffer(
     VADisplay dpy,
     VABufferID buf_id    /* in */
 );
 
 DLL_HIDDEN
-void va_TraceMapBuffer (
+void va_TraceMapBuffer(
     VADisplay dpy,
-    VABufferID buf_id,	/* in */
-    void **pbuf 	/* out */
+    VABufferID buf_id,  /* in */
+    void **pbuf     /* out */
 );
 
 
@@ -231,15 +231,15 @@
 void va_TraceQuerySurfaceStatus(
     VADisplay dpy,
     VASurfaceID render_target,
-    VASurfaceStatus *status	/* out */
+    VASurfaceStatus *status /* out */
 );
 
 DLL_HIDDEN
 void va_TraceQuerySurfaceError(
-	VADisplay dpy,
-	VASurfaceID surface,
-	VAStatus error_status,
-	void **error_info /*out*/
+    VADisplay dpy,
+    VASurfaceID surface,
+    VAStatus error_status,
+    void **error_info /*out*/
 );
 
 DLL_HIDDEN
@@ -250,34 +250,34 @@
 );
 
 DLL_HIDDEN
-void va_TraceMaxNumDisplayAttributes (
+void va_TraceMaxNumDisplayAttributes(
     VADisplay dpy,
     int number
 );
 
 DLL_HIDDEN
-void va_TraceQueryDisplayAttributes (
+void va_TraceQueryDisplayAttributes(
     VADisplay dpy,
-    VADisplayAttribute *attr_list,	/* out */
-    int *num_attributes			/* out */
+    VADisplayAttribute *attr_list,  /* out */
+    int *num_attributes         /* out */
 );
 
 DLL_HIDDEN
-void va_TraceGetDisplayAttributes (
+void va_TraceGetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
 );
 
 DLL_HIDDEN
-void va_TraceSetDisplayAttributes (
+void va_TraceSetDisplayAttributes(
     VADisplay dpy,
     VADisplayAttribute *attr_list,
     int num_attributes
 );
 
 /* extern function called by display side */
-void va_TracePutSurface (
+void va_TracePutSurface(
     VADisplay dpy,
     VASurfaceID surface,
     void *draw, /* the target Drawable */
@@ -299,6 +299,6 @@
 #ifdef __cplusplus
 }
 #endif
-    
+
 
 #endif /* VA_TRACE_H */
diff --git a/va/va_vpp.h b/va/va_vpp.h
index c592613..193dc5f 100755
--- a/va/va_vpp.h
+++ b/va/va_vpp.h
@@ -528,7 +528,7 @@
 /** @name Pipeline end flags */
 /**@{*/
 /** \brief Specifies the pipeline is the last. */
-#define VA_PIPELINE_FLAG_END		0x00000004
+#define VA_PIPELINE_FLAG_END        0x00000004
 /**@}*/
 
 /** @name Chroma Siting flag */
@@ -658,11 +658,11 @@
     /** \brief Min supported output height in pixels. */
     uint32_t        min_output_height;
     /** \brief Reserved bytes for future use, must be zero */
-    #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__LP64__)
+#if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__LP64__)
     uint32_t        va_reserved[VA_PADDING_HIGH - 2];
-    #else
+#else
     uint32_t        va_reserved[VA_PADDING_HIGH];
-    #endif
+#endif
 } VAProcPipelineCaps;
 
 /** \brief Specification of values supported by the filter. */
@@ -762,8 +762,7 @@
  *  2) the display on which the content will be presented. If it is for display, max_content_light_level
  *  and max_pic_average_light_level are ignored.
  */
-typedef struct _VAHdrMetaDataHDR10
-{
+typedef struct _VAHdrMetaDataHDR10 {
     /**
      * \brief X chromaticity coordinate of the mastering display.
      *
@@ -772,7 +771,7 @@
      * Index value c equal to 2 should correspond to the red primary.
      * The value for display_primaries_x shall be in the range of 0 to 50000 inclusive.
      */
-    uint16_t	display_primaries_x[3];
+    uint16_t    display_primaries_x[3];
     /**
      * \brief Y chromaticity coordinate of the mastering display.
      *
@@ -781,19 +780,19 @@
      * Index value c equal to 2 should correspond to the red primary.
      * The value for display_primaries_y shall be in the range of 0 to 50000 inclusive.
      */
-    uint16_t	display_primaries_y[3];
+    uint16_t    display_primaries_y[3];
     /**
      * \brief X chromaticity coordinate of the white point of the mastering display.
      *
      * The value for white_point_x shall be in the range of 0 to 50000 inclusive.
      */
-    uint16_t	white_point_x;
+    uint16_t    white_point_x;
     /**
      * \brief Y chromaticity coordinate of the white point of the mastering display.
      *
      * The value for white_point_y shall be in the range of 0 to 50000 inclusive.
      */
-    uint16_t	white_point_y;
+    uint16_t    white_point_y;
     /**
      * \brief The maximum display luminance of the mastering display.
      *
@@ -839,8 +838,7 @@
 } VAProcFilterCapHighDynamicRange;
 
 /** \brief High Dynamic Range Meta Data. */
-typedef struct _VAHdrMetaData
-{
+typedef struct _VAHdrMetaData {
     /** \brief high dynamic range metadata type, HDR10 etc. */
     VAProcHighDynamicRangeMetadataType       metadata_type;
     /**
@@ -1061,7 +1059,7 @@
      * bit0~3: Surface sample type
      * - 0000: Progressive --> VA_FRAME_PICTURE
      * - 0001: Single Top Field --> VA_TOP_FIELD
-     * - 0010: Single Bottom Field --> VA_BOTTOM_FIELD  
+     * - 0010: Single Bottom Field --> VA_BOTTOM_FIELD
      * - 0100: Interleaved Top Field First --> VA_TOP_FIELD_FIRST
      * - 1000: Interleaved Bottom Field First --> VA_BOTTOM_FIELD_FIRST
      *
@@ -1083,11 +1081,11 @@
      *   -- set backward_reference with the second field surface id
      *   -- set input_surface_flag as VA_TOP_FIELD
      *   -- set output_surface_flag as VA_TOP_FIELD_FIRST
-     * - 4. Field to Field: 
+     * - 4. Field to Field:
      *   -- set flag according to each frame.
      *
      * bit31: Surface encryption
-     * - 0: non-protected  
+     * - 0: non-protected
      * - 1: protected
      *
      * bit4~30 for future
@@ -1099,12 +1097,12 @@
      * bit0~3: Surface sample type
      * - 0000: Progressive --> VA_FRAME_PICTURE
      * - 0001: Top Field --> VA_TOP_FIELD
-     * - 0010: Bottom Field --> VA_BOTTOM_FIELD  
+     * - 0010: Bottom Field --> VA_BOTTOM_FIELD
      * - 0100: Top Field First --> VA_TOP_FIELD_FIRST
      * - 1000: Bottom Field First --> VA_BOTTOM_FIELD_FIRST
      *
      * bit31: Surface encryption
-     * - 0: non-protected  
+     * - 0: non-protected
      * - 1: protected
      *
      * bit4~30 for future
@@ -1130,11 +1128,11 @@
     VAHdrMetaData          *output_hdr_metadata;
 
     /** \brief Reserved bytes for future use, must be zero */
-    #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)|| defined(__LP64__)
+#if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)|| defined(__LP64__)
     uint32_t                va_reserved[VA_PADDING_LARGE - 16];
-    #else
+#else
     uint32_t                va_reserved[VA_PADDING_LARGE - 13];
-    #endif
+#endif
 } VAProcPipelineParameterBuffer;
 
 /**
@@ -1167,27 +1165,27 @@
 
 /** @name De-interlacing flags */
 /**@{*/
-/** 
- * \brief Bottom field first in the input frame. 
+/**
+ * \brief Bottom field first in the input frame.
  * if this is not set then assumes top field first.
  */
-#define VA_DEINTERLACING_BOTTOM_FIELD_FIRST	0x0001
-/** 
- * \brief Bottom field used in deinterlacing. 
+#define VA_DEINTERLACING_BOTTOM_FIELD_FIRST 0x0001
+/**
+ * \brief Bottom field used in deinterlacing.
  * if this is not set then assumes top field is used.
  */
-#define VA_DEINTERLACING_BOTTOM_FIELD		0x0002
-/** 
- * \brief A single field is stored in the input frame. 
+#define VA_DEINTERLACING_BOTTOM_FIELD       0x0002
+/**
+ * \brief A single field is stored in the input frame.
  * if this is not set then assumes the frame contains two interleaved fields.
  */
-#define VA_DEINTERLACING_ONE_FIELD		0x0004
+#define VA_DEINTERLACING_ONE_FIELD      0x0004
 /**
  * \brief Film Mode Detection is enabled. If enabled, driver performs inverse
  * of various pulldowns, such as 3:2 pulldown.
  * if this is not set then assumes FMD is disabled.
  */
-#define VA_DEINTERLACING_FMD_ENABLE		0x0008
+#define VA_DEINTERLACING_FMD_ENABLE     0x0008
 
 //Scene change parameter for ADI on Linux, if enabled, driver use spatial DI(Bob), instead of ADI. if not, use old behavior for ADI
 //Input stream is TFF(set flags = 0), SRC0,1,2,3 are interlaced frame (top +bottom fields), DSTs are progressive frames
@@ -1220,7 +1218,7 @@
     /** \brief Deinterlacing algorithm. */
     VAProcDeinterlacingType     algorithm;
     /** \brief Deinterlacing flags. */
-    uint32_t     		flags;
+    uint32_t            flags;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
@@ -1274,7 +1272,7 @@
     /**
      * \brief Color balance value.
      *
-     * Special case for automatically adjusted attributes. e.g. 
+     * Special case for automatically adjusted attributes. e.g.
      * #VAProcColorBalanceAutoSaturation,
      * #VAProcColorBalanceAutoBrightness,
      * #VAProcColorBalanceAutoContrast.
diff --git a/va/va_x11.h b/va/va_x11.h
index c9be38d..c7e15d7 100644
--- a/va/va_x11.h
+++ b/va/va_x11.h
@@ -34,21 +34,21 @@
 /*
  * Returns a suitable VADisplay for VA API
  */
-VADisplay vaGetDisplay (
+VADisplay vaGetDisplay(
     Display *dpy
 );
 
 /*
  * Output rendering
- * Following is the rendering interface for X windows, 
+ * Following is the rendering interface for X windows,
  * to get the decode output surface to a X drawable
- * It basically performs a de-interlacing (if needed), 
+ * It basically performs a de-interlacing (if needed),
  * color space conversion and scaling to the destination
  * rectangle
  */
-VAStatus vaPutSurface (
+VAStatus vaPutSurface(
     VADisplay dpy,
-    VASurfaceID surface,	
+    VASurfaceID surface,
     Drawable draw, /* X Drawable */
     short srcx,
     short srcy,
diff --git a/va/wayland/va_backend_wayland.h b/va/wayland/va_backend_wayland.h
index 906d4bf..7d72e5f 100644
--- a/va/wayland/va_backend_wayland.h
+++ b/va/wayland/va_backend_wayland.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -46,7 +46,7 @@
     unsigned int version;
 
     /** \brief Hook to return Wayland buffer associated with the VA surface. */
-    VAStatus (*vaGetSurfaceBufferWl)(
+    VAStatus(*vaGetSurfaceBufferWl)(
         struct VADriverContext *ctx,
         VASurfaceID             surface,
         unsigned int            flags,
@@ -54,7 +54,7 @@
     );
 
     /** \brief Hook to return Wayland buffer associated with the VA image. */
-    VAStatus (*vaGetImageBufferWl)(
+    VAStatus(*vaGetImageBufferWl)(
         struct VADriverContext *ctx,
         VAImageID               image,
         unsigned int            flags,
diff --git a/va/wayland/va_wayland.c b/va/wayland/va_wayland.c
index 86ae6ac..dbf4b16 100644
--- a/va/wayland/va_wayland.c
+++ b/va/wayland/va_wayland.c
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -106,10 +106,14 @@
 };
 
 static const struct va_wayland_backend g_backends[] = {
-    { va_wayland_drm_create,
-      va_wayland_drm_destroy },
-    { va_wayland_emgd_create,
-      va_wayland_emgd_destroy },
+    {
+        va_wayland_drm_create,
+        va_wayland_drm_destroy
+    },
+    {
+        va_wayland_emgd_create,
+        va_wayland_emgd_destroy
+    },
     { NULL, }
 };
 
@@ -171,7 +175,7 @@
     if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaGetSurfaceBufferWl)
         return VA_STATUS_ERROR_UNIMPLEMENTED;
     return ctx->vtable_wayland->vaGetSurfaceBufferWl(ctx, surface, flags,
-                                                     out_buffer);
+            out_buffer);
 }
 
 VAStatus
@@ -189,5 +193,5 @@
     if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaGetImageBufferWl)
         return VA_STATUS_ERROR_UNIMPLEMENTED;
     return ctx->vtable_wayland->vaGetImageBufferWl(ctx, image, flags,
-                                                   out_buffer);
+            out_buffer);
 }
diff --git a/va/wayland/va_wayland.h b/va/wayland/va_wayland.h
index 46fbf2c..baf5fa4 100644
--- a/va/wayland/va_wayland.h
+++ b/va/wayland/va_wayland.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/wayland/va_wayland_drm.c b/va/wayland/va_wayland_drm.c
index 9f03ab0..aca06e6 100644
--- a/va/wayland/va_wayland_drm.c
+++ b/va/wayland/va_wayland_drm.c
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -232,7 +232,7 @@
 
 static bool
 wayland_roundtrip_queue(struct wl_display *display,
-                         struct wl_event_queue *queue)
+                        struct wl_event_queue *queue)
 {
     if (wl_display_roundtrip_queue(display, queue) < 0) {
         int err = wl_display_get_error(display);
diff --git a/va/wayland/va_wayland_drm.h b/va/wayland/va_wayland_drm.h
index 6fb8f52..b770ee2 100644
--- a/va/wayland/va_wayland_drm.h
+++ b/va/wayland/va_wayland_drm.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/wayland/va_wayland_emgd.c b/va/wayland/va_wayland_emgd.c
index fb8a136..bba87e6 100644
--- a/va/wayland/va_wayland_emgd.c
+++ b/va/wayland/va_wayland_emgd.c
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -134,7 +134,7 @@
     drm_state->auth_type = 0;
     ctx->drm_state       = drm_state;
 
-    wl_emgd_ctx->handle = dlopen(LIBWAYLAND_EMGD_NAME, RTLD_LAZY|RTLD_LOCAL);
+    wl_emgd_ctx->handle = dlopen(LIBWAYLAND_EMGD_NAME, RTLD_LAZY | RTLD_LOCAL);
     if (!wl_emgd_ctx->handle)
         return false;
 
diff --git a/va/wayland/va_wayland_emgd.h b/va/wayland/va_wayland_emgd.h
index 053b6b4..4c93008 100644
--- a/va/wayland/va_wayland_emgd.h
+++ b/va/wayland/va_wayland_emgd.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/wayland/va_wayland_private.h b/va/wayland/va_wayland_private.h
index f09f4b7..8ca21f1 100644
--- a/va/wayland/va_wayland_private.h
+++ b/va/wayland/va_wayland_private.h
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c
index 2218adf..6ce009a 100644
--- a/va/x11/dri2_util.c
+++ b/va/x11/dri2_util.c
@@ -47,8 +47,7 @@
 #define __DRI_BUFFER_FAKE_FRONT_LEFT    7
 #define __DRI_BUFFER_FAKE_FRONT_RIGHT   8
 
-struct dri2_drawable 
-{
+struct dri2_drawable {
     struct dri_drawable base;
     union dri_buffer buffers[5];
     int width;
@@ -60,7 +59,7 @@
 
 static int gsDRI2SwapAvailable;
 
-static struct dri_drawable * 
+static struct dri_drawable *
 dri2CreateDrawable(VADriverContextP ctx, XID x_drawable)
 {
     struct dri2_drawable *dri2_drawable;
@@ -78,14 +77,14 @@
     return &dri2_drawable->base;
 }
 
-static void 
+static void
 dri2DestroyDrawable(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
     VA_DRI2DestroyDrawable(ctx->native_dpy, dri_drawable->x_drawable);
     free(dri_drawable);
 }
 
-static void 
+static void
 dri2SwapBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
     struct dri2_drawable *dri2_drawable = (struct dri2_drawable *)dri_drawable;
@@ -96,8 +95,8 @@
         if (gsDRI2SwapAvailable) {
             CARD64 ret;
             VA_DRI2SwapBuffers(ctx->native_dpy, dri_drawable->x_drawable,
-			       0, 1, 0,
-			       &ret);
+                               0, 1, 0,
+                               &ret);
         } else {
             xrect.x = 0;
             xrect.y = 0;
@@ -113,14 +112,14 @@
 }
 
 static union dri_buffer *
-dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
+    dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
     struct dri2_drawable *dri2_drawable = (struct dri2_drawable *)dri_drawable;
     int i;
     int count;
     unsigned int attachments[5];
     VA_DRI2Buffer *buffers;
-    
+
     i = 0;
     if (dri_drawable->is_window)
         attachments[i++] = __DRI_BUFFER_BACK_LEFT;
@@ -128,8 +127,8 @@
         attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
 
     buffers = VA_DRI2GetBuffers(ctx->native_dpy, dri_drawable->x_drawable,
-			     &dri2_drawable->width, &dri2_drawable->height, 
-                             attachments, i, &count);
+                                &dri2_drawable->width, &dri2_drawable->height,
+                                attachments, i, &count);
     if (buffers == NULL)
         return NULL;
 
@@ -141,7 +140,7 @@
         dri2_drawable->buffers[i].dri2.pitch = buffers[i].pitch;
         dri2_drawable->buffers[i].dri2.cpp = buffers[i].cpp;
         dri2_drawable->buffers[i].dri2.flags = buffers[i].flags;
-        
+
         if (buffers[i].attachment == __DRI_BUFFER_BACK_LEFT) {
             dri2_drawable->has_backbuffer = 1;
             dri2_drawable->back_index = i;
@@ -150,7 +149,7 @@
         if (buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
             dri2_drawable->front_index = i;
     }
-    
+
     dri_drawable->width = dri2_drawable->width;
     dri_drawable->height = dri2_drawable->height;
     Xfree(buffers);
@@ -169,10 +168,10 @@
     va_dri_free_drawable_hashtable(ctx);
 
     if (dri_state->base.fd >= 0)
-	close(dri_state->base.fd);
+        close(dri_state->base.fd);
 }
 
-Bool 
+Bool
 va_isDRI2Connected(VADriverContextP ctx, char **driver_name)
 {
     struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
@@ -180,7 +179,7 @@
     int error_base;
     int event_base;
     char *device_name = NULL;
-    drm_magic_t magic;        
+    drm_magic_t magic;
     *driver_name = NULL;
 
     if (!VA_DRI2QueryExtension(ctx->native_dpy, &event_base, &error_base))
@@ -191,7 +190,7 @@
 
 
     if (!VA_DRI2Connect(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen),
-                     driver_name, &device_name))
+                        driver_name, &device_name))
         goto err_out;
 
     if ((dri_state->base.fd != -1) && (dri_state->base.auth_type != VA_NONE))
@@ -206,7 +205,7 @@
         goto err_out;
 
     if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen),
-                          magic))
+                             magic))
         goto err_out;
 
     dri_state->base.auth_type = VA_DRI2;
@@ -234,7 +233,7 @@
 
     *driver_name = NULL;
     dri_state->base.fd = -1;
-    
+
     return False;
 }
 
diff --git a/va/x11/va_dri2.c b/va/x11/va_dri2.c
index a395260..db4d7a1 100644
--- a/va/x11/va_dri2.c
+++ b/va/x11/va_dri2.c
@@ -58,25 +58,25 @@
 static char va_dri2ExtensionName[] = DRI2_NAME;
 static XExtensionInfo _va_dri2_info_data;
 static XExtensionInfo *va_dri2Info = &_va_dri2_info_data;
-static XEXT_GENERATE_CLOSE_DISPLAY (VA_DRI2CloseDisplay, va_dri2Info)
+static XEXT_GENERATE_CLOSE_DISPLAY(VA_DRI2CloseDisplay, va_dri2Info)
 static /* const */ XExtensionHooks va_dri2ExtensionHooks = {
-    NULL,				/* create_gc */
-    NULL,				/* copy_gc */
-    NULL,				/* flush_gc */
-    NULL,				/* free_gc */
-    NULL,				/* create_font */
-    NULL,				/* free_font */
-    VA_DRI2CloseDisplay,		/* close_display */
-    NULL,				/* wire_to_event */
-    NULL,				/* event_to_wire */
-    VA_DRI2Error,			/* error */
-    NULL,				/* error_string */
+    NULL,               /* create_gc */
+    NULL,               /* copy_gc */
+    NULL,               /* flush_gc */
+    NULL,               /* free_gc */
+    NULL,               /* create_font */
+    NULL,               /* free_font */
+    VA_DRI2CloseDisplay,        /* close_display */
+    NULL,               /* wire_to_event */
+    NULL,               /* event_to_wire */
+    VA_DRI2Error,           /* error */
+    NULL,               /* error_string */
 };
 
-static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, va_dri2Info, 
-				   va_dri2ExtensionName, 
-				   &va_dri2ExtensionHooks, 
-				   0, NULL)
+static XEXT_GENERATE_FIND_DISPLAY(DRI2FindDisplay, va_dri2Info,
+                                  va_dri2ExtensionName,
+                                  &va_dri2ExtensionHooks,
+                                  0, NULL)
 
 static CARD32 _va_resource_x_error_drawable = 0;
 static Bool   _va_resource_x_error_matched = False;
@@ -99,8 +99,8 @@
 VA_DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code)
 {
     if (_va_resource_x_error_drawable == err->resourceID) {
-      _va_resource_x_error_matched = True;
-      return True;
+        _va_resource_x_error_matched = True;
+        return True;
     }
 
     return False;
@@ -111,9 +111,9 @@
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
 
     if (XextHasExtension(info)) {
-	*eventBase = info->codes->first_event;
-	*errorBase = info->codes->first_error;
-	return True;
+        *eventBase = info->codes->first_event;
+        *errorBase = info->codes->first_error;
+        return True;
     }
 
     return False;
@@ -121,11 +121,11 @@
 
 Bool VA_DRI2QueryVersion(Display *dpy, int *major, int *minor)
 {
-    XExtDisplayInfo *info = DRI2FindDisplay (dpy);
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     xDRI2QueryVersionReply rep;
     xDRI2QueryVersionReq *req;
 
-    XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
+    XextCheckExtension(dpy, info, va_dri2ExtensionName, False);
 
     LockDisplay(dpy);
     GetReq(DRI2QueryVersion, req);
@@ -134,9 +134,9 @@
     req->majorVersion = DRI2_MAJOR;
     req->minorVersion = DRI2_MINOR;
     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
     *major = rep.majorVersion;
     *minor = rep.minorVersion;
@@ -147,13 +147,13 @@
 }
 
 Bool VA_DRI2Connect(Display *dpy, XID window,
-		 char **driverName, char **deviceName)
+                    char **driverName, char **deviceName)
 {
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     xDRI2ConnectReply rep;
     xDRI2ConnectReq *req;
 
-    XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
+    XextCheckExtension(dpy, info, va_dri2ExtensionName, False);
 
     LockDisplay(dpy);
     GetReq(DRI2Connect, req);
@@ -162,36 +162,36 @@
     req->window = window;
     req->driverType = DRI2DriverDRI;
     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
 
     if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
 
     *driverName = Xmalloc(rep.driverNameLength + 1);
     if (*driverName == NULL) {
-	_XEatData(dpy, 
-		  ((rep.driverNameLength + 3) & ~3) +
-		  ((rep.deviceNameLength + 3) & ~3));
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        _XEatData(dpy,
+                  ((rep.driverNameLength + 3) & ~3) +
+                  ((rep.deviceNameLength + 3) & ~3));
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
     _XReadPad(dpy, *driverName, rep.driverNameLength);
     (*driverName)[rep.driverNameLength] = '\0';
 
     *deviceName = Xmalloc(rep.deviceNameLength + 1);
     if (*deviceName == NULL) {
-	Xfree(*driverName);
-	_XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        Xfree(*driverName);
+        _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
     _XReadPad(dpy, *deviceName, rep.deviceNameLength);
     (*deviceName)[rep.deviceNameLength] = '\0';
@@ -208,7 +208,7 @@
     xDRI2AuthenticateReq *req;
     xDRI2AuthenticateReply rep;
 
-    XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
+    XextCheckExtension(dpy, info, va_dri2ExtensionName, False);
 
     LockDisplay(dpy);
     GetReq(DRI2Authenticate, req);
@@ -218,9 +218,9 @@
     req->magic = magic;
 
     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return False;
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
     }
 
     UnlockDisplay(dpy);
@@ -234,7 +234,7 @@
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     xDRI2CreateDrawableReq *req;
 
-    XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
+    XextSimpleCheckExtension(dpy, info, va_dri2ExtensionName);
 
     LockDisplay(dpy);
     GetReq(DRI2CreateDrawable, req);
@@ -252,7 +252,7 @@
     unsigned int attachement = 0; // FRONT_LEFT
     VA_DRI2Buffer *buffers;
 
-    XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
+    XextSimpleCheckExtension(dpy, info, va_dri2ExtensionName);
 
     XSync(dpy, False);
 
@@ -270,11 +270,11 @@
                                          &attachement, 1, NULL);
     VA_LeaveResourceError();
     if (buffers)
-      XFree(buffers);
+        XFree(buffers);
     if (VA_ResourceErrorMatched()) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return;
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return;
     }
 
     GetReq(DRI2DestroyDrawable, req);
@@ -286,10 +286,10 @@
 }
 
 VA_DRI2Buffer *VA_DRI2GetBuffers_internal(XExtDisplayInfo *info,
-                                          Display *dpy, XID drawable,
-                                          int *width, int *height,
-                                          unsigned int *attachments, int count,
-                                          int *outCount)
+        Display *dpy, XID drawable,
+        int *width, int *height,
+        unsigned int *attachments, int count,
+        int *outCount)
 {
     xDRI2GetBuffersReply rep;
     xDRI2GetBuffersReq *req;
@@ -305,46 +305,46 @@
     req->count = count;
     p = (CARD32 *) &req[1];
     for (i = 0; i < count; i++)
-	p[i] = attachments[i];
+        p[i] = attachments[i];
 
     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-	return NULL;
+        return NULL;
     }
 
     if (width)
-      *width = rep.width;
+        *width = rep.width;
     if (height)
-      *height = rep.height;
+        *height = rep.height;
     if (outCount)
-      *outCount = rep.count;
+        *outCount = rep.count;
 
     buffers = Xmalloc(rep.count * sizeof buffers[0]);
     if (buffers == NULL) {
-	_XEatData(dpy, rep.count * sizeof repBuffer);
-	return NULL;
+        _XEatData(dpy, rep.count * sizeof repBuffer);
+        return NULL;
     }
 
     for (i = 0; i < rep.count; i++) {
-	_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
-	buffers[i].attachment = repBuffer.attachment;
-	buffers[i].name = repBuffer.name;
-	buffers[i].pitch = repBuffer.pitch;
-	buffers[i].cpp = repBuffer.cpp;
-	buffers[i].flags = repBuffer.flags;
+        _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+        buffers[i].attachment = repBuffer.attachment;
+        buffers[i].name = repBuffer.name;
+        buffers[i].pitch = repBuffer.pitch;
+        buffers[i].cpp = repBuffer.cpp;
+        buffers[i].flags = repBuffer.flags;
     }
 
     return buffers;
 }
 
 VA_DRI2Buffer *VA_DRI2GetBuffers(Display *dpy, XID drawable,
-			   int *width, int *height,
-			   unsigned int *attachments, int count,
-			   int *outCount)
+                                 int *width, int *height,
+                                 unsigned int *attachments, int count,
+                                 int *outCount)
 {
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     VA_DRI2Buffer *buffers;
 
-    XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
+    XextCheckExtension(dpy, info, va_dri2ExtensionName, False);
 
     LockDisplay(dpy);
 
@@ -358,13 +358,13 @@
 }
 
 void VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
-		    CARD32 dest, CARD32 src)
+                       CARD32 dest, CARD32 src)
 {
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     xDRI2CopyRegionReq *req;
     xDRI2CopyRegionReply rep;
 
-    XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
+    XextSimpleCheckExtension(dpy, info, va_dri2ExtensionName);
 
     LockDisplay(dpy);
     GetReq(DRI2CopyRegion, req);
@@ -406,7 +406,7 @@
     xDRI2SwapBuffersReq *req;
     xDRI2SwapBuffersReply rep;
 
-    XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
+    XextSimpleCheckExtension(dpy, info, va_dri2ExtensionName);
 
     LockDisplay(dpy);
     GetReq(DRI2SwapBuffers, req);
diff --git a/va/x11/va_dri2.h b/va/x11/va_dri2.h
index 165f3fe..96da7cf 100644
--- a/va/x11/va_dri2.h
+++ b/va/x11/va_dri2.h
@@ -52,7 +52,7 @@
 VA_DRI2QueryVersion(Display *display, int *major, int *minor);
 extern Bool
 VA_DRI2Connect(Display *display, XID window,
-	    char **driverName, char **deviceName);
+               char **driverName, char **deviceName);
 extern Bool
 VA_DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
 extern void
@@ -61,9 +61,9 @@
 VA_DRI2DestroyDrawable(Display *display, XID handle);
 extern VA_DRI2Buffer *
 VA_DRI2GetBuffers(Display *dpy, XID drawable,
-	       int *width, int *height,
-	       unsigned int *attachments, int count,
-	       int *outCount);
+                  int *width, int *height,
+                  unsigned int *attachments, int count,
+                  int *outCount);
 extern void
 VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
                   CARD32 dest, CARD32 src);
diff --git a/va/x11/va_dri2str.h b/va/x11/va_dri2str.h
index 1515eeb..a1607b5 100644
--- a/va/x11/va_dri2str.h
+++ b/va/x11/va_dri2str.h
@@ -33,27 +33,27 @@
 #ifndef _DRI2_PROTO_H_
 #define _DRI2_PROTO_H_
 
-#define DRI2_NAME			"DRI2"
-#define DRI2_MAJOR			1
-#define DRI2_MINOR			2
+#define DRI2_NAME           "DRI2"
+#define DRI2_MAJOR          1
+#define DRI2_MINOR          2
 
-#define DRI2NumberErrors		0
-#define DRI2NumberEvents		2
-#define DRI2NumberRequests		13
+#define DRI2NumberErrors        0
+#define DRI2NumberEvents        2
+#define DRI2NumberRequests      13
 
-#define X_DRI2QueryVersion		0
-#define X_DRI2Connect			1
-#define X_DRI2Authenticate		2
-#define X_DRI2CreateDrawable		3
-#define X_DRI2DestroyDrawable		4
-#define X_DRI2GetBuffers		5
-#define X_DRI2CopyRegion		6
-#define X_DRI2GetBuffersWithFormat	7
-#define X_DRI2SwapBuffers		8
-#define X_DRI2GetMSC			9
-#define X_DRI2WaitMSC			10
-#define X_DRI2WaitSBC			11
-#define X_DRI2SwapInterval		12
+#define X_DRI2QueryVersion      0
+#define X_DRI2Connect           1
+#define X_DRI2Authenticate      2
+#define X_DRI2CreateDrawable        3
+#define X_DRI2DestroyDrawable       4
+#define X_DRI2GetBuffers        5
+#define X_DRI2CopyRegion        6
+#define X_DRI2GetBuffersWithFormat  7
+#define X_DRI2SwapBuffers       8
+#define X_DRI2GetMSC            9
+#define X_DRI2WaitMSC           10
+#define X_DRI2WaitSBC           11
+#define X_DRI2SwapInterval      12
 
 typedef struct {
     CARD32  attachment B32;
@@ -84,7 +84,7 @@
     CARD32  pad4 B32;
     CARD32  pad5 B32;
 } xDRI2QueryVersionReply;
-#define sz_xDRI2QueryVersionReply	32
+#define sz_xDRI2QueryVersionReply   32
 
 typedef struct {
     CARD8   reqType;
@@ -93,7 +93,7 @@
     CARD32  window B32;
     CARD32  driverType B32;
 } xDRI2ConnectReq;
-#define sz_xDRI2ConnectReq	12
+#define sz_xDRI2ConnectReq  12
 
 typedef struct {
     BYTE    type;   /* X_Reply */
@@ -107,7 +107,7 @@
     CARD32  pad4 B32;
     CARD32  pad5 B32;
 } xDRI2ConnectReply;
-#define sz_xDRI2ConnectReply	32
+#define sz_xDRI2ConnectReply    32
 
 typedef struct {
     CARD8   reqType;
@@ -130,7 +130,7 @@
     CARD32  pad5 B32;
     CARD32  pad6 B32;
 } xDRI2AuthenticateReply;
-#define sz_xDRI2AuthenticateReply	32
+#define sz_xDRI2AuthenticateReply   32
 
 typedef struct {
     CARD8   reqType;
@@ -169,7 +169,7 @@
     CARD32  pad3 B32;
     CARD32  pad4 B32;
 } xDRI2GetBuffersReply;
-#define sz_xDRI2GetBuffersReply	32
+#define sz_xDRI2GetBuffersReply 32
 
 typedef struct {
     CARD8   reqType;
@@ -194,7 +194,7 @@
     CARD32  pad6 B32;
     CARD32  pad7 B32;
 } xDRI2CopyRegionReply;
-#define sz_xDRI2CopyRegionReply	32
+#define sz_xDRI2CopyRegionReply 32
 
 typedef struct {
     CARD8   reqType;
diff --git a/va/x11/va_dri2tokens.h b/va/x11/va_dri2tokens.h
index 087159f..308f299 100644
--- a/va/x11/va_dri2tokens.h
+++ b/va/x11/va_dri2tokens.h
@@ -33,16 +33,16 @@
 #ifndef _DRI2_TOKENS_H_
 #define _DRI2_TOKENS_H_
 
-#define DRI2BufferFrontLeft		0
-#define DRI2BufferBackLeft		1
-#define DRI2BufferFrontRight		2
-#define DRI2BufferBackRight		3
-#define DRI2BufferDepth			4
-#define DRI2BufferStencil		5
-#define DRI2BufferAccum			6
-#define DRI2BufferFakeFrontLeft		7
-#define DRI2BufferFakeFrontRight	8
+#define DRI2BufferFrontLeft     0
+#define DRI2BufferBackLeft      1
+#define DRI2BufferFrontRight        2
+#define DRI2BufferBackRight     3
+#define DRI2BufferDepth         4
+#define DRI2BufferStencil       5
+#define DRI2BufferAccum         6
+#define DRI2BufferFakeFrontLeft     7
+#define DRI2BufferFakeFrontRight    8
 
-#define DRI2DriverDRI			0
+#define DRI2DriverDRI           0
 
 #endif
diff --git a/va/x11/va_dricommon.c b/va/x11/va_dricommon.c
index 2a57756..946703c 100644
--- a/va/x11/va_dricommon.c
+++ b/va/x11/va_dricommon.c
@@ -27,28 +27,28 @@
 static int x11_error_code = 0;
 static int (*old_error_handler)(Display *, XErrorEvent *);
 
-static int 
+static int
 error_handler(Display *dpy, XErrorEvent *error)
 {
     x11_error_code = error->error_code;
     return 0;
 }
 
-static void 
+static void
 x11_trap_errors(void)
 {
     x11_error_code    = 0;
     old_error_handler = XSetErrorHandler(error_handler);
 }
 
-static int 
+static int
 x11_untrap_errors(void)
 {
     XSetErrorHandler(old_error_handler);
     return x11_error_code;
 }
 
-static int 
+static int
 is_window(Display *dpy, Drawable drawable)
 {
     XWindowAttributes wattr;
@@ -87,12 +87,12 @@
     int i = 0;
 
     while (i < DRAWABLE_HASH_SZ) {
-	if (dri_drawable == dri_state->drawable_hash[i]) {
-	    dri_state->destroyDrawable(ctx, dri_drawable);
-	    dri_state->drawable_hash[i] = NULL;
-	    return;
-	}
-	i++;
+        if (dri_drawable == dri_state->drawable_hash[i]) {
+            dri_state->destroyDrawable(ctx, dri_drawable);
+            dri_state->drawable_hash[i] = NULL;
+            return;
+        }
+        i++;
     }
 }
 
@@ -112,7 +112,7 @@
             dri_state->destroyDrawable(ctx, prev);
         }
 
-	dri_state->drawable_hash[i] = NULL;
+        dri_state->drawable_hash[i] = NULL;
     }
 }
 
@@ -122,7 +122,7 @@
     return do_drawable_hash(ctx, drawable);
 }
 
-void 
+void
 va_dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
     struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
@@ -131,9 +131,9 @@
 }
 
 union dri_buffer *
-va_dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
+    va_dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
     struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
-    
+
     return dri_state->getRenderingBuffer(ctx, dri_drawable);
 }
diff --git a/va/x11/va_dricommon.h b/va/x11/va_dricommon.h
index ae17fac..3e62ce1 100644
--- a/va/x11/va_dricommon.h
+++ b/va/x11/va_dricommon.h
@@ -47,8 +47,7 @@
     VA_DUMMY    = VA_DRM_AUTH_CUSTOM
 };
 
-union dri_buffer 
-{
+union dri_buffer {
     struct {
         unsigned int attachment;
         unsigned int name;
@@ -60,8 +59,7 @@
     } dri2;
 };
 
-struct dri_drawable 
-{
+struct dri_drawable {
     XID x_drawable;
     int is_window;
     int x;
@@ -72,8 +70,7 @@
 };
 
 #define DRAWABLE_HASH_SZ 32
-struct dri_state 
-{
+struct dri_state {
     struct drm_state base;
 #ifndef ANDROID
     struct dri_drawable *drawable_hash[DRAWABLE_HASH_SZ];
diff --git a/va/x11/va_fglrx.c b/va/x11/va_fglrx.c
index 058e23d..3e166fb 100644
--- a/va/x11/va_fglrx.c
+++ b/va/x11/va_fglrx.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -39,7 +39,7 @@
 typedef struct AdapterInfo {
     int iSize;
     int iAdapterIndex;
-    char strUDID[ADL_MAX_PATH]; 
+    char strUDID[ADL_MAX_PATH];
     int iBusNumber;
     int iDeviceNumber;
     int iFunctionNumber;
@@ -121,9 +121,9 @@
     return m;
 }
 
-Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen,
-    int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
-    int *ddxDriverPatchVersion, char **clientDriverName )
+Bool VA_FGLRXGetClientDriverName(Display *dpy, int screen,
+                                 int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
+                                 int *ddxDriverPatchVersion, char **clientDriverName)
 {
     ADL_MAIN_CONTROL_CREATE          ADL_Main_Control_Create;
     ADL_MAIN_CONTROL_DESTROY         ADL_Main_Control_Destroy;
@@ -147,33 +147,33 @@
     if (clientDriverName)
         *clientDriverName = NULL;
 
-    libadl_handle = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL);
+    libadl_handle = dlopen("libatiadlxx.so", RTLD_LAZY | RTLD_GLOBAL);
     if (!libadl_handle)
         goto end;
 
     dlerror();
     ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE)
-        dlsym(libadl_handle,"ADL_Main_Control_Create");
+                              dlsym(libadl_handle, "ADL_Main_Control_Create");
     if (dlerror())
         goto end;
 
     ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY)
-        dlsym(libadl_handle,"ADL_Main_Control_Destroy");
+                               dlsym(libadl_handle, "ADL_Main_Control_Destroy");
     if (dlerror())
         goto end;
 
     ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET)
-        dlsym(libadl_handle,"ADL_Adapter_NumberOfAdapters_Get");
+                                       dlsym(libadl_handle, "ADL_Adapter_NumberOfAdapters_Get");
     if (dlerror())
         goto end;
 
     ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET)
-        dlsym(libadl_handle,"ADL_Adapter_AdapterInfo_Get");
+                                  dlsym(libadl_handle, "ADL_Adapter_AdapterInfo_Get");
     if (dlerror())
         goto end;
 
     ADL_Adapter_XScreenInfo_Get = (ADL_ADAPTER_XSCREENINFO_GET)
-        dlsym(libadl_handle,"ADL_Adapter_XScreenInfo_Get");
+                                  dlsym(libadl_handle, "ADL_Adapter_XScreenInfo_Get");
     if (dlerror())
         goto end;
 
diff --git a/va/x11/va_fglrx.h b/va/x11/va_fglrx.h
index 93ddd4b..1e077c6 100644
--- a/va/x11/va_fglrx.h
+++ b/va/x11/va_fglrx.h
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -28,8 +28,8 @@
 #include <X11/Xlib.h>
 
 DLL_HIDDEN
-Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen,
-    int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
-    int *ddxDriverPatchVersion, char **clientDriverName );
+Bool VA_FGLRXGetClientDriverName(Display *dpy, int screen,
+                                 int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
+                                 int *ddxDriverPatchVersion, char **clientDriverName);
 
 #endif /* VA_FGLRX_H */
diff --git a/va/x11/va_nvctrl.c b/va/x11/va_nvctrl.c
index 20c63d5..276b7f5 100644
--- a/va/x11/va_nvctrl.c
+++ b/va/x11/va_nvctrl.c
@@ -145,14 +145,14 @@
     NULL,                               /* error_string */
 };
 
-static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info,
-                                   nvctrl_extension_name, 
-                                   &nvctrl_extension_hooks,
-                                   NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK)
+static XEXT_GENERATE_FIND_DISPLAY(find_display, nvctrl_ext_info,
+                                  nvctrl_extension_name,
+                                  &nvctrl_extension_hooks,
+                                  NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK)
 
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
+static XEXT_GENERATE_CLOSE_DISPLAY(close_display, nvctrl_ext_info)
 
-static Bool XNVCTRLQueryVersion (Display *dpy, int *major, int *minor);
+static Bool XNVCTRLQueryVersion(Display *dpy, int *major, int *minor);
 
 /*
  * NV-CONTROL versions 1.8 and 1.9 pack the target_type and target_id
@@ -190,12 +190,13 @@
 }
 
 
-static Bool XNVCTRLQueryExtension (
+static Bool XNVCTRLQueryExtension(
     Display *dpy,
     int *event_basep,
     int *error_basep
-){
-    XExtDisplayInfo *info = find_display (dpy);
+)
+{
+    XExtDisplayInfo *info = find_display(dpy);
 
     if (XextHasExtension(info)) {
         if (event_basep) *event_basep = info->codes->first_event;
@@ -207,77 +208,80 @@
 }
 
 
-static Bool XNVCTRLQueryVersion (
+static Bool XNVCTRLQueryVersion(
     Display *dpy,
     int *major,
     int *minor
-){
-    XExtDisplayInfo *info = find_display (dpy);
+)
+{
+    XExtDisplayInfo *info = find_display(dpy);
     xnvCtrlQueryExtensionReply rep;
     xnvCtrlQueryExtensionReq   *req;
 
-    if(!XextHasExtension(info))
+    if (!XextHasExtension(info))
         return False;
 
-    XNVCTRLCheckExtension (dpy, info, False);
+    XNVCTRLCheckExtension(dpy, info, False);
 
-    LockDisplay (dpy);
-    GetReq (nvCtrlQueryExtension, req);
+    LockDisplay(dpy);
+    GetReq(nvCtrlQueryExtension, req);
     req->reqType = info->codes->major_opcode;
     req->nvReqType = X_nvCtrlQueryExtension;
-    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
-        UnlockDisplay (dpy);
-        SyncHandle ();
+    if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+        UnlockDisplay(dpy);
+        SyncHandle();
         return False;
     }
     if (major) *major = rep.major;
     if (minor) *minor = rep.minor;
-    UnlockDisplay (dpy);
-    SyncHandle ();
+    UnlockDisplay(dpy);
+    SyncHandle();
     return True;
 }
 
 
-static Bool XNVCTRLIsNvScreen (
+static Bool XNVCTRLIsNvScreen(
     Display *dpy,
     int screen
-){
-    XExtDisplayInfo *info = find_display (dpy);
+)
+{
+    XExtDisplayInfo *info = find_display(dpy);
     xnvCtrlIsNvReply rep;
     xnvCtrlIsNvReq   *req;
     Bool isnv;
 
-    if(!XextHasExtension(info))
+    if (!XextHasExtension(info))
         return False;
 
-    XNVCTRLCheckExtension (dpy, info, False);
+    XNVCTRLCheckExtension(dpy, info, False);
 
-    LockDisplay (dpy);
-    GetReq (nvCtrlIsNv, req);
+    LockDisplay(dpy);
+    GetReq(nvCtrlIsNv, req);
     req->reqType = info->codes->major_opcode;
     req->nvReqType = X_nvCtrlIsNv;
     req->screen = screen;
-    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
-        UnlockDisplay (dpy);
-        SyncHandle ();
+    if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+        UnlockDisplay(dpy);
+        SyncHandle();
         return False;
     }
     isnv = rep.isnv;
-    UnlockDisplay (dpy);
-    SyncHandle ();
+    UnlockDisplay(dpy);
+    SyncHandle();
     return isnv;
 }
 
 
-static Bool XNVCTRLQueryTargetStringAttribute (
+static Bool XNVCTRLQueryTargetStringAttribute(
     Display *dpy,
     int target_type,
     int target_id,
     unsigned int display_mask,
     unsigned int attribute,
     char **ptr
-){
-    XExtDisplayInfo *info = find_display (dpy);
+)
+{
+    XExtDisplayInfo *info = find_display(dpy);
     xnvCtrlQueryStringAttributeReply rep;
     xnvCtrlQueryStringAttributeReq   *req;
     Bool exists;
@@ -285,23 +289,23 @@
 
     if (!ptr) return False;
 
-    if(!XextHasExtension(info))
+    if (!XextHasExtension(info))
         return False;
 
-    XNVCTRLCheckExtension (dpy, info, False);
+    XNVCTRLCheckExtension(dpy, info, False);
     XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
 
-    LockDisplay (dpy);
-    GetReq (nvCtrlQueryStringAttribute, req);
+    LockDisplay(dpy);
+    GetReq(nvCtrlQueryStringAttribute, req);
     req->reqType = info->codes->major_opcode;
     req->nvReqType = X_nvCtrlQueryStringAttribute;
     req->target_type = target_type;
     req->target_id = target_id;
     req->display_mask = display_mask;
     req->attribute = attribute;
-    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
-        UnlockDisplay (dpy);
-        SyncHandle ();
+    if (!_XReply(dpy, (xReply *) &rep, 0, False)) {
+        UnlockDisplay(dpy);
+        SyncHandle();
         return False;
     }
     length = rep.length;
@@ -310,34 +314,35 @@
     *ptr = (char *) Xmalloc(numbytes);
     if (! *ptr) {
         _XEatData(dpy, length);
-        UnlockDisplay (dpy);
-        SyncHandle ();
+        UnlockDisplay(dpy);
+        SyncHandle();
         return False;
     } else {
         _XRead(dpy, (char *) *ptr, numbytes);
-        if (slop) _XEatData(dpy, 4-slop);
+        if (slop) _XEatData(dpy, 4 - slop);
     }
     exists = rep.flags;
-    UnlockDisplay (dpy);
-    SyncHandle ();
+    UnlockDisplay(dpy);
+    SyncHandle();
     return exists;
 }
 
-static Bool XNVCTRLQueryStringAttribute (
+static Bool XNVCTRLQueryStringAttribute(
     Display *dpy,
     int screen,
     unsigned int display_mask,
     unsigned int attribute,
     char **ptr
-){
+)
+{
     return XNVCTRLQueryTargetStringAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
-                                             screen, display_mask,
-                                             attribute, ptr);
+            screen, display_mask,
+            attribute, ptr);
 }
 
 
-Bool VA_NVCTRLQueryDirectRenderingCapable( Display *dpy, int screen,
-    Bool *isCapable )
+Bool VA_NVCTRLQueryDirectRenderingCapable(Display *dpy, int screen,
+        Bool *isCapable)
 {
     int event_base;
     int error_base;
@@ -354,9 +359,9 @@
     return True;
 }
 
-Bool VA_NVCTRLGetClientDriverName( Display *dpy, int screen,
-    int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
-    int *ddxDriverPatchVersion, char **clientDriverName )
+Bool VA_NVCTRLGetClientDriverName(Display *dpy, int screen,
+                                  int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
+                                  int *ddxDriverPatchVersion, char **clientDriverName)
 {
     if (ddxDriverMajorVersion)
         *ddxDriverMajorVersion = 0;
diff --git a/va/x11/va_nvctrl.h b/va/x11/va_nvctrl.h
index 3617537..beae4dc 100644
--- a/va/x11/va_nvctrl.h
+++ b/va/x11/va_nvctrl.h
@@ -27,12 +27,12 @@
 #include <X11/Xlib.h>
 
 DLL_HIDDEN
-Bool VA_NVCTRLQueryDirectRenderingCapable( Display *dpy, int screen,
-    Bool *isCapable );
+Bool VA_NVCTRLQueryDirectRenderingCapable(Display *dpy, int screen,
+        Bool *isCapable);
 
 DLL_HIDDEN
-Bool VA_NVCTRLGetClientDriverName( Display *dpy, int screen,
-    int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
-    int *ddxDriverPatchVersion, char **clientDriverName );
+Bool VA_NVCTRLGetClientDriverName(Display *dpy, int screen,
+                                  int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
+                                  int *ddxDriverPatchVersion, char **clientDriverName);
 
 #endif /* VA_NVCTRLLIB_H */
diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c
index 453ed46..4d06acd 100644
--- a/va/x11/va_x11.c
+++ b/va/x11/va_x11.c
@@ -8,11 +8,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -58,15 +58,15 @@
     { NULL,         0, NULL }
 };
 
-static int va_DisplayContextIsValid (
+static int va_DisplayContextIsValid(
     VADisplayContextP pDisplayContext
 )
 {
-    return (pDisplayContext != NULL && 
+    return (pDisplayContext != NULL &&
             pDisplayContext->pDriverContext != NULL);
 }
 
-static void va_DisplayContextDestroy (
+static void va_DisplayContextDestroy(
     VADisplayContextP pDisplayContext
 )
 {
@@ -87,7 +87,7 @@
     free(pDisplayContext);
 }
 
-static VAStatus va_DRI2_GetNumCandidates (
+static VAStatus va_DRI2_GetNumCandidates(
     VADisplayContextP pDisplayContext,
     int *num_candidates
 )
@@ -120,7 +120,7 @@
     return VA_STATUS_SUCCESS;
 }
 
-static VAStatus va_DRI2_GetDriverName (
+static VAStatus va_DRI2_GetDriverName(
     VADisplayContextP pDisplayContext,
     char **driver_name_ptr,
     int candidate_index
@@ -161,7 +161,7 @@
     return VA_STATUS_SUCCESS;
 }
 
-static VAStatus va_NVCTRL_GetDriverName (
+static VAStatus va_NVCTRL_GetDriverName(
     VADisplayContextP pDisplayContext,
     char **driver_name,
     int candidate_index
@@ -175,7 +175,7 @@
         return VA_STATUS_ERROR_INVALID_PARAMETER;
 
     result = VA_NVCTRLQueryDirectRenderingCapable(ctx->native_dpy, ctx->x11_screen,
-                                                  &direct_capable);
+             &direct_capable);
     if (!result || !direct_capable)
         return VA_STATUS_ERROR_UNKNOWN;
 
@@ -188,7 +188,7 @@
     return VA_STATUS_SUCCESS;
 }
 
-static VAStatus va_FGLRX_GetDriverName (
+static VAStatus va_FGLRX_GetDriverName(
     VADisplayContextP pDisplayContext,
     char **driver_name,
     int candidate_index
@@ -210,7 +210,7 @@
     return VA_STATUS_SUCCESS;
 }
 
-static VAStatus va_DisplayContextGetDriverName (
+static VAStatus va_DisplayContextGetDriverName(
     VADisplayContextP pDisplayContext,
     char **driver_name, int candidate_index
 )
@@ -231,7 +231,7 @@
     return vaStatus;
 }
 
-static VAStatus va_DisplayContextGetNumCandidates (
+static VAStatus va_DisplayContextGetNumCandidates(
     VADisplayContextP pDisplayContext,
     int *num_candidates
 )
@@ -245,12 +245,12 @@
      * fallbacks only have 1 candidate driver.
      */
     if (vaStatus != VA_STATUS_SUCCESS)
-      *num_candidates = 1;
+        *num_candidates = 1;
 
     return VA_STATUS_SUCCESS;
 }
 
-VADisplay vaGetDisplay (
+VADisplay vaGetDisplay(
     Display *native_dpy /* implementation specific */
 )
 {
@@ -295,7 +295,7 @@
     return (VADisplay)pDisplayContext;
 }
 
-void va_TracePutSurface (
+void va_TracePutSurface(
     VADisplay dpy,
     VASurfaceID surface,
     void *draw, /* the target Drawable */
@@ -312,7 +312,7 @@
     unsigned int flags /* de-interlacing flags */
 );
 
-VAStatus vaPutSurface (
+VAStatus vaPutSurface(
     VADisplay dpy,
     VASurfaceID surface,
     Drawable draw, /* X Drawable */
@@ -329,19 +329,19 @@
     unsigned int flags /* de-interlacing flags */
 )
 {
-  VADriverContextP ctx;
+    VADriverContextP ctx;
 
-  if (va_fool_postp)
-      return VA_STATUS_SUCCESS;
+    if (va_fool_postp)
+        return VA_STATUS_SUCCESS;
 
-  CHECK_DISPLAY(dpy);
-  ctx = CTX(dpy);
-  
-  VA_TRACE_LOG(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
-               destx, desty, destw, desth,
-               cliprects, number_cliprects, flags );
-  
-  return ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
-                                   destx, desty, destw, desth,
-                                   cliprects, number_cliprects, flags );
+    CHECK_DISPLAY(dpy);
+    ctx = CTX(dpy);
+
+    VA_TRACE_LOG(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
+                 destx, desty, destw, desth,
+                 cliprects, number_cliprects, flags);
+
+    return ctx->vtable->vaPutSurface(ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
+                                     destx, desty, destw, desth,
+                                     cliprects, number_cliprects, flags);
 }