Adding and reusing vpx_img_plane_{width, height}() functions.

Change-Id: I668afb50614644d2eac2e968e1fafd6d73170bec
diff --git a/vpxdec.c b/vpxdec.c
index 7f85fc9..e85c4fa 100644
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -229,18 +229,6 @@
   }
 }
 
-static int get_image_plane_width(int plane, const vpx_image_t *img) {
-  return (plane > 0 && img->x_chroma_shift > 0) ?
-             (img->d_w + 1) >> img->x_chroma_shift :
-             img->d_w;
-}
-
-static int get_image_plane_height(int plane, const vpx_image_t *img) {
-  return (plane > 0 &&  img->y_chroma_shift > 0) ?
-             (img->d_h + 1) >> img->y_chroma_shift :
-             img->d_h;
-}
-
 static void update_image_md5(const vpx_image_t *img, const int planes[3],
                              MD5Context *md5) {
   int i, y;
@@ -249,8 +237,8 @@
     const int plane = planes[i];
     const unsigned char *buf = img->planes[plane];
     const int stride = img->stride[plane];
-    const int w = get_image_plane_width(plane, img);
-    const int h = get_image_plane_height(plane, img);
+    const int w = vpx_img_plane_width(img, plane);
+    const int h = vpx_img_plane_height(img, plane);
 
     for (y = 0; y < h; ++y) {
       MD5Update(md5, buf, w);
@@ -267,8 +255,8 @@
     const int plane = planes[i];
     const unsigned char *buf = img->planes[plane];
     const int stride = img->stride[plane];
-    const int w = get_image_plane_width(plane, img);
-    const int h = get_image_plane_height(plane, img);
+    const int w = vpx_img_plane_width(img, plane);
+    const int h = vpx_img_plane_height(img, plane);
 
     for (y = 0; y < h; ++y) {
       fwrite(buf, 1, w, file);