st/va: use vl_video_buffer_adjust_size
authorChristian König <christian.koenig@amd.com>
Wed, 16 Dec 2015 20:11:17 +0000 (21:11 +0100)
committerChristian König <christian.koenig@amd.com>
Tue, 12 Jan 2016 12:28:24 +0000 (13:28 +0100)
Use the new helper function instead of open coding it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/state_trackers/va/image.c

index 044ce3a18587ccfba2329e624d9e039b8ca866df..2c42a985823c2ee8c9e451fd61475d778b4f8cf5 100644 (file)
@@ -34,6 +34,7 @@
 #include "util/u_video.h"
 
 #include "vl/vl_winsys.h"
+#include "vl/vl_video_buffer.h"
 
 #include "va_private.h"
 
@@ -61,15 +62,9 @@ vlVaVideoSurfaceSize(vlVaSurface *p_surf, int component,
    *width = p_surf->templat.width;
    *height = p_surf->templat.height;
 
-   if (component > 0) {
-      if (p_surf->templat.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
-         *width /= 2;
-         *height /= 2;
-      } else if (p_surf->templat.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422)
-         *width /= 2;
-   }
-   if (p_surf->templat.interlaced)
-      *height /= 2;
+   vl_video_buffer_adjust_size(width, height, component,
+                               p_surf->templat.chroma_format,
+                               p_surf->templat.interlaced);
 }
 
 VAStatus